Skip to content

Commit

Permalink
Migrate to fly.io
Browse files Browse the repository at this point in the history
  • Loading branch information
dima74 committed Mar 26, 2024
1 parent e4991d4 commit 9fb1b02
Show file tree
Hide file tree
Showing 6 changed files with 78 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.git/
target/
temp/
.env
19 changes: 19 additions & 0 deletions .github/workflows/fly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/
name: Fly Deploy

on:
push:
branches:
- master

jobs:
deploy:
name: Deploy app
runs-on: ubuntu-latest
concurrency: deploy-group # ensure only one action runs at a time
steps:
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only --image-label $(git rev-parse HEAD)
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
24 changes: 24 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,30 @@ git push heroku
```


## fly.io configuration
* First time
```sh
yay -S flyctl-bin
fly secrets set KEY=VALUE
fly launch
```

* Deploy from local
```sh
fly deploy --image-label $(git rev-parse HEAD)
```

* Deploy from github
https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/
See .github/workflows/fly.yml
`FLY_API_TOKEN` - get using `fly tokens create deploy -x 999999h`

* Get git commit hash for current release
```sh
fly image show # column TAG
```


## Needed environment variables
From https://github.com/settings/apps/factorio-mods-localization-helper:
* `GITHUB_APP_ID` - App ID
Expand Down
9 changes: 9 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
FROM rust AS builder
COPY . .
RUN cargo build --release

FROM archlinux
COPY --from=builder ./target/release/fml ./target/release/fml
COPY --from=builder Rocket.toml Rocket.toml
ENV RUST_BACKTRACE 1
CMD ["/target/release/fml"]
1 change: 1 addition & 0 deletions Rocket.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[release]
address = "0.0.0.0"
cli_colors = false
port = 8080
21 changes: 21 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# fly.toml app configuration file generated for factorio-mods-localization on 2024-03-25T23:19:01+03:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = "factorio-mods-localization"
primary_region = "waw"

[http_service]
internal_port = 8080
force_https = true
auto_stop_machines = false
auto_start_machines = true
min_machines_running = 1
processes = ["app"]

[[vm]]
cpu_kind = "shared"
cpus = 1
memory_mb = 512
swap_size_mb = 512

0 comments on commit 9fb1b02

Please sign in to comment.