Skip to content

Commit

Permalink
🪰
Browse files Browse the repository at this point in the history
  • Loading branch information
a-sync committed Feb 10, 2024
1 parent cbd5424 commit 691ac72
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: ☁️ Deploy to the cloud

on:
workflow_dispatch:
# push:
# branches:
# - master
push:
branches:
- master

jobs:
deploy:
Expand All @@ -18,6 +18,6 @@ jobs:

- uses: superfly/flyctl-actions/setup-flyctl@master
- name: 🛩 Deploy to fly.io
run: flyctl deploy --remote-only --auto-confirm --app ofcra-presets
run: flyctl deploy --remote-only --auto-confirm --region cdg --app ofcra-presets
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
31 changes: 9 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,23 @@
FROM debian:bullseye as builder

ARG NODE_VERSION=16.15.1

RUN apt-get update; apt install -y curl python-is-python3 pkg-config build-essential
RUN curl https://get.volta.sh | bash
ENV VOLTA_HOME /root/.volta
ENV PATH /root/.volta/bin:$PATH
RUN volta install node@${NODE_VERSION}

#######################################################################
FROM node:18 as builder

RUN mkdir /app
WORKDIR /app

# NPM will not install any package listed in "devDependencies" when NODE_ENV is set to "production",
# to install all modules: "npm install --production=false".
# Ref: https://docs.npmjs.com/cli/v9/commands/npm-install#description

ENV NODE_ENV development
COPY package.json package-lock.json ./
RUN npm install

COPY . .
RUN npm run build && rm -rf node_modules

RUN npm install && npm run build
FROM debian:bullseye
#######################################################################

FROM node:18
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

COPY --from=builder /app /app
RUN npm install

CMD [ "npm", "run", "start" ]
55 changes: 20 additions & 35 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -1,44 +1,29 @@
app = "ofcra-presets"

kill_signal = "SIGINT"
kill_timeout = 5
processes = []
primary_region = "cdg"

[env]
MOD_DB_FILE = "/data/mods.json"

[mounts]
source="ofcra_presets_data"
destination="/data"
DBG = "0"
MOD_DB_FILE = "/data/mods.json"

[experimental]
auto_rollback = true
allowed_public_ports = []
# cmd = ["node", "--max-old-space-size=180", "server.js"]
#[mounts]
# source="ofcra_presets_data"
# destination="/data"

[[services]]
http_checks = []
[http_service]
internal_port = 8080
processes = ["app"]
protocol = "tcp"
script_checks = []

[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"

[[services.ports]]
force_https = true
handlers = ["http"]
port = 80
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0

[[services.ports]]
handlers = ["tls", "http"]
port = 443
[http_service.concurrency]
type = "requests"
soft_limit = 50
hard_limit = 100

[[services.tcp_checks]]
[[http_service.checks]]
grace_period = "10s"
interval = "15s"
restart_limit = 0
timeout = "2s"
interval = "30s"
method = "GET"
timeout = "5s"
path = "/"
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ofcra-presets",
"version": "1.2.0",
"version": "1.3.0",
"description": "OFCRA Arma 3 Launcher presets generated from OFCRA ArmA3Sync events.",
"main": "server",
"scripts": {
Expand All @@ -19,12 +19,12 @@
"java.io": "^2.4.0"
},
"devDependencies": {
"@types/node": "12.20",
"@types/node": "^16",
"@types/utf8": "^3.0.1",
"tsc-watch": "^4.6.0",
"typescript": "^4.5.5"
},
"engines": {
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
"node": ">=16.0.0"
}
}
2 changes: 1 addition & 1 deletion server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const MOD_OVERRIDES = {
const CACHE_MAX_AGE = parseInt(process.env.CACHE_MAX_AGE || '0', 10);
const APP_HOST = process.env.HOST || '0.0.0.0';
const APP_PORT = parseInt(process.env.PORT || '8080', 10);
const DBG = Boolean(process.env.DBG || false);
const DBG = Boolean(Number(process.env.DBG));
const SECRET = process.env.SECRET || 'secret';

createServer(async (req, res) => {
Expand Down

0 comments on commit 691ac72

Please sign in to comment.