Skip to content

Free hosting via fly.io

a-sync edited this page Jul 21, 2024 · 6 revisions

After you've set up your free accounts on both GitHub and Fly.io, launching this app becomes straightforward. You just create your personal copy (fork) of the app on GitHub, and then use GitHub Actions to handle the initial setup and deployment of your app right from GitHub. From then on, all your future updates or adjustments will be deployed automatically.

Create accounts

Create GitHub repo

  1. click the fork button to create your own copy of game-server-watcher
    fork button
  2. go to the repo Settings > Actions > General: allow all actions (if no confirmation comes up, disable then re-enable all actions)
    allow actions

Create your free Fly.io account

  1. register an account at https://fly.io/app/sign-up
    fly sign up
  2. add a payment method to your personal organization to enable app deployments
  3. go to Accounts > Access Tokens and create a new fly API token
    create token

Setup service

Create required secrets on GitHub

  1. go to the forked repo on GitHub: Settings > Secrets > Actions
  2. create a new secret named FLY_API_TOKEN, with the value of the fly API token previously generated
    token secret
  3. create a new secret named FLY_REGION, with the value of a fly region ID
    region secret

Create fly app from GitHub actions

  1. go to the forked repo on GitHub: Actions > Workflows and select 🏗 Create cloud app
  2. use the Run workflow panel on the right and the Run workflow button to create a new fly app and a 1gb volume for it
    create app

Configure fly app secrets from GitHub actions

  1. go to the forked repo on GitHub: Actions > Workflows and select ⚙ Configure cloud app
  2. use the Run workflow panel on the right and the Run workflow button to update the available settings
    configure app
  3. rules for the input fields:
    • empty fields are skipped (no action)
    • fields with the value - (minus, dash) delete the secret
    • fields with non empty or - value create/update the secret

Refer to the wiki on how to get tokens for:

Deploying the service

Manually

  1. go to the forked repo on GitHub: Actions > Workflows and select ☁️ Deploy to the cloud
  2. use the Run workflow panel on the right and the Run workflow button to deploy the selected branch on demand run workflow

Continuous deployment

Pushing commits to GitHub on the master branch will trigger GitHub actions to push your files to Fly.io and restart the service.
GitHub action pending

Protip: Use the dot (.) key to open your code in github.dev web-based editor when browsing GitHub!