-
Notifications
You must be signed in to change notification settings - Fork 20
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
build: Build and deploy testnet #129
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4fd507b
docs: Update VM instructions to use Ubuntu
bgins f520343
build: Add testnet contracts deploy action
bgins a98bb0e
build: Remove Cloudflare token and Doppler config
bgins 72205f2
build: Add testnet solver and job-creator build and deploy
bgins 42504b4
build: Add restart Testnet solver and job creator actions
bgins 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,24 @@ | ||
name: Deploy Testnet contracts | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
contracts: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
context: app | ||
|
||
- name: Install Doppler CLI | ||
uses: dopplerhq/cli-action@v1 | ||
|
||
- name: Deploy contracts | ||
id: deploy-contracts | ||
env: | ||
DOPPLER_TOKEN: ${{ secrets.TESTNET_DOPPLER_TOKEN_CONTRACTS_DEPLOY }} | ||
run: | | ||
cd hardhat | ||
npm ci | ||
doppler run -- npx hardhat deploy --network arbitrumSepolia | ||
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,124 @@ | ||
name: Deploy Testnet services | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
solver-build-deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
context: app | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-1 | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
with: | ||
mask-password: 'true' | ||
|
||
- name: Solver build, tag, and push image to Amazon ECR | ||
id: build-image | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
ECR_REPOSITORY_SOLVER: ${{ secrets.ECR_REPOSITORY_SOLVER }} | ||
run: | | ||
docker build \ | ||
-t $ECR_REPOSITORY_SOLVER \ | ||
-f ./docker/solver/Dockerfile \ | ||
--build-arg="expose_via=cloudflare" \ | ||
. | ||
docker tag $ECR_REPOSITORY_SOLVER:latest $ECR_REGISTRY/$ECR_REPOSITORY_SOLVER:latest | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY_SOLVER:latest | ||
|
||
- name: Solver deploy to EC2 instance | ||
uses: appleboy/ssh-action@master | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
ECR_REPOSITORY_SOLVER: ${{ secrets.ECR_REPOSITORY_SOLVER }} | ||
TESTNET_DOPPLER_TOKEN_SOLVER: ${{ secrets.TESTNET_DOPPLER_TOKEN_SOLVER }} | ||
with: | ||
host: ${{ secrets.TESTNET_EC2_HOST_SOLVER }} | ||
username: ${{ secrets.TESTNET_EC2_USERNAME_SOLVER }} | ||
key: ${{ secrets.TESTNET_EC2_PRIVATE_KEY_SOLVER }} | ||
envs: ECR_REGISTRY, ECR_REPOSITORY_SOLVER, TESTNET_DOPPLER_TOKEN_SOLVER | ||
script_stop: true | ||
script: | | ||
docker stop solver || true | ||
docker rm solver || true | ||
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $ECR_REGISTRY | ||
bgins marked this conversation as resolved.
Show resolved
Hide resolved
|
||
docker system prune -af | ||
docker pull $ECR_REGISTRY/$ECR_REPOSITORY_SOLVER:latest | ||
docker run \ | ||
-d \ | ||
--restart always \ | ||
--name solver \ | ||
-e DOPPLER_TOKEN=$TESTNET_DOPPLER_TOKEN_SOLVER \ | ||
$ECR_REGISTRY/$ECR_REPOSITORY_SOLVER:latest | ||
|
||
job-creator-build-deploy: | ||
needs: [solver-build-deploy] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
context: app | ||
|
||
- name: Configure AWS Credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-east-1 | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
with: | ||
mask-password: 'true' | ||
|
||
- name: Job creator build, tag, and push image to Amazon ECR | ||
id: build-image | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
ECR_REPOSITORY_JOB_CREATOR: ${{ secrets.ECR_REPOSITORY_JOB_CREATOR }} | ||
run: | | ||
docker build \ | ||
-t $ECR_REPOSITORY_JOB_CREATOR \ | ||
-f ./docker/job-creator/Dockerfile \ | ||
. | ||
docker tag $ECR_REPOSITORY_JOB_CREATOR:latest $ECR_REGISTRY/$ECR_REPOSITORY_JOB_CREATOR:latest | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY_JOB_CREATOR:latest | ||
|
||
- name: Job creator deploy to EC2 instance | ||
uses: appleboy/ssh-action@master | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
ECR_REPOSITORY_JOB_CREATOR: ${{ secrets.ECR_REPOSITORY_JOB_CREATOR }} | ||
TESTNET_DOPPLER_TOKEN_JOB_CREATOR: ${{ secrets.TESTNET_DOPPLER_TOKEN_JOB_CREATOR }} | ||
with: | ||
host: ${{ secrets.TESTNET_EC2_HOST_JOB_CREATOR }} | ||
username: ${{ secrets.TESTNET_EC2_USERNAME_JOB_CREATOR }} | ||
key: ${{ secrets.TESTNET_EC2_PRIVATE_KEY_JOB_CREATOR }} | ||
envs: ECR_REGISTRY, ECR_REPOSITORY_JOB_CREATOR, TESTNET_DOPPLER_TOKEN_JOB_CREATOR | ||
script_stop: true | ||
script: | | ||
docker stop job-creator || true | ||
docker rm job-creator || true | ||
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $ECR_REGISTRY | ||
bgins marked this conversation as resolved.
Show resolved
Hide resolved
|
||
docker system prune -af | ||
docker pull $ECR_REGISTRY/$ECR_REPOSITORY_JOB_CREATOR:latest | ||
docker run \ | ||
-d \ | ||
--restart always \ | ||
--name job-creator \ | ||
-e DOPPLER_TOKEN=$TESTNET_DOPPLER_TOKEN_JOB_CREATOR \ | ||
$ECR_REGISTRY/$ECR_REPOSITORY_JOB_CREATOR:latest |
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,17 @@ | ||
name: Restart Testnet job creator | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 😍 |
||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
job-creator-restart: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Restart job-creator container | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.TESTNET_EC2_HOST_JOB_CREATOR }} | ||
username: ${{ secrets.TESTNET_EC2_USERNAME_JOB_CREATOR }} | ||
key: ${{ secrets.TESTNET_EC2_PRIVATE_KEY_JOB_CREATOR }} | ||
script_stop: true | ||
script: | | ||
docker restart job-creator || true |
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,17 @@ | ||
name: Restart Testnet solver | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
solver-restart: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Restart solver container | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.TESTNET_EC2_HOST_SOLVER }} | ||
username: ${{ secrets.TESTNET_EC2_USERNAME_SOLVER }} | ||
key: ${{ secrets.TESTNET_EC2_PRIVATE_KEY_SOLVER }} | ||
script_stop: true | ||
script: | | ||
docker restart solver || true |
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
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.
We need to validate this works locally, to confirm we get the same contract addresses every time.