Skip to content

Commit

Permalink
[v1.0.0] Merge pull request #210 from protofire/release/1.0.0
Browse files Browse the repository at this point in the history
Release version 1.0.0
  • Loading branch information
henrypalacios authored Oct 3, 2023
2 parents e44351f + b853407 commit ba13451
Show file tree
Hide file tree
Showing 116 changed files with 3,004 additions and 1,634 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/build_compiler_be.yaml
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"
74 changes: 74 additions & 0 deletions .github/workflows/build_web.yaml
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"
61 changes: 61 additions & 0 deletions docker-compose.prod.yml
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

3 changes: 0 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,3 @@ services:
image: mongo:5.0.16
networks:
- polkadot-wizard



14 changes: 1 addition & 13 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,7 @@ const customJestConfig = {
testMatch: ['<rootDir>/tests/**/*.(test).(ts|tsx)'],
moduleNameMapper: {
'^@/tests/(.*)$': '<rootDir>/tests/$1',
'^@/pages/(.*)$': '<rootDir>/pages/$1',
'^@/view/(.*)$': '<rootDir>/src/view/$1',
'^@/utils/(.*)$': '<rootDir>/src/utils/$1',
'^@/constants/(.*)$': '<rootDir>/src/constants/$1',
'^@/context$': '<rootDir>/src/context',
'^@/context/(.*)$': '<rootDir>/src/context/$1',
'^@/components': '<rootDir>/src/view/components',
'^@/domain$': '<rootDir>/src/domain',
'^@/domain/(.*)$': '<rootDir>/src/domain/$1',
'^@/infrastructure$': '<rootDir>/src/infrastructure',
'^@/infrastructure/(.*)$': '<rootDir>/src/infrastructure/$1',
'^@/hooks': '<rootDir>/src/hooks',
'^@/hooks/(.*)$': '<rootDir>/src/hooks/$1'
'^@/components': '<rootDir>/src/view/components'
}
}
module.exports = createJestConfig(customJestConfig)
38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "polkadot-contract-wizard",
"version": "0.3.2",
"version": "1.0.0",
"private": true,
"scripts": {
"dev": "next dev",
Expand All @@ -14,29 +14,28 @@
"dependencies": {
"@ant-design/colors": "^7.0.0",
"@emotion/cache": "^11.10.5",
"@emotion/react": "^11.11.0",
"@emotion/react": "^11.11.1",
"@emotion/server": "^11.10.0",
"@emotion/styled": "^11.10.5",
"@mui/icons-material": "^5.11.0",
"@mui/lab": "^5.0.0-alpha.123",
"@mui/icons-material": "^5.14.7",
"@mui/material": "^5.11.4",
"@next/font": "13.1.1",
"@polkadot/api": "^10.4.1",
"@polkadot/api-contract": "^10.4.1",
"@polkadot/extension-dapp": "^0.46.3",
"@polkadot/extension-inject": "^0.46.1",
"@polkadot/react-identicon": "^3.4.1",
"@polkadot/ui-keyring": "^3.2.1",
"@polkadot/ui-keyring": "^3.6.3",
"@polkadot/ui-settings": "^3.2.1",
"@testing-library/user-event": "^14.4.3",
"@types/react-syntax-highlighter": "^15.5.6",
"@types/react-syntax-highlighter": "^15.5.7",
"big.js": "^6.2.1",
"bn.js": "^5.2.1",
"copy-to-clipboard": "^3.3.3",
"dotenv": "^16.0.3",
"dexie": "^3.2.4",
"dotenv": "^16.3.1",
"lodash": "^4.17.21",
"next": "13.1.1",
"next-plausible": "^3.7.2",
"next": "13.4.19",
"next-plausible": "^3.11.1",
"react": "18.2.0",
"react-code-blocks": "^0.0.9-0",
"react-device-detect": "^2.2.2",
Expand All @@ -46,40 +45,41 @@
"semver": "^7.3.8",
"sharp": "^0.32.1",
"simplebar-react": "^3.2.0",
"useink": "^1.13.0",
"whatwg-url": "^13.0.0"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"@types/big.js": "^6.1.6",
"@types/fs-extra": "^11.0.1",
"@types/big.js": "^6.2.0",
"@types/fs-extra": "^11.0.2",
"@types/jest": "^29.5.1",
"@types/node": "^20.2.5",
"@types/node": "^20.6.2",
"@types/react": "18.0.38",
"@types/react-dom": "18.0.11",
"@types/react-toastify": "^4.1.0",
"@types/testing-library__jest-dom": "^5.14.6",
"@types/whatwg-url": "^11.0.0",
"@typescript-eslint/eslint-plugin": "^5.59.8",
"@typescript-eslint/parser": "^5.61.0",
"cypress": "^12.16.0",
"eslint": "^8.41.0",
"cypress": "^13.3.0",
"eslint": "^8.49.0",
"eslint-config-next": "13.1.1",
"eslint-config-prettier": "^8.6.0",
"eslint-config-prettier": "^9.0.0",
"eslint-import-resolver-typescript": "^3.5.2",
"eslint-plugin-jest": "^27.2.1",
"eslint-plugin-jest": "^27.2.3",
"eslint-plugin-jest-dom": "^4.0.3",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-react-hooks": "^4.6.0",
"fs-extra": "^11.1.1",
"husky": "^8.0.3",
"jest": "^29.5.0",
"jest-environment-jsdom": "^29.5.0",
"jest-environment-jsdom": "^29.7.0",
"lint-staged": "^13.1.0",
"prettier": "^2.8.3",
"stylelint-config-prettier": "^9.0.4",
"stylelint-prettier": "^3.0.0",
"typescript": "5.0.4"
"typescript": "5.1.3"
},
"lint-staged": {
"src/**/*.{js,ts,jsx,tsx}": [
Expand Down
Loading

1 comment on commit ba13451

@vercel
Copy link

@vercel vercel bot commented on ba13451 Oct 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.