Minimal project to deploy a FastHtml application on a VPS using a docker image and Kamal deploy.
This project uses Python, FastHTML, Docker desktop, Github container registry, Ruby and Kamal.
gem install kamal
python -m venv ./.venv
source ./.venv/Scripts/activate
pip install -r requirements.txt
Create a .env
file with your secrets:
GHCR_TOKEN=<your github container registry access token>
GHCR_REGISTRY_USER=<your github user name>
SERVER_IPS=<your VPS IP>
source .env
docker build -t fasthtml-demo .
echo $GHCR_TOKEN | docker login ghcr.io -u $GHCR_REGISTRY_USER --password-stdin
docker tag fasthtml-demo ghcr.io/$GHCR_REGISTRY_USER/fasthtml-demo
docker push ghcr.io/$GHCR_REGISTRY_USER/fasthtml-demo:latest
docker run -p 8000:8000 fasthtml-demo
Open http://localhost:8000 in your browser.
ssh ubuntu@vps-ip
copy or create a ssh key
sudo apt update && apt upgrade -y
sudo apt install -y docker.io curl git
sudo usermod -a -G docker ubuntu
sudo mkdir -p /letsencrypt && sudo touch /letsencrypt/acme.json && sudo chmod 600 /letsencrypt/acme.json
kamal setup
Deploy latest release
kamal deploy