Deploy Server
Tech stack
- Digital Ocean Droplet
- Ubuntu
- Caddy
- rsync
Setting up a Python project on an Ubuntu Digital Ocean Droplet using pipenv
- Create Droplet with ssh key authentication
- Save ssh key to 1password
- Update your ssh config file
- Download the package index from repositories in
/etc/apt/sources.listand/etc/apt/sources.list.dsudo apt update
- Install Packages from APT
sudo apt install -y python3-pip pipenv git debian-keyring debian-archive-keyring apt-transport-https
- Downloads the GPG key from Cloudsmith’s Caddy repository and adds it to your system’s trusted keyring
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo tee /usr/share/keyrings/caddy-stable-archive-keyring.gpg > /dev/null
- Add the Caddy repository to your system’s list of package source
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
- Install Caddy
sudo apt install caddy
- Install pipenv
pip3 install pipenv
- Setup Caddyfile at
/etc/caddy/Caddyfile- Example:
lobbyingintoronto.com { reverse_proxy 127.0.0.1:5000 encode zstd gzip tls { protocols http/1.1 http/2 http/3 } }
- Example:
- Create a systemd service file
- sudo systemctl daemon-reload
- sudo systemctl restart your.service
- systemctl status your.service
caddy validate –config /etc/caddy/Caddyfile caddy fmt –overwrite /etc/caddy/Caddyfile
If you want to enable the service to start automatically at boot, run: sudo systemctl enable TorontoLobbyistRegistry
Remeber to Enable Monitoring with creating the droplet