A minimal Go application for fly.io Getting Started documentation and tutorials.
To get started:
- clone this repo
flyctl launch
- view the deployed app with flyctl open
- Fork the go-example repository to your GitHub account.
- Clone the new repository to your local machine.
- Run fly launch from within the project source directory to create a new app and a fly.toml configuration file. Type N when fly launch asks if you want to set up databases and N when it asks if you want to deploy.
- Still in the project source directory, get a Fly API deploy token by running fly tokens create deploy -x 999999h. Copy the output.
- Go to your newly-created repository on GitHub and select Settings.
- Under Secrets and variables, select Actions, and then create a new repository secret called FLY_API_TOKEN with the value of the token from step 4.
- Back in your project source directory, create .github/workflows/fly.yml with these contents:
name: Fly Deploy
on:
push:
branches:
- master
jobs:
deploy:
name: Deploy app
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
Note that the go-example’s default branch is currently master. If you’re using a different app, yours might be main. Change the fly.yml file accordingly.
- Commit your changes and push them up to GitHub. You should be pushing two new files: fly.toml, the Fly Launch configuration file, and fly.yml, the GitHub action file.