-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding prod aws config and auto-deploy on merges to syntehtix-prod br… #104
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Build & Tag Container, Push to ECR, Deploy to UAT | ||
|
||
on: | ||
push: | ||
branches: | ||
- synthetix-prod | ||
|
||
jobs: | ||
build: | ||
name: Build, Tag & push to ECR, Deploy to PROD | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup node | ||
uses: actions/setup-node@v1 | ||
|
||
- name: Install Dependencies | ||
run: yarn install | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_CI_USER_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_CI_USER_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-2 | ||
|
||
- name: Build, tag, and push Geth to ECR | ||
env: | ||
AWS_ACCOUNT_NUMBER: ${{ secrets.AWS_CI_AWS_ACCOUNT_ID }} | ||
run: ./docker/publish-geth-container.sh synthetix-uat | ||
|
||
- name: Build, tag, and push Full Node to ECR | ||
env: | ||
AWS_ACCOUNT_NUMBER: ${{ secrets.AWS_CI_AWS_ACCOUNT_ID }} | ||
run: ./docker/publish-rollup-fullnode-container.sh synthetix-uat | ||
|
||
- name: Stop existing ECS tasks to auto-start task with new image | ||
run: | | ||
./.github/scripts/stop-ecs-task.sh synthetix-uat-web synthetix-prod-web | ||
./.github/scripts/stop-ecs-task.sh synthetix-uat-geth synthetix-prod-geth | ||
|
||
|
||
- name: Logout of Amazon ECR | ||
if: always() | ||
run: docker logout ${{ steps.login-ecr.outputs.registry }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Deploying L2 Geth node to Synthetix PROD | ||
|
||
## Prerequisites | ||
See prerequisites from parent AWS directory. | ||
|
||
## Steps | ||
|
||
### 1) Configure the Amazon ECS CLI | ||
1. Create a cluster configuration: | ||
``` | ||
ecs-cli configure --cluster synthetix-prod-geth --default-launch-type EC2 --config-name synthetix-prod-geth-config --region us-east-2 | ||
``` | ||
|
||
2. Create a profile to use to create the environment | ||
``` | ||
ecs-cli configure profile --access-key <your access key here> --secret-key <your secret here> --profile-name synthetix-prod-geth-profile | ||
``` | ||
|
||
### 2) Create the Cluster | ||
``` | ||
ecs-cli up --keypair synthetix-prod --capability-iam --size 1 --instance-type c5.4xlarge --cluster-config synthetix-prod-geth-config --ecs-profile synthetix-prod-geth-profile --port 9545 --security-group <security group ID> --vpc <vpc ID> --subnets <comma-separated subnet IDs> | ||
``` | ||
|
||
This may take a few minutes to finish. The result will be a fully provisioned EC2 instance on which your service/task will be deployed. | ||
|
||
### 3) Choose the appropriate `docker-compose.yml` and `ecs-params.yml` | ||
For the rest of the commands, you'll need to be in this directory to use the `docker-compose.yml` and an `ecs-params.yml`. | ||
Make any necessary changes now. | ||
|
||
### 4) Deploy Service & Task to Cluster & register service discovery. | ||
``` | ||
ecs-cli compose --project-name synthetix-prod-geth service up --private-dns-namespace synthetix-prod --vpc <vpc ID> --enable-service-discovery --cluster-config synthetix-prod-geth-config --ecs-profile synthetix-prod-geth-profile --create-log-groups | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
version: "3" | ||
services: | ||
geth_l2: | ||
image: <aws_account_id>.dkr.ecr.us-east-2.amazonaws.com/optimism/geth:synthetix-prod | ||
volumes: | ||
- l2-node-data:/mnt/l2-node/l2:rw | ||
environment: | ||
- CLEAR_DATA_KEY | ||
- VOLUME_PATH=/mnt/l2-node/l2 | ||
- HOSTNAME=0.0.0.0 | ||
- PORT=9545 | ||
- NETWORK_ID=108 | ||
ports: | ||
- 9545:9545 | ||
|
||
logging: | ||
driver: awslogs | ||
options: | ||
awslogs-group: sythetix-prod-geth | ||
awslogs-region: us-east-2 | ||
awslogs-stream-prefix: geth | ||
|
||
volumes: | ||
l2-node-data: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
version: 1 | ||
task_definition: | ||
services: | ||
geth_l2: | ||
essential: true | ||
# healthcheck: | ||
# test: ["CMD-SHELL", "curl -f -H \"Content-Type: application/json\" -d '{\"jsonrpc\": \"2.0\", \"id\": 9999999, \"method\": \"net_version\"}' http://localhost:9545/ || exit 1"] | ||
# interval: 10s | ||
# timeout: 5s | ||
# retries: 3 | ||
# start_period: 10s | ||
mem_limit: 32653700000 | ||
|
||
|
||
ecs_network_mode: awsvpc | ||
docker_volumes: | ||
- name: l2-node-data | ||
scope: shared | ||
autoprovision: true | ||
driver: 'local' | ||
|
||
run_params: | ||
network_configuration: | ||
awsvpc_configuration: | ||
subnets: | ||
- <subnet(s) here> | ||
security_groups: | ||
- <security group(s) here> | ||
service_discovery_service: | ||
name: 'geth' | ||
description: 'Synthetix PROD Geth Service Discovery' | ||
dns_config: | ||
type: 'A' | ||
ttl: 60 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Deploying Web RPC Server to Synthetix PROD | ||
|
||
## Prerequisites | ||
See prerequisites from parent AWS directory. | ||
|
||
## Steps | ||
|
||
### 1) Configure the Amazon ECS CLI | ||
1. Create a cluster configuration: | ||
``` | ||
ecs-cli configure --cluster synthetix-prod-web --default-launch-type EC2 --config-name synthetix-prod-web-config --region us-east-2 | ||
``` | ||
|
||
2. Create a profile to use to create the environment | ||
``` | ||
ecs-cli configure profile --access-key <your access key here> --secret-key <your secret here> --profile-name synthetix-prod-web-profile | ||
``` | ||
|
||
### 2) Create the Cluster | ||
``` | ||
ecs-cli up --keypair synthetix-prod --capability-iam --size 1 --instance-type c5.xlarge --cluster-config synthetix-prod-web-config --ecs-profile synthetix-prod-web-profile --port 8545 --security-group <security group ID> --vpc <vpc ID> --subnets <comma-separated subnet IDs> | ||
``` | ||
|
||
This may take a few minutes to finish. The result will be a fully provisioned EC2 instance on which your service/task will be deployed. | ||
|
||
### 3) Choose the appropriate `docker-compose.yml` and `ecs-params.yml` | ||
For the rest of the commands, you'll need to be in this directory to use the `docker-compose.yml` and an `ecs-params.yml`. | ||
Make any necessary changes now. | ||
|
||
### 4) Deploy Service & Task to Cluster | ||
``` | ||
ecs-cli compose --project-name synthetix-prod-web service up --vpc <vpc ID> --cluster-config synthetix-prod-web-config --ecs-profile synthetix-prod-web-profile --create-log-groups | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
version: "3" | ||
services: | ||
rollup-full-node: | ||
image: <aws_account_id>.dkr.ecr.us-east-2.amazonaws.com/optimism/rollup-full-node:synthetix-prod | ||
volumes: | ||
- full-node-data:/mnt/full-node:rw | ||
- l1-node-data:/mnt/l1-node:rw | ||
ports: | ||
- 8545:8545 | ||
environment: | ||
- CLEAR_DATA_KEY | ||
- STARTUP_WAIT_TIMEOUT=60 | ||
- LOCAL_L1_NODE_PERSISTENT_DB_PATH=/mnt/l1-node | ||
- L2_RPC_SERVER_PERSISTENT_DB_PATH=/mnt/full-node/level | ||
- L2_WALLET_PRIVATE_KEY=0x29f3edee0ad3abf8e2699402e0e28cd6492c9be7eaab00d732a791c33552f797 | ||
- L2_NODE_WEB3_URL=http://synthetix-prod-geth.synthetix-prod:9545 | ||
|
||
logging: | ||
driver: awslogs | ||
options: | ||
awslogs-group: synthetix-prod-web | ||
awslogs-region: us-east-2 | ||
awslogs-stream-prefix: web | ||
|
||
volumes: | ||
full-node-data: | ||
l1-node-data: | ||
l2-node-data: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
version: 1 | ||
task_definition: | ||
services: | ||
rollup-full-node: | ||
essential: true | ||
healthcheck: | ||
test: ["CMD-SHELL", "curl -f -H \"Content-Type: application/json\" -d '{\"jsonrpc\": \"2.0\", \"id\": 9999999, \"method\": \"net_version\"}' http://localhost:8545/ || exit 1"] | ||
interval: 10s | ||
timeout: 5s | ||
retries: 3 | ||
start_period: 5s | ||
mem_limit: 7680000000 | ||
|
||
|
||
ecs_network_mode: host | ||
docker_volumes: | ||
- name: l1-node-data | ||
scope: task | ||
driver: 'local' | ||
- name: full-node-data | ||
scope: shared | ||
autoprovision: true | ||
driver: 'local' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's this used for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not currently. Was to be a health check, but the container has successfully stopped and restarted anytime there's a issue with geth, so it's not needed.