Skip to content
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

Updating environment deploy scripts with new containers #112

Merged
merged 4 commits into from
Apr 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions aws/synthetix/dev/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Deploying Web RPC Server to Synthetix dev

## Prerequisites
See prerequisites from parent AWS directory.

## Steps

### 1) Configure the Amazon ECS CLI
1. Create a cluster configuration:
```
ecs-cli configure --cluster synthetix-dev --default-launch-type EC2 --config-name synthetix-dev-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-dev-profile
```

### 2) Create the Cluster
```
ecs-cli up --keypair optimism-dev --capability-iam --size 1 --instance-type t2.medium --cluster-config synthetix-dev-config --ecs-profile synthetix-dev-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-dev service up --vpc <vpc ID> --cluster-config synthetix-dev-config --ecs-profile synthetix-dev-profile --create-log-groups
```


# Redeploying after first deploy
Repeat step #4 above
56 changes: 50 additions & 6 deletions aws/synthetix/dev/full-node/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,47 @@
version: "3"
services:
rollup-full-node:
router:
image: <aws_account_id>.dkr.ecr.us-east-2.amazonaws.com/optimism/rollup-full-node:latest
ports:
- 8545:8545
environment:
- IS_ROUTING_SERVER=1
- STARTUP_WAIT_TIMEOUT=30
- L2_RPC_SERVER_HOST
- L2_RPC_SERVER_PORT=8545
- TRANSACTION_NODE_URL=http://0.0.0.0:8546
- READ_ONLY_NODE_URL=http://0.0.0.0:8547
- REQUEST_LIMIT_PERIOD_MILLIS=1000
- MAX_NON_TRANSACTION_REQUESTS_PER_UNIT_TIME=10
- MAX_TRANSACTIONS_PER_UNIT_TIME=5
# These are just so it waits for the downstream nodes to start up
- L2_NODE_WEB3_URL=http://0.0.0.0:8546
- L1_NODE_WEB3_URL=http://0.0.0.0:8547
logging:
driver: awslogs
options:
awslogs-group: synthetix-dev-full-node
awslogs-region: us-east-2
awslogs-stream-prefix: l2-router

transaction-node:
image: <aws_account_id>.dkr.ecr.us-east-2.amazonaws.com/optimism/rollup-full-node:latest
volumes:
- full-node-data:/mnt/full-node:rw
- l1-node-data:/mnt/l1-node:rw
- l2-node-data:/mnt/l2-node:rw
ports:
- 8545:8545
- 8546:8546
environment:
- IS_TRANSACTION_NODE=1
- STARTUP_WAIT_TIMEOUT=30
- CLEAR_DATA_KEY
- OPCODE_WHITELIST_MASK
- L1_SEQUENCER_MNEMONIC
- L2_TO_L1_MESSAGE_RECEIVER_ADDRESS
- L2_TO_L1_MESSAGE_FINALITY_DELAY_IN_BLOCKS
- L2_RPC_SERVER_HOST
- L2_RPC_SERVER_PORT
- L2_RPC_SERVER_HOST=0.0.0.0
- L2_RPC_SERVER_PORT=8546
- L2_RPC_SERVER_PERSISTENT_DB_PATH=/mnt/full-node/level
- L2_WALLET_PRIVATE_KEY=0x29f3edee0ad3abf8e2699402e0e28cd6492c9be7eaab00d732a791c33552f797
- LOCAL_L1_NODE_PORT
Expand All @@ -28,9 +53,28 @@ services:
options:
awslogs-group: synthetix-dev-full-node
awslogs-region: us-east-2
awslogs-stream-prefix: l2-rpc-server
awslogs-stream-prefix: l2-transaction-node

read-only-node:
image: <aws_account_id>.dkr.ecr.us-east-2.amazonaws.com/optimism/rollup-full-node:latest
ports:
- 8547:8547
environment:
- IS_READ_ONLY_NODE=1
- STARTUP_WAIT_TIMEOUT=30
- L2_RPC_SERVER_HOST=0.0.0.0
- L2_RPC_SERVER_PORT=8547
- L2_EXECUTION_MANAGER_ADDRESS=0xA193E42526F1FEA8C99AF609dcEabf30C1c29fAA
- L2_WALLET_PRIVATE_KEY=0x29f3edee0ad3abf8e2699402e0e28cd6492c9be7eaab00d732a791c33552f797
- L2_NODE_WEB3_URL=http://0.0.0.0:9545/
logging:
driver: awslogs
options:
awslogs-group: synthetix-dev-full-node
awslogs-region: us-east-2
awslogs-stream-prefix: l2-read-only-node

geth_l2:
l2-node:
image: <aws_account_id>.dkr.ecr.us-east-2.amazonaws.com/optimism/geth:latest
volumes:
- l2-node-data:/mnt/l2-node/l2:rw
Expand Down
26 changes: 16 additions & 10 deletions aws/synthetix/dev/full-node/ecs-params.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
version: 1
task_definition:
services:
rollup-full-node:
cpu_shares: 20
router:
cpu_shares: 204
mem_limit: 262144000
transaction-node:
cpu_shares: 408
mem_limit: 524288000
geth_l2:
cpu_shares: 60
read-only-node:
cpu_shares: 204
mem_limit: 262144000
l2-node:
cpu_shares: 820
mem_limit: 1597847999
graph-node:
cpu_shares: 10
mem_limit: 524288000
cpu_shares: 204
mem_limit: 262144000
ipfs:
cpu_shares: 5
mem_limit: 524288000
cpu_shares: 102
mem_limit: 262144000
postgres:
cpu_shares: 5
mem_limit: 524288000
cpu_shares: 102
mem_limit: 262144000


# This is all local for now -- eventually will change
Expand Down
1 change: 1 addition & 0 deletions aws/synthetix/prod/geth/ecs-params.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ task_definition:
# retries: 3
# start_period: 10s
mem_limit: 32653700000
cpu_shares: 16384


ecs_network_mode: awsvpc
Expand Down
4 changes: 4 additions & 0 deletions aws/synthetix/prod/web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ Make any necessary changes now.
```
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
```


# Redeploying after first deploy
Repeat step #4 above
120 changes: 112 additions & 8 deletions aws/synthetix/prod/web/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,133 @@
version: "3"
services:
rollup-full-node:
router:
image: <aws_account_id>.dkr.ecr.us-east-2.amazonaws.com/optimism/rollup-full-node:synthetix-prod
ports:
- 8545:8545
environment:
- IS_ROUTING_SERVER=1
- STARTUP_WAIT_TIMEOUT=60
- L2_RPC_SERVER_HOST
- L2_RPC_SERVER_PORT=8545
- TRANSACTION_NODE_URL=http://0.0.0.0:8546
- READ_ONLY_NODE_URL=http://0.0.0.0:8547
- REQUEST_LIMIT_PERIOD_MILLIS=1000
- MAX_NON_TRANSACTION_REQUESTS_PER_UNIT_TIME=50
- MAX_TRANSACTIONS_PER_UNIT_TIME=10
# These are just so it waits for the downstream nodes to start up
- L2_NODE_WEB3_URL=http://0.0.0.0:8546
- L1_NODE_WEB3_URL=http://0.0.0.0:8547

logging:
driver: awslogs
options:
awslogs-group: synthetix-prod-web
awslogs-region: us-east-2
awslogs-stream-prefix: l2-router

transaction-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
- 8546:8546
environment:
- IS_TRANSACTION_NODE=1
- CLEAR_DATA_KEY
- STARTUP_WAIT_TIMEOUT=60
- LOCAL_L1_NODE_PERSISTENT_DB_PATH=/mnt/l1-node
- NO_L1_NODE=1
- 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
- L2_RPC_SERVER_HOST=0.0.0.0
- L2_RPC_SERVER_PORT=8546

logging:
driver: awslogs
options:
awslogs-group: synthetix-prod-web
awslogs-region: us-east-2
awslogs-stream-prefix: web
awslogs-stream-prefix: l2-transaction-node

read-only-node:
image: <aws_account_id>.dkr.ecr.us-east-2.amazonaws.com/optimism/rollup-full-node:synthetix-prod
ports:
- 8547:8547
environment:
- IS_READ_ONLY_NODE=1
- STARTUP_WAIT_TIMEOUT=30
- L2_RPC_SERVER_HOST=0.0.0.0
- L2_RPC_SERVER_PORT=8547
- L2_EXECUTION_MANAGER_ADDRESS=0xA193E42526F1FEA8C99AF609dcEabf30C1c29fAA
- 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: l2-read-only-node

graph-node:
image: <aws_account_id>.dkr.ecr.us-east-2.amazonaws.com/optimism/the-graph:latest
ports:
- '8000:8000'
- '8001:8001'
- '8020:8020'
- '8030:8030'
- '8040:8040'
environment:
postgres_host: 0.0.0.0:5432
postgres_user: graph-node
postgres_pass: let-me-in
postgres_db: graph-node
ipfs: '0.0.0.0:5001'
ethereum: 'ovm:http://0.0.0.0:8545'
RUST_LOG: info
STARTUP_WAIT_TIMEOUT: 30
OVM_URL_WITH_PORT: 'http://0.0.0.0:8545'

logging:
driver: awslogs
options:
awslogs-group: synthetix-prod-web
awslogs-region: us-east-2
awslogs-stream-prefix: the-graph

ipfs:
image: ipfs/go-ipfs:v0.4.23
ports:
- '5001:5001'
volumes:
- ipfs-data:/data/ipfs

logging:
driver: awslogs
options:
awslogs-group: synthetix-prod-web
awslogs-region: us-east-2
awslogs-stream-prefix: the-graph-ipfs

postgres:
image: postgres
ports:
- '5432:5432'
command: ["postgres", "-cshared_preload_libraries=pg_stat_statements"]
environment:
POSTGRES_USER: graph-node
POSTGRES_PASSWORD: let-me-in
POSTGRES_DB: graph-node
volumes:
- postgres-data:/var/lib/postgresql/data

logging:
driver: awslogs
options:
awslogs-group: synthetix-prod-web
awslogs-region: us-east-2
awslogs-stream-prefix: the-graph-postgres

volumes:
full-node-data:
l1-node-data:
l2-node-data:

postgres-data:
ipfs-data:
58 changes: 48 additions & 10 deletions aws/synthetix/prod/web/ecs-params.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,62 @@
version: 1
task_definition:
services:
rollup-full-node:
router:
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
# 15%
cpu_shares: 409
mem_limit: 1.125GB
transaction-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:8546/ || exit 1"]
interval: 10s
timeout: 5s
retries: 3
start_period: 5s
# 40%
cpu_shares: 1638
mem_limit: 2GB # Was 3GB but ECS says not enough memory
read-only-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:8547/ || exit 1"]
interval: 10s
timeout: 5s
retries: 3
start_period: 5s
# 15%
cpu_shares: 818
mem_limit: 1.125GB
graph-node:
# 15%
cpu_shares: 614
mem_limit: 1.125GB
ipfs:
# 5%
cpu_shares: 204
mem_limit: 0.375GB
postgres:
# 10%
cpu_shares: 409
mem_limit: 0.75GB


ecs_network_mode: host
docker_volumes:
- name: l1-node-data
scope: task
driver: 'local'
- name: full-node-data
scope: shared
autoprovision: true
driver: 'local'

- name: full-node-data
scope: shared
autoprovision: true
driver: 'local'
- name: postgres-data
scope: task
driver: 'local'
- name: ipfs-data
scope: task
driver: 'local'
1 change: 1 addition & 0 deletions aws/synthetix/uat/geth/ecs-params.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ task_definition:
# retries: 3
# start_period: 10s
mem_limit: 32653700000
cpu_shares: 16384


ecs_network_mode: awsvpc
Expand Down
Loading