Skip to content

Commit

Permalink
Merge pull request #193 from bosonprotocol/demo
Browse files Browse the repository at this point in the history
Migrate to GH Actions and EKS
  • Loading branch information
Radu Stefanache authored Jan 5, 2022
2 parents 34a52cb + 9227a6c commit 879cacd
Show file tree
Hide file tree
Showing 225 changed files with 1,454 additions and 7,152 deletions.
4 changes: 0 additions & 4 deletions .git-crypt/.gitattributes

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
config/secrets/** filter=git-crypt diff=git-crypt
*.sol linguist-language=Solidity
35 changes: 0 additions & 35 deletions .github/workflows/deploy-demo.yaml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/workflows/deploy-develop.yaml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/workflows/deploy-master.yaml

This file was deleted.

137 changes: 137 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
name: Build and Deploy leptonite.io

on:
push:
tags:
- 'v*'
pull_request:
branches:
- main

jobs:
api:
name: API related tasks
runs-on: ubuntu-latest
env:
REGISTRY: 031036423983.dkr.ecr.eu-west-2.amazonaws.com
services:
mongodb:
image: mongo:4.4.8
ports:
- 27017:27017
env:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: secret
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '12'
cache: 'npm'
- run: npm install
- run: npm run app:lint
- run: npm run app:format
- run: npm run tests:app:lint
- run: npm run tests:app:format
- run: npm run tests:app:unit:coverage
- run: npm run tests:app:persistence:coverage
- run: npm run tests:app:persistence
- run: npm run tests:app:component:coverage
- run: npm run tests:app:component
- run: npm run tests:coverage:badge
- name: Configure AWS credentials
if: ${{ github.event_name == 'push' }}
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: eu-west-2
- name: Login to Amazon ECR
if: ${{ github.event_name == 'push' }}
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Export TAG value
if: ${{ github.event_name == 'push' }}
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Build and push
if: ${{ github.event_name == 'push' }}
run: |
docker build --tag $REGISTRY/bsn/reference-backend:$TAG .
docker push $REGISTRY /bsn/reference-backend:$TAG
keepers:
name: Keepers related tasks
runs-on: ubuntu-latest
defaults:
run:
working-directory: "./external/keepers"
env:
REGISTRY: 031036423983.dkr.ecr.eu-west-2.amazonaws.com
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '12'
cache: 'npm'
- run: npm install
- name: Configure AWS credentials
if: ${{ github.event_name == 'push' }}
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: eu-west-2
- name: Login to Amazon ECR
if: ${{ github.event_name == 'push' }}
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Export TAG value
if: ${{ github.event_name == 'push' }}
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Build and push
if: ${{ github.event_name == 'push' }}
run: |
docker build --tag $REGISTRY/bsn/keepers:$TAG .
docker push $REGISTRY /bsn/keepers:$TAG
triggers:
name: Triggers related tasks
runs-on: ubuntu-latest
defaults:
run:
working-directory: "./terraform/functions"
steps:
- uses: actions/checkout@v2
- 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: eu-west-2
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_wrapper: false
- name: Terraform Format
id: fmt
run: terraform fmt -check -recursive
- name: Terraform Init
id: init
run: terraform init -backend-config=$TF_BACKEND_BUCKET -backend-config=$TF_BACKEND_STATE_KEY -backend-config='region=eu-west-2' -backend-config='encrypt=true'
env:
TF_BACKEND_BUCKET: ${{ secrets.TF_BACKEND_BUCKET }}
TF_BACKEND_STATE_KEY: ${{ secrets.TF_BACKEND_STATE_KEY }}
- name: Terraform Validate
id: validate
run: terraform validate -no-color
- run: 'echo "$TFVARS" > terraform.tfvars'
shell: bash
env:
TFVARS: ${{ secrets.TFVARS }}
- name: Terraform Plan
id: plan
run: terraform plan -no-color
- name: Terraform Apply
if: ${{ github.event_name == 'push' }}
id: apply
run: terraform apply -auto-approve
36 changes: 36 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,39 @@ node_modules

# Personal Preferences
.vscode

### Terraform template
# Local .terraform directories
terraform/**/.terraform/**

# .tfstate files
terraform/*.tfstate
terraform/*.tfstate.*

# Crash log files
terraform/crash.log

# Exclude all .tfvars files, which are likely to contain sentitive data, such as
# password, private keys, and other secrets. These should not be part of version
# control as they are data points which are potentially sensitive and subject
# to change depending on the environment.
#
terraform/*.tfvars

# Ignore override files as they are usually used to override resources locally and so
# are not checked in
terraform/override.tf
terraform/override.tf.json
terraform/*_override.tf
terraform/*_override.tf.json

# Include override files you do wish to add to version control using negated pattern
#
# !example_override.tf

# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan
# example: *tfplan*

# Ignore CLI configuration files
terraform/.terraformrc
terraform/terraform.rc
1 change: 0 additions & 1 deletion .ruby-version

This file was deleted.

4 changes: 0 additions & 4 deletions image/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,5 @@ RUN cd /opt/reference-backend \
&& npm install \
&& cd -

# Add metadata
ADD VERSION /VERSION
ADD TAG /TAG

# Run docker-entrypoint.sh start script by default
ENTRYPOINT ["/opt/reference-backend/bin/docker-entrypoint.sh"]
10 changes: 0 additions & 10 deletions Gemfile

This file was deleted.

Loading

0 comments on commit 879cacd

Please sign in to comment.