flying-jekyll
A skeleton for setting up a Jekyll blog that automatically builds and deploys on fly.io via GitHub Actions
Usage
Set up Fly
- Sign up for a Fly account at https://fly.io/app/sign-up
- Install the
flyctl
tool: https://fly.io/docs/hands-on/install-flyctl/
- Log into your new account by running
flyctl auth login
Setup Your App
- Run
flyctl launch
to set up your app, answer as follows:
- Answer
y
to copy the existing configuration to your new app
- Choose an app name. This name is only used for Fly on your dashboard and your automatic dev url (example: https://flying-jekyll.fly.dev) and will not be visible to anyone else if using a custom domain name, so choose something memorable for yourself.
- Choose a region. Select whichever region is probably closest to you or whoever you think will visit your site. You can always update this later if needed: https://fly.io/docs/reference/regions/
- Note the "Admin URL" and "Hostname" given
- Answer
N
(or press enter) to creating a Postgresql database
- Answer
N
(or press enter) to creating a Redis database
- Answer
y
to deploy now
- Once it's completed successfully (see the message "--> v0 deployed successfully"), visit the hostname from step 4 to see the site up live. Unless you've changed anything, you should see the basic "Welcome to Fying Jekyll" page, identical to https://flying-jekyll.fly.dev.
Setup Your Domain (Optional)
- Run
flyctl ips list
to get your app's public IP
- In your domain provider's DNS settings, add an A record pointing to your v4 IP and an AAAA record pointing to your v6 IP. This will depend on your particular domain provider, but likely the "Host" will be
@
and the "Value" will be the IP address for each record. Be sure to delete any other A records or CNAMEs from other configurations or parking pages.
- Run
flyctl certs create example.com
replacing example.com
with your actual domain.
- Run
flyctl certs show example.com
to check the status. This typically only takes a few minutes. You may be asked for an additional ownership verification: if the Status is "Ready" and there is a "DNS Validation Instructions" field listed, you will need to complete as directed. This is typically adding a CNAME in your domain's DNS from the given hostname (something like _acme-challenge.example.com
) to the target value (something like example.com.5xzw.flydns.net
). Once completed, check again with flyctl certs show example.com
to see the status; this should also only take a few minutes. When finished you will see a message like "The certificate for example.com has been issued."
- Verify that visiting your domain brings you to your "Welcome to Flying Jekyll" page.
Setup GitHub Actions
- Run
flyctl auth token
to get an API token for your app
- In your GitHub repository, click the Settings tab, and select Secrets and Variables > Actions from the left menu
- Click the "New repository secret" button and fill in the Name
FLY_API_TOKEN
and the Secret with the API token from step 1, then click Add secret
- Make some change to your site (like changing the text in
index.markdown
), and commit/push to your repository
- You can see the build Action status in the Actions tab on your repository's page. If it fails you will receive an email with error details.
- Once completed successfully, verify that you can see your changes on your site (either fly.io dev hostname or your custom domain)
Enjoy all the indescribable pleasures of owning a website