Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/ci #9

Merged
merged 14 commits into from
Feb 26, 2024
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Backend CI
name: Backend checks

on:
workflow_call:
pull_request:
paths:
- 'app/backend/**'
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/backend-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Backend deploy

on:
workflow_dispatch:

jobs:
backend-check:
uses: ./.github/workflows/backend-check.yaml

deploy:
needs: backend-check
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Install SSH key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_KEY }}
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}

- name: Copy input secrets to environment variables
uses: oNaiPs/secrets-to-env-action@ec46a22bfc9b37e014b627b3208b07eb8909ea0f
with:
secrets: ${{ toJSON(secrets) }}
include: INPUT_*
convert_prefix: false

- name: Deploy & run docker
run: docker compose up -d
env:
DOCKER_HOST: ${{ format('ssh://{0}@{1}', secrets.SSH_USERNAME, secrets.SSH_HOST) }}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Frontend CI
name: Frontend checks

on:
workflow_call:
pull_request:
paths:
- 'app/frontend/**'
Expand Down
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
*/node_modules/*
**/node_modules/*

/.pnp
.pnp.js
Expand All @@ -29,15 +28,15 @@ yarn-error.log*

# local env files
.env*.local
app/backend/.env
.env

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
/app/frontend/node_modules/

/.idea/
/.vscode/
test.ts
2 changes: 2 additions & 0 deletions app/backend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
24 changes: 24 additions & 0 deletions app/backend/.env.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
DEPLOYMENT_ENV=dev
API_PORT=8080

DB_URI=${INPUT_DB_URI?error}
DB_FRESH_START=false
PGSSLMODE=no-verify

PRICING_MODULE_ENABLED=false
PRICING_COINCAP_BASE_URL=https://api.coincap.io/v2
PRICING_COINCAP_API_KEY=${INPUT_COINCAP_APIKEY?error}
PRICING_MINUTE_RATE_LIMIT=500

ETHEREUM_RPC_ENDPOINT=${INPUT_ETHEREUM_ENDPOINT?error}
OPTIMISM_RPC_ENDPOINT=${INPUT_OPTIMISM_ENDPOINT?error}

ETHEREUM_MONITOR_MODULE_ENABLED=true
ETHEREUM_MONITOR_POLL_INTERVAL_MS=10000
ETHEREUM_MONITOR_START_BLOCK=19119000
ETHEREUM_MONITOR_MAX_LOG_RANGE=5000

OPTIMISM_MODULE_ENABLED=true
OPTIMISM_START_BLOCK=115952816
OPTIMISM_MAX_BLOCK_RANGE=50
OPTIMISM_POLL_INTERVAL_MS=15000
4 changes: 4 additions & 0 deletions app/backend/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# build files
/dist/*
14 changes: 14 additions & 0 deletions app/backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM node:20.11.1
RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
WORKDIR /home/node/app
USER node

COPY --chown=node:node package.json ./
RUN npm install

COPY --chown=node:node tsconfig.json ./
COPY --chown=node:node src ./src
RUN npm run build

EXPOSE 8080
CMD [ "node", "./dist/index.js" ]
Loading
Loading