Skip to content

Commit d40fea2

Browse files
committed
Migrate to fly.io
1 parent e4991d4 commit d40fea2

File tree

6 files changed

+79
-0
lines changed

6 files changed

+79
-0
lines changed

.dockerignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.git/
2+
target/
3+
temp/
4+
.env

.github/workflows/fly.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/
2+
name: Fly Deploy
3+
4+
on:
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
deploy:
11+
name: Deploy app
12+
runs-on: ubuntu-latest
13+
concurrency: deploy-group # ensure only one action runs at a time
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: superfly/flyctl-actions/setup-flyctl@master
17+
- run: flyctl deploy --remote-only --image-label $(git rev-parse HEAD)
18+
env:
19+
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

DEVELOPMENT.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,30 @@ git push heroku
1818
```
1919

2020

21+
## fly.io configuration
22+
* First time
23+
```sh
24+
yay -S flyctl-bin
25+
fly secrets set KEY=VALUE
26+
fly launch
27+
```
28+
29+
* Deploy from local
30+
```sh
31+
fly deploy --image-label $(git rev-parse HEAD)
32+
```
33+
34+
* Deploy from github
35+
https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/
36+
See .github/workflows/fly.yml
37+
`FLY_API_TOKEN` - get using `fly tokens create deploy -x 999999h`
38+
39+
* Get git commit hash for current release
40+
```sh
41+
fly image show # column TAG
42+
```
43+
44+
2145
## Needed environment variables
2246
From https://github.com/settings/apps/factorio-mods-localization-helper:
2347
* `GITHUB_APP_ID` - App ID

Dockerfile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
FROM rust AS builder
2+
COPY . .
3+
RUN cargo build --release
4+
5+
FROM archlinux
6+
RUN pacman -Sy --noconfirm git && rm -rf /var/cache/pacman/pkg/*
7+
COPY --from=builder ./target/release/fml ./target/release/fml
8+
COPY --from=builder Rocket.toml Rocket.toml
9+
ENV RUST_BACKTRACE 1
10+
CMD ["/target/release/fml"]

Rocket.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[release]
22
address = "0.0.0.0"
33
cli_colors = false
4+
port = 8080

fly.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# fly.toml app configuration file generated for factorio-mods-localization on 2024-03-25T23:19:01+03:00
2+
#
3+
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
4+
#
5+
6+
app = "factorio-mods-localization"
7+
primary_region = "waw"
8+
9+
[http_service]
10+
internal_port = 8080
11+
force_https = true
12+
auto_stop_machines = false
13+
auto_start_machines = true
14+
min_machines_running = 1
15+
processes = ["app"]
16+
17+
[[vm]]
18+
cpu_kind = "shared"
19+
cpus = 1
20+
memory_mb = 512
21+
swap_size_mb = 512

0 commit comments

Comments
 (0)