Add fly deploy scripts (#490)

This commit is contained in:
riordanp 2023-03-20 13:59:43 +00:00 committed by GitHub
parent b22a1e7f57
commit fd4c69b1c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 92 additions and 1 deletions

View File

@ -16,4 +16,7 @@ yarn-error.log
programs/margin-trade/src/lib-expanded.rs
programs/mango-v4/src/lib-expanded.rs
keeper/.env
keeper/.env
.env
ts/client/src/scripts/archive/ts.ts

View File

@ -0,0 +1,35 @@
name: Deploy to Fly
on:
workflow_dispatch:
inputs:
appName:
description: 'Fly App Name'
required: true
type: string
imageName:
description: 'Image Name'
description: 'liquidator, keeper, mm, settler'
required: true
type: string
imageTag:
description: 'Docker Image Tag'
required: true
type: string
default: 'latest'
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Fly
uses: superfly/flyctl-actions/setup-flyctl@master
- name: Deploy
run: flyctl deploy -c cd/${{ inputs.imageName }}.toml -a ${{ inputs.appName }}

6
cd/keeper.toml Normal file
View File

@ -0,0 +1,6 @@
app = "mango-keeper"
kill_signal = "SIGTERM"
kill_timeout = 30
[build]
dockerfile = "../bin/keeper/Dockerfile.keeper"

6
cd/liquidator.toml Normal file
View File

@ -0,0 +1,6 @@
app = "mango-liquidator"
kill_signal = "SIGTERM"
kill_timeout = 30
[build]
dockerfile = "../bin/liquidator/Dockerfile.liquidator"

6
cd/mm.toml Normal file
View File

@ -0,0 +1,6 @@
app = "mango-mm"
kill_signal = "SIGTERM"
kill_timeout = 30
[build]
dockerfile = "../ts/client/scripts/mm/Dockerfile.mm"

View File

@ -0,0 +1,35 @@
FROM debian:bullseye as builder
ARG NODE_VERSION=16.17.0
ARG YARN_VERSION=1.22.19
RUN apt-get update; apt install -y curl
RUN curl https://get.volta.sh | bash
ENV VOLTA_HOME /root/.volta
ENV PATH /root/.volta/bin:$PATH
RUN volta install node@${NODE_VERSION} yarn@${YARN_VERSION}
#######################################################################
RUN mkdir /app
WORKDIR /app
COPY . .
RUN yarn install && yarn run build
FROM debian:bullseye as run
LABEL fly_launch_runtime="nodejs"
COPY --from=builder /root/.volta /root/.volta
COPY --from=builder /app /app
WORKDIR /app
ENV NODE_ENV production
ENV PATH /root/.volta/bin:$PATH
RUN adduser --system --group --no-create-home mangouser
USER mangouser
CMD [ "node", "dist/cjs/src/scripts/mm/market-maker.js" ]