Open StevenMaude opened 2 months ago
I do have some notes on Dokku already that I can check and edit, and then add here.
This is roughly how I configured Dokku in a dev container in Codespaces. It may not bear much resemblance to our real setup (for example, PostgreSQL is installed via a Dokku plugin here, for convenience when I was trying to get things working as quickly as possible).
Not everything here is a perfect guide, and not everything may be absolutely correct. There should be enough for someone following these instructions to get close to a working setup.
.devcontainer/devcontainer.json
{
"name": "job-server",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
}
}
Set up Dokku with docker-compose.yml based on the Dokku documentation. Note that not all the configured ports may be necessary here (possibly just 8199:8000
, but it's the configuration that I had working):
version: "3.8"
services:
dokku:
image: dokku/dokku:0.32.4
container_name: dokku
network_mode: bridge
ports:
- "3022:22"
- "8080:80"
- "8443:443"
- "8000:999"
- "8199:8000"
volumes:
- "/var/lib/dokku:/mnt/dokku"
- "/var/run/docker.sock:/var/run/docker.sock"
environment:
DOKKU_HOSTNAME: dokku.me
DOKKU_HOST_ROOT: /var/lib/dokku/home/dokku
DOKKU_LIB_HOST_ROOT: /var/lib/dokku/var/lib/dokku
restart: unless-stopped
docker-compose up
docker exec -it dokku
dokku apps:create job-server
sudo dokku plugin:install https://github.com/dokku/dokku-postgres.git
dokku postgres:create jobserver --image-version "13"
dokku postgres:link jobserver job-server
(got an error because the Docker image doesn't exist yet)~/.ssh/config
in host:
Host dokku.me
HostName 127.0.0.1
Port 3022
ssh dokku@dokku.me
then worksssh-keygen -t ed25519 -C "jobserver@codespaces"
.pub
public key to /var/lib/dokku
dokku ssh-keys:add MYKEY /var/lib/dokku/<publickey.pub>
/var/lib/dokku
:warning: Not probably necessary as I was actually testing with a built Docker image; see below.
dokku git:set job-server deploy-branch main
:warning: Not probably necessary as I was actually testing with a built Docker image; see below.
git remote add dokku dokku@dokku.me:job-server
git push dokku <yourbranch>:main
job-server
repository to /var/lib/dokku/job-server
.dotenv-sample
in job-server directory to .env
/var/lib/dokku/job-server/docker
justfile
; the export
commands and the docker compose build
. You want to build the prod
image.docker image ls
should show a job-server image.dokku git:from-image job-server job-server:latest
In #4499, to test a Dokku configuration change, I went through the process of running job-server with Dokku in Codespaces. It took me a little while to get that working, but it does work.
To have more confidence in such changes in future, it would be useful to do one or more of the following: