bldg14 / eventual

A simple event calendar
https://eventual-client.fly.dev
MIT License
0 stars 0 forks source link

enable auto deploy to fly.io of server #36

Closed kevinfalting closed 12 months ago

kevinfalting commented 1 year ago

Overview

This adds a Dockerfile for the server and a fly configuration file so that the fly GitHub action can auto deploy the server on merges to main.

Related Issues / PRs

Resolves: #32

Thought Process

I was going to initially just let the fly cli generate the toml, but it was struggling to detect the Go application. I noticed that it can just be pointed at a Dockerfile, which is what it wanted to generate anyway, so I wrote a one to have only the necessities in the resulting image.

I followed the fly.io docs to add a GitHub action and here we are!

This should auto-deploy on every merge to main. I'm not concerned about merges that don't contain any changes to the server.

Testing Steps

You can build and run this image locally with Docker installed and running.

docker build -t eventual -f Dockerfile.server .

Then run it:

docker run --rm -it -p 8080:8080 eventual

and you can make an http request against it:

curl localhost:8080/api/v1/events

If you have the fly cli installed, you can just run:

fly deploy

The current url for what I've manually deployed, and I expect this GitHub action to overwrite: https://eventual.fly.dev/api/v1/events

Risks

Low risk, if it doesn't work, we'll dig into why and make the necessary changes.