-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from ferrumnet/develop
Develop
- Loading branch information
Showing
21 changed files
with
1,692 additions
and
51 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 |
---|---|---|
@@ -1,4 +1,7 @@ | ||
PORT=3000 | ||
MONGODB_URL=mongodb://127.0.0.1:27017/multiswap-node | ||
QUEUE=Transaction | ||
GATEWAY_BACKEND_URL= | ||
GATEWAY_BACKEND_URL=https://api-leaderboard.dev.svcs.ferrumnetwork.io | ||
REDIS_HOST=127.0.0.1 | ||
REDIS_PORT=6379 | ||
PRIVATE_KEY= | ||
PUBLIC_KEY= |
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,69 @@ | ||
name: Deploy to Amazon ECS | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
|
||
env: | ||
AWS_REGION: us-east-2 # set this to your preferred AWS region, e.g. us-west-1 | ||
ECR_REPOSITORY: ferrum-dev-multiswap # set this to your Amazon ECR repository name | ||
ECS_SERVICE: multiswap-node # set this to your Amazon ECS service name | ||
ECS_CLUSTER: ferrum-dev-cluster # set this to your Amazon ECS cluster name | ||
ECS_TASK_DEFINITION: multiswap-node # set this to the path to your Amazon ECS task definition | ||
# file, e.g. .aws/task-definition.json | ||
CONTAINER_NAME: multiswap-node # set this to the name of the container in the | ||
# containerDefinitions section of your task definition | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
environment: development | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- 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: ${{ env.AWS_REGION }} | ||
|
||
- name: Login to Amazon ECR | ||
id: login-ecr | ||
uses: aws-actions/amazon-ecr-login@v1 | ||
|
||
- name: Build, tag, and push image to Amazon ECR | ||
id: build-image | ||
env: | ||
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | ||
IMAGE_TAG: ${{ github.sha }} | ||
run: | | ||
# Build a docker container and | ||
# push it to ECR so that it can | ||
# be deployed to ECS. | ||
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . | ||
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:latest | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | ||
docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest | ||
deploy: | ||
needs: build | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
environment: development | ||
steps: | ||
- name: Deploy to ecs | ||
id: deploy-image | ||
env: | ||
IMAGE_TAG: ${{ github.sha }} | ||
run: | | ||
docker run fabfuel/ecs-deploy:1.10.2 ecs deploy ${{ env.ECS_CLUSTER }} ${{ env.ECS_SERVICE }} --tag ${{ github.sha }} --region ${{ env.AWS_REGION }} --access-key-id ${{ secrets.AWS_ACCESS_KEY_ID }} --secret-access-key ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
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 |
---|---|---|
|
@@ -22,4 +22,7 @@ yarn-error.log | |
!.env*.example | ||
|
||
# Code coverage | ||
coverage | ||
coverage | ||
|
||
# package lock | ||
package-lock.json |
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,12 @@ | ||
FROM node:18.12.1-alpine | ||
|
||
WORKDIR /app | ||
|
||
COPY . /app | ||
|
||
RUN mv .env.example .env | ||
RUN yarn install | ||
|
||
EXPOSE 3000 | ||
|
||
CMD yarn dev |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Install AWS CLI | ||
|
||
https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html#getting-started-install-instructions | ||
|
||
# Configure SSO session | ||
|
||
Use following document to configure your aws credentials via AWS SSO | ||
https://docs.aws.amazon.com/cli/latest/userguide/sso-configure-profile-token.html | ||
|
||
|
||
# View AWS service logs | ||
aws logs tail --follow --region us-east-2 <log_group_name> --since <time> | ||
|
||
example: | ||
for past 5 minutes logs | ||
|
||
aws logs tail --follow --region us-east-2 /ferrum/ecs/multiswap-node --since 5m | ||
|
||
|
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,48 @@ | ||
version: '3.8' | ||
# networks: | ||
# app-network: | ||
# driver: bridge | ||
|
||
services: | ||
redis: | ||
container_name: redis | ||
image: 'redis:7.0.8' | ||
ports: | ||
- '6379:6379' | ||
command: redis-server --save 20 1 --loglevel warning | ||
volumes: | ||
- redis:/data | ||
restart: | ||
on-failure | ||
# networks: | ||
# - multiswap | ||
expose: | ||
- 6379 | ||
multiswap_app: | ||
build: | ||
context: ./ | ||
# target: development | ||
container_name: multiswap_app | ||
image: multiswap_app:latest | ||
depends_on: | ||
- redis | ||
ports: | ||
- 3000:3000 | ||
environment: | ||
REDIS_HOST: redis | ||
REDIS_PORT: 6379 | ||
|
||
links: | ||
- redis | ||
restart: | ||
on-failure | ||
# networks: | ||
# - multiswap | ||
|
||
# networks: | ||
# multiswap: | ||
# external: | ||
# name: app | ||
volumes: | ||
redis: | ||
driver: local |
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.