Skip to content

Commit 51a32ed

Browse files
committed
Update CI workflows for unified deploy
1 parent 9b5b328 commit 51a32ed

6 files changed

Lines changed: 33 additions & 125 deletions

File tree

.github/workflows/outpost.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy to outpost/coup
1+
name: Deploy to staging
22

33
on:
44
push:
@@ -24,24 +24,11 @@ jobs:
2424
uses: actions/checkout@v3
2525
with:
2626
fetch-depth: 1
27-
- uses: actions/checkout@v3
2827
- uses: superfly/flyctl-actions/setup-flyctl@master
29-
- name: Deploy Backend to Coup
28+
- name: Deploy to staging
3029
run: |
3130
flyctl deploy \
32-
-c fly.citadel.toml \
33-
-a truncate-coup \
34-
--build-arg TR_COMMIT="$(git rev-parse HEAD)" \
35-
--build-arg TR_MSG="$(git log -1 --pretty=%B | head -n 1 | sed "s/\"/'/g")" \
36-
--build-arg TR_ENV="outpost" \
37-
--remote-only
38-
env:
39-
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
40-
- name: Deploy Frontend to Outpost
41-
run: |
42-
flyctl deploy \
43-
-c fly.client.toml \
44-
-a truncate-outpost \
31+
-a truncate-exclave \
4532
--build-arg TR_COMMIT="$(git rev-parse HEAD)" \
4633
--build-arg TR_MSG="$(git log -1 --pretty=%B | head -n 1 | sed "s/\"/'/g")" \
4734
--build-arg TR_ENV="outpost" \

.github/workflows/release.yml

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,11 @@ jobs:
2424
uses: actions/checkout@v3
2525
with:
2626
fetch-depth: 1
27-
- uses: actions/checkout@v3
2827
- uses: superfly/flyctl-actions/setup-flyctl@master
29-
- name: Deploy Backend to Citadel
28+
- name: Deploy to production
3029
run: |
3130
flyctl deploy \
32-
-c fly.citadel.toml \
33-
-a truncate-citadel \
34-
--build-arg TR_COMMIT="$(git rev-parse HEAD)" \
35-
--build-arg TR_MSG="$(git log -1 --pretty=%B | head -n 1 | sed "s/\"/'/g")" \
36-
--build-arg TR_ENV="production" \
37-
--remote-only
38-
env:
39-
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
40-
- name: Deploy Frontend to production
41-
run: |
42-
flyctl deploy \
43-
-c fly.client.toml \
44-
-a truncate-client \
31+
-a truncate \
4532
--build-arg TR_COMMIT="$(git rev-parse HEAD)" \
4633
--build-arg TR_MSG="$(git log -1 --pretty=%B | head -n 1 | sed "s/\"/'/g")" \
4734
--build-arg TR_ENV="production" \
Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM rust:latest as build
1+
FROM rust:latest AS build
22

33
RUN apt-get update && apt-get install -y \
44
libssl-dev \
@@ -9,7 +9,6 @@ RUN apt-get update && apt-get install -y \
99
git \
1010
jq
1111

12-
# Install latest binaryen release
1312
RUN mkdir -p /tmp/binaryen \
1413
&& curl -L https://github.com/WebAssembly/binaryen/releases/download/version_123/binaryen-version_123-x86_64-linux.tar.gz -o /tmp/binaryen.tar.gz \
1514
&& tar -xzf /tmp/binaryen.tar.gz -C /tmp/binaryen --strip-components=1 \
@@ -21,9 +20,8 @@ RUN mkdir -p /tmp/binaryen \
2120
RUN curl -fsSL https://deb.nodesource.com/setup_18.x | bash -
2221
RUN apt-get install -y nodejs
2322

24-
RUN curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
25-
# Keep this wasm-bindgen-cli version aligned with the latest egui release's dependency
26-
RUN cargo install -f wasm-bindgen-cli --version 0.2.100
23+
# Keep this wasm-bindgen-cli version aligned with the version in Cargo.lock
24+
RUN cargo install -f wasm-bindgen-cli --version 0.2.100
2725
RUN rustup target add wasm32-unknown-unknown
2826

2927
RUN mkdir /app
@@ -35,6 +33,7 @@ ARG TR_MSG
3533
ENV TR_MSG=$TR_MSG
3634
ARG TR_ENV
3735
ENV TR_ENV=$TR_ENV
36+
ENV SQLX_OFFLINE="true"
3837

3938
ADD truncate_server /app/truncate_server
4039
ADD truncate_client /app/truncate_client
@@ -43,26 +42,28 @@ ADD truncate_core /app/truncate_core
4342
ADD dict_builder /app/dict_builder
4443
ADD Cargo.* /app
4544

45+
RUN cargo build --release -p truncate_server
46+
4647
ADD web_client /app/web_client
4748
ADD .backstage /app/.backstage
4849
RUN chmod +x .backstage/build-web-client.sh
4950
ENV TRUNC_OPT=true
5051
RUN .backstage/build-web-client.sh
5152

52-
# Thin Docker image for runtime
53-
54-
FROM debian:bullseye-slim
53+
# runtime image
5554

56-
RUN apt-get update && apt-get install -y curl debian-keyring debian-archive-keyring apt-transport-https \
57-
&& curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg \
58-
&& curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | tee /etc/apt/sources.list.d/caddy-stable.list \
59-
&& apt update \
60-
&& apt install caddy
55+
FROM debian:bookworm-slim
6156

62-
RUN mkdir /app
63-
WORKDIR /app
57+
RUN apt-get update && apt-get install -y sqlite3 && rm -rf /var/lib/apt/lists/*
6458

65-
ADD Caddyfile /app
59+
COPY --from=build /app/target/release/truncate_server /usr/local/bin/
6660
COPY --from=build /app/web_client/src/_site /app/web_client
6761

68-
CMD caddy run
62+
RUN mkdir /truncate
63+
ADD word_definitions/defs.db.gz /truncate/defs.db.gz
64+
RUN gunzip /truncate/defs.db.gz
65+
66+
ENV STATIC_DIR=/app/web_client
67+
ENV TR_DEFS_FILE=/truncate/defs.db
68+
69+
CMD truncate_server

Dockerfile.citadel

Lines changed: 0 additions & 40 deletions
This file was deleted.

fly.client.toml

Lines changed: 0 additions & 30 deletions
This file was deleted.

fly.citadel.toml renamed to fly.toml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,27 @@
1-
# fly.toml file generated for truncate-citadel on 2023-04-10T21:00:49+12:00
2-
3-
# prod: -a truncate-citadel
4-
# staging: -a truncate-coup
1+
# Unified Truncate deployment
2+
# prod: fly deploy -a truncate
3+
# staging: fly deploy -a truncate-exclave
54

65
kill_signal = "SIGINT"
76
kill_timeout = 5
87
primary_region = "syd"
9-
processes = []
108

119
[build]
12-
dockerfile = "Dockerfile.citadel"
10+
dockerfile = "Dockerfile"
11+
12+
[env]
13+
STATIC_DIR = "/app/web_client"
14+
TR_DEFS_FILE = "/truncate/defs.db"
1315

1416
[[services]]
1517
internal_port = 8080
1618
processes = ["app"]
1719
protocol = "tcp"
20+
1821
[services.concurrency]
22+
type = "connections"
1923
hard_limit = 1000
2024
soft_limit = 800
21-
type = "connections"
2225

2326
[[services.ports]]
2427
force_https = true

0 commit comments

Comments
 (0)