-
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.
[v1.0.0] Merge pull request #210 from protofire/release/1.0.0
Release version 1.0.0
- Loading branch information
Showing
116 changed files
with
3,004 additions
and
1,634 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
name: "Build, push to ECR and deploy to EC2 instance" | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'be-v*' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build_and_push_to_ECR: | ||
name: Build & push polkadot-wizard image to ECR. | ||
runs-on: ubuntu-latest | ||
env: | ||
# Secrets | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_REGION: ${{ secrets.AWS_REGION }} | ||
SSH_KEY: ${{ secrets.SSH_KEY }} | ||
|
||
# Env variables | ||
ACCOUNT_ID: 711012187398 | ||
REPOSITORY: 'polkadot-contract-wizard-compiler-be' | ||
DEPLOYMENT_SERVER_IP: '3.139.60.27' | ||
|
||
CONTAINER_BASE: "pkw" | ||
DB_EXTERNAL_PORT: 27027 | ||
BACKEND_EXTERNAL_PORT: 8000 | ||
WEB_EXTERNAL_PORT: 3000 | ||
WEB_ENVIRONMENT: "production" | ||
BRANCH: "develop" | ||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: 'true' | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ env.AWS_REGION }} | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
- name: Build compiler-be docker-image | ||
id: build-compiler-be-image | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
run: | | ||
docker build -t ${{ env.REPOSITORY }}:$GITHUB_REF_NAME . | ||
working-directory: ink-compiler-be/ | ||
|
||
- name: Set tag and push compiler-be image to Amazon ECR | ||
id: push-image | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
run: | | ||
docker tag ${{ env.REPOSITORY }}:$GITHUB_REF_NAME $ECR_REGISTRY/${{ env.REPOSITORY }}:$GITHUB_REF_NAME | ||
docker push $ECR_REGISTRY/${{ env.REPOSITORY }}:$GITHUB_REF_NAME | ||
- name: Update Docker Compose Deployment | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
run: | | ||
export IMAGE_URL=$ECR_REGISTRY/${{ env.REPOSITORY }}:$GITHUB_REF_NAME | ||
echo "$SSH_KEY" | tr -d '\r' > key.pem && chmod 400 key.pem | ||
ssh -o "StrictHostKeyChecking no" -i "key.pem" ubuntu@$DEPLOYMENT_SERVER_IP "export IMAGE_URL=$IMAGE_URL; sed -i '/COMPILER_BE_IMAGE/d' /home/ubuntu/polkadot-contract-wizard/.docker/dev.docker.env; echo COMPILER_BE_IMAGE=$IMAGE_URL >> /home/ubuntu/polkadot-contract-wizard/.docker/dev.docker.env; cd polkadot-contract-wizard/; docker-compose --env-file .docker/dev.docker.env down; sleep 5; docker-compose --env-file .docker/dev.docker.env up -d" | ||
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,74 @@ | ||
name: "Build, push to ECR and deploy to EC2 instance" | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'web-v*' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build_and_push_to_ECR: | ||
name: Build & push polkadot-wizard image to ECR. | ||
runs-on: ubuntu-latest | ||
env: | ||
# Secrets | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_REGION: ${{ secrets.AWS_REGION }} | ||
SSH_KEY: ${{ secrets.SSH_KEY }} | ||
|
||
# Env variables | ||
ACCOUNT_ID: 711012187398 | ||
REPOSITORY: 'polkadot-contract-wizard-web' | ||
DEPLOYMENT_SERVER_IP: '3.139.60.27' | ||
|
||
CONTAINER_BASE: "pkw" | ||
DB_EXTERNAL_PORT: 27027 | ||
BACKEND_EXTERNAL_PORT: 8000 | ||
WEB_EXTERNAL_PORT: 3000 | ||
WEB_ENVIRONMENT: "production" | ||
BRANCH: "develop" | ||
|
||
steps: | ||
- name: Check out Git repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: ${{ env.AWS_REGION }} | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
- name: Build web docker-image | ||
id: build-web-image | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
run: | | ||
cp .env.example .env | ||
docker build -f .docker/web/dev.Dockerfile -t ${{ env.REPOSITORY }}:$GITHUB_REF_NAME . | ||
- name: Set tag and push web image to Amazon ECR | ||
id: push-image | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
run: | | ||
docker tag ${{ env.REPOSITORY }}:$GITHUB_REF_NAME $ECR_REGISTRY/${{ env.REPOSITORY }}:$GITHUB_REF_NAME | ||
docker push $ECR_REGISTRY/${{ env.REPOSITORY }}:$GITHUB_REF_NAME | ||
- name: Update Docker Compose Deployment | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
run: | | ||
export IMAGE_URL=$ECR_REGISTRY/${{ env.REPOSITORY }}:$GITHUB_REF_NAME | ||
echo "$SSH_KEY" | tr -d '\r' > key.pem && chmod 400 key.pem | ||
ssh -o "StrictHostKeyChecking no" -i "key.pem" ubuntu@$DEPLOYMENT_SERVER_IP "\ | ||
export IMAGE_URL=$IMAGE_URL; sed -i '/WEB_IMAGE/d' /home/ubuntu/polkadot-contract-wizard/.docker/dev.docker.env; \ | ||
echo WEB_IMAGE=$IMAGE_URL >> /home/ubuntu/polkadot-contract-wizard/.docker/dev.docker.env; cd polkadot-contract-wizard/; \ | ||
docker-compose -f docker-compose.prod.yml --env-file .docker/dev.docker.env down; sleep 5; \ | ||
docker-compose -f docker-compose.prod.yml --env-file .docker/dev.docker.env up -d" | ||
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,61 @@ | ||
version: '3.8' | ||
|
||
networks: | ||
polkadot-wizard: | ||
name: polkadot-wizard | ||
|
||
services: | ||
web: | ||
container_name: ${CONTAINER_BASE}_web | ||
image: ${WEB_IMAGE} | ||
ports: | ||
- ${WEB_EXTERNAL_PORT}:3000 | ||
environment: | ||
- NODE_ENV=${WEB_ENVIRONMENT} | ||
- NODE_OPTIONS='--max-old-space-size=2048' | ||
networks: | ||
- polkadot-wizard | ||
depends_on: | ||
- compiler-be | ||
command: | ||
sh -c 'if [ "$WEB_ENVIRONMENT" = "development" ]; then | ||
yarn dev; | ||
else | ||
yarn start; | ||
fi' | ||
compiler-be: | ||
container_name: ${CONTAINER_BASE}_backend | ||
image: ${COMPILER_BE_IMAGE} | ||
ports: | ||
- ${BACKEND_EXTERNAL_PORT}:8000 | ||
environment: | ||
- MONGOURI=mongodb://mongodb:27017 | ||
networks: | ||
- polkadot-wizard | ||
depends_on: | ||
- mongodb | ||
mongodb: | ||
ports: | ||
- ${DB_EXTERNAL_PORT}:27017 | ||
container_name: ${CONTAINER_BASE}_mongodb | ||
restart: always | ||
logging: | ||
options: | ||
max-size: 1g | ||
image: mongo:5.0.16 | ||
networks: | ||
- polkadot-wizard | ||
volumes: | ||
- /data/mongodb:/data/db | ||
mongoexpress: | ||
image: mongo-express:0.54.0 | ||
ports: | ||
- 8081:8081 | ||
container_name: ${CONTAINER_BASE}_mongoexpress | ||
environment: | ||
- ME_CONFIG_MONGODB_SERVER=mongodb | ||
networks: | ||
- polkadot-wizard | ||
depends_on: | ||
- mongodb | ||
|
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 |
---|---|---|
|
@@ -49,6 +49,3 @@ services: | |
image: mongo:5.0.16 | ||
networks: | ||
- polkadot-wizard | ||
|
||
|
||
|
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.
ba13451
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.
Successfully deployed to the following URLs:
polkadot-contract-wizard – ./
polkadot-contract-wizard-proto-polkadot.vercel.app
polkadot-contract-wizard.vercel.app
polkadot-contract-wizard-git-main-proto-polkadot.vercel.app