This is a starting point for a Kotlin http4k player of the Extreme Startup game devised by Robert Chatley.
“teams can compete to build a software product that satisfies market demand.” (Rob Chatley)
- Login to https://github.com/
- Fork this repo
- Clone your fork on your machine:
git clone git@github.com:<your-username>/ExtremeStartupHttp4kServer.git
- Make sure you can build the service on your machine:
./gradlew build
- Optionally, you can run the service on your machine:
./gradlew run- open http://127.0.0.1:8124/
- You should see:
Stop the server
For this lab we will use https://fly.io/
This is a commercial product - I have no affiliation with it, it’s just useful for the lab.
First, check to see whether you have the "fly" CLI already installed.
If executing this:
flyctlprints something like this (truncated here):
This is flyctl, the Fly.io command line interface.
Usage:
flyctl [flags]
flyctl [command]
...
then the "fly" CLI is already installed.
Otherwise:
brew install flyctlFor this you will need a username and password which I will give you.
- Login to fly
fly auth login- Edit fly.toml so your service gets a unique URL (for example):
sed -i .back "s/extreme-startup-player/extreme-startup-player-$USER/g" fly.toml- commit and push this change
- "Launch" the app to deploy it for the first time to Fly.io - you only have to do this once
fly launchAnswer the questions as below:
Would you like to copy its configuration to the new app? (y/N)
y
Do you want to tweak these settings before proceeding? (y/N)
n
If this has worked, you should see a message like:
Visit your newly deployed app at https://extreme-startup-player-ivan.fly.dev/
- deploy to fly with "deploy" instead of "launch"
fly deploy- Open a browser on the URL of the deployed service
open "https://extreme-startup-player-$USER.fly.dev/"- Set up GitHub Actions CD pipeline:
- Generate a token for Fly.io
fly tokens create deploy -x 999999h- Go to the GitHub “Settings” for your repository where you’ll find “Secrets and variables” and click on “Actions”
- In the “Repository Secrets” section, add “New repository secret” with name FLY_API_TOKEN and the value as just generated.
- Make sure your pipeline setup is working by making a change to the HTML in the class HomePage and seeing that it changes in the deployed service.
- Join the game, see: https://extreme-startup.fly.dev/ (you will be given the
game idin the lab)
fly logsFly.io builds and runs your service as a Docker container. You can replicate what it is doing on your machine if you have Docker installed.
- build docker image
docker build -t extreme_startup_player .- run docker container based on that image
docker run -p 8124:8124 --name extreme_startup_player extreme_startup_player- See it running: http://localhost:8124/
- run docker container based on that image
docker rm -f extreme_startup_player- cleanup
docker container prune -f