forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request ethereum#195 from XinFinOrg/XIN-243-finalise-terra…
…form-for-devnet finalise terraform for xdc devnet
- Loading branch information
Showing
13 changed files
with
180 additions
and
109 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,44 @@ | ||
# CI/CD pipeline for XDC | ||
This directory contains CI/CD scripts used for each of the XDC environments. | ||
|
||
### Devnet | ||
## How to deploy more nodes | ||
Adjust the number of variable `num_of_nodes` under file `.env`. (**Maximum supported is 58**) | ||
|
||
## Devnet | ||
Each PR merged into `dev-upgrade` will trigger below actions: | ||
- Tests | ||
- Terraform to apply infrascture changes(if any) | ||
- Docker build of XDC with devnet configurations with tag of `:latest` | ||
- Docker push to docker hub. https://hub.docker.com/repository/docker/xinfinorg/devnet | ||
- Deployment of the latest XDC image(from above) to devnet run by AWS ECS | ||
|
||
In order to allow pipeline able to push and deploy via ECR and ECS, we require below environment variables to be injected into the CI pipeline: | ||
1. ECR_REPO_NAME | ||
2. ECR_BASE_URI | ||
3. AWS_ACCESS_KEY_ID | ||
4. AWS_SECRET_ACCESS_KEY | ||
|
||
#### How to spin up more nodes in devnet | ||
NOTE: The terraform managed auto deployment is still under deployment. The current best way to spin up new nodes is done by below: | ||
1. `docker pull xinfinorg/devnet:latest` | ||
2. `docker run -it -e PRIVATE_KEYS={{Wallet-Private-key-Here}} xinfinorg/devnet:latest` | ||
|
||
### First time set up an new environment | ||
1. Pre-generate a list of node private keys in below format | ||
``` | ||
{ | ||
"xdc0": { | ||
"pk": {{PRIVATE KEY}} | ||
}, | ||
"xdc1": {...}, | ||
"xdc{{NUMBER}}: {...} | ||
} | ||
``` | ||
2. Access to aws console, create a bucket with name `terraform-devnet-bucket` | ||
3. Upload the file from step 1 into the above bucket with name `node-config.json` | ||
4. In order to allow pipeline able to push and deploy via ECR and ECS, we require below environment variables to be injected into the CI pipeline: | ||
1. DOCKER_USERNAME | ||
2. DOCKER_PASSWORD | ||
3. AWS_ACCESS_KEY_ID | ||
4. AWS_SECRET_ACCESS_KEY | ||
|
||
You are all set! | ||
|
||
### Testnet | ||
**WIP** | ||
## Testnet | ||
*** WIP *** | ||
Testnet release build are triggered by cutting a "pre-release" tag which matches the name of `TESTNET-{{release-version}}` from dev-upgrade or master branch. | ||
An example can be found here: https://github.com/XinFinOrg/XDPoSChain/releases/tag/Testnet-v2.0.0 | ||
For more information, refer to github documentation on the release: https://docs.github.com/en/repositories/releasing-projects-on-github/about-releases | ||
|
||
### Mainnet | ||
**WIP** | ||
## Mainnet | ||
*** WIP *** | ||
Mainnet release are triggered by making a normal release tag with name starting with `v` (stands for version) from the master branch. |
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 |
---|---|---|
|
@@ -31,6 +31,6 @@ EXPOSE 8545 | |
# ws | ||
EXPOSE 8555 | ||
# port | ||
EXPOSE 30304 | ||
EXPOSE 30303 | ||
|
||
ENTRYPOINT ["bash","/work/start.sh"] |
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 |
---|---|---|
@@ -1,2 +1,2 @@ | ||
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@194.233.77.19:30301 | ||
enode://1c20e6b46ce608c1fe739e78611225b94e663535b74a1545b1667eac8ff75ed43216306d123306c10e043f228e42cc53cb2728655019292380313393eaaf6e23@66.94.98.186:30301 | ||
enode://c31bf87732529ef2d92e247f546fb139b8ab7476fc4e2d14fe4ce38631890c11ca9f87fed8c1b3e505e116d9a2674644bbef7ec296e518b688cc692e2aef885d@194.233.77.19:30303 | ||
enode://a2e685e0daf718d4697f49eaa7c8e8bdfa25678d5b24afd8caa684261a90c513062b1fe9140effa04b7a98b0c971607b6413fe993344875e97137c00a7993efb@66.94.121.151:30303 |
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 |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
echo "Preparing to start the XDC chain, it's likely to take up to 1 minute" | ||
# Sleep for > 30 as we need to wait for the ECS tasks container being killed by fargate. Otherwise it will ended up with two same nodes running on a single /work/xdcchain directory | ||
sleep 45 | ||
sleep 60 | ||
|
||
if [ ! -d /work/xdcchain/XDC/chaindata ] | ||
then | ||
|
@@ -41,10 +41,11 @@ if test -z "$LOG_LEVEL" | |
then | ||
echo "Log level not set, default to verbosity of 3" | ||
else | ||
echo "Log level found, set to $LOG_LEVEL" | ||
log_level=$LOG_LEVEL | ||
fi | ||
|
||
netstats="aws_${wallet}:[email protected]:2000" | ||
netstats="${NODE_NAME}-${wallet}:[email protected]:2000" | ||
INSTANCE_IP=$(curl https://checkip.amazonaws.com) | ||
|
||
echo "Running a node with wallet: ${wallet} at IP: ${INSTANCE_IP}" | ||
|
@@ -53,7 +54,7 @@ echo "Starting nodes with $bootnodes ..." | |
XDC --ethstats ${netstats} --gcmode=archive \ | ||
--bootnodes ${bootnodes} --syncmode full \ | ||
--datadir /work/xdcchain --networkid 551 \ | ||
-port 30304 --rpc --rpccorsdomain "*" --rpcaddr 0.0.0.0 \ | ||
-port 30303 --rpc --rpccorsdomain "*" --rpcaddr 0.0.0.0 \ | ||
--rpcport 8545 \ | ||
--rpcapi admin,db,eth,debug,miner,net,shh,txpool,personal,web3,XDPoS \ | ||
--rpcvhosts "*" --unlock "${wallet}" --password /work/.pwd --mine \ | ||
|
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,2 @@ | ||
num_of_nodes=2 | ||
log_level=1 |
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
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
Oops, something went wrong.