Skip to content
This repository has been archived by the owner on Dec 6, 2024. It is now read-only.

Commit

Permalink
Adding API and Remix deploy workflow for production
Browse files Browse the repository at this point in the history
  • Loading branch information
Asiya-Yunusa committed Nov 6, 2023
1 parent 7e9fdc9 commit 1e49243
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 59 deletions.
81 changes: 41 additions & 40 deletions .github/workflows/api-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- develop
- zksync-production-setup
# paths:
# - 'api/**'

Expand Down Expand Up @@ -63,7 +64,7 @@ jobs:
aws-region: us-east-2
role-to-assume: arn:aws:iam::599564732950:role/Aws-GH-Action-Assume-Role-ZKSync
role-session-name: GHZKSync

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
Expand All @@ -75,21 +76,21 @@ jobs:
# curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable -y
# rustup update
# rustup component add clippy
# rustup install nightly
# rustup install nightly
# sudo apt install musl-tools
# rustup target add x86_64-unknown-linux-musl


# - name: Toolchains info
# run: |
# cargo --version --verbose
# rustc --version
# cargo clippy --version
# cargo clippy --version

# - name: Build
# run: |
# cd api
# cargo build --target=x86_64-unknown-linux-musl
# cargo build --target=x86_64-unknown-linux-musl
# ls ./target/debug/ -al

- name: Build, tag, and push docker image to Amazon ECR
Expand Down Expand Up @@ -130,7 +131,7 @@ jobs:
# inject the expected React package URL for CORS logic
environment-variables: |
RUST_LOG=INFO
VITE_URL=https://zksync-plugin.nethermind.dev
VITE_URL=https://zksync-cairo-remix-dev.nethermind.io
PROMTAIL_USERNAME=${{secrets.PROMTAIL_USERNAME}}
PROMTAIL_PASSWORD=${{secrets.PROMTAIL_PASSWORD}}
Expand All @@ -141,40 +142,40 @@ jobs:
service: ${{ env.DEV_SERVICE_NAME }}
cluster: ${{ env.DEV_CLUSTER }}
wait-for-service-stability: true
# Deploy_Prod:
# if: github.ref == 'refs/heads/zksync-production-setup'
# runs-on: ubuntu-latest
# needs: Build
# steps:
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-region: us-east-2
# role-to-assume: arn:aws:iam::228016254426:role/Aws-GH-Action-Assume-Role-ZKSync-Production
# role-session-name: GHZKSync
Deploy_Prod:
if: github.ref == 'refs/heads/zksync-production-setup'
runs-on: ubuntu-latest
needs: Build
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::228016254426:role/Aws-GH-Action-Assume-Role-ZKSync-Production
role-session-name: GHZKSync

# - name: Download task definition
# run: |
# aws ecs describe-task-definition --task-definition zksync-remix-production-rocket --query taskDefinition > task-definition.json
- name: Download task definition
run: |
aws ecs describe-task-definition --task-definition zksync-remix-production-rocket --query taskDefinition > task-definition.json
# - name: Fill in the new image ID in the Amazon ECS task definition
# id: task-def
# uses: aws-actions/amazon-ecs-render-task-definition@v1
# with:
# task-definition: task-definition.json
# container-name: "rocket"
# image: ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:apiserver-${{ needs.Build.outputs.image-version }} #${{ github.run_number }}
# # inject the expected React package URL for CORS logic
# environment-variables: |
# RUST_LOG=INFO
# VITE_URL=https://cairo-remix-dev.nethermind.io
# PROMTAIL_USERNAME=${{secrets.PROMTAIL_USERNAME}}
# PROMTAIL_PASSWORD=${{secrets.PROMTAIL_PASSWORD}}
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: task-definition.json
container-name: "rocket"
image: ${{ env.REGISTRY }}/${{ env.REPOSITORY }}:apiserver-${{ needs.Build.outputs.image-version }} #${{ github.run_number }}
# inject the expected React package URL for CORS logic
environment-variables: |
RUST_LOG=INFO
VITE_URL=https://cairo-remix-dev.nethermind.io
PROMTAIL_USERNAME=${{secrets.PROMTAIL_USERNAME}}
PROMTAIL_PASSWORD=${{secrets.PROMTAIL_PASSWORD}}
# - name: Deploy Amazon ECS task definition
# uses: aws-actions/amazon-ecs-deploy-task-definition@v1
# with:
# task-definition: ${{ steps.task-def.outputs.task-definition }}
# service: ${{ env.PROD_SERVICE_NAME }}
# cluster: ${{ env.PROD_CLUSTER }}
# wait-for-service-stability: true
- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: ${{ env.PROD_SERVICE_NAME }}
cluster: ${{ env.PROD_CLUSTER }}
wait-for-service-stability: true
39 changes: 20 additions & 19 deletions .github/workflows/remix-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
push:
branches:
- develop
- zksync-production-setup
# paths:
# - 'plugin/**'

Expand Down Expand Up @@ -104,25 +105,25 @@ jobs:
run: aws s3 sync . s3://${{ env.BUCKET_NAME }} --acl public-read
working-directory: artifact

# Deploy_Prod:
# if: github.ref == 'refs/heads/zksync-production-setup'
# runs-on: ubuntu-latest
# needs: Build
# steps:
Deploy_Prod:
if: github.ref == 'refs/heads/zksync-production-setup'
runs-on: ubuntu-latest
needs: Build
steps:

# - name: Get artifact
# uses: actions/download-artifact@v3
# with:
# name: react-github-actions-build
# path: artifact
- name: Get artifact
uses: actions/download-artifact@v3
with:
name: react-github-actions-build
path: artifact

# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v1
# with:
# aws-region: us-east-2
# role-to-assume: arn:aws:iam::228016254426:role/Aws-GH-Action-Assume-Role-ZKSync-Production
# role-session-name: GHZKSync
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::228016254426:role/Aws-GH-Action-Assume-Role-ZKSync-Production
role-session-name: GHZKSync

# - name: Deploy to S3
# run: aws s3 sync . s3://${{ env.PROD_BUCKET_NAME }} --acl public-read
# working-directory: artifact
- name: Deploy to S3
run: aws s3 sync . s3://${{ env.PROD_BUCKET_NAME }} --acl public-read
working-directory: artifact

0 comments on commit 1e49243

Please sign in to comment.