This document outlines what the two shell installers (one for Ubuntu, one for Rocky Linux) must do to bootstrap the BosBase single-node stack with Docker Compose and Caddy. The goal is to make the scripts idempotent, transparent, and safe to run on freshly provisioned hosts.
Both installers should perform the same high-level tasks:
- Collect configuration – accept domain name, email for ACME,
OPENAI_API_KEY,OPENAI_BASE_URL(optional), and a generatedBS_ENCRYPTION_KEY. The scripts can read values from environment variables or prompt interactively. - Ensure prerequisites – install Docker Engine, Docker Compose plugin, and Caddy. Validate that
systemctlis available and the user has sudo rights. - Lay down BosBase assets – place
docker-compose.yml,.env, data directories, andCaddyfileinto/opt/bosbase(or another configurable root). - Create system users and permissions – add the invoking user to the
dockergroup and set directory ownership to keepdocker composeusable without repeated sudo. - Start and enable services – launch the Docker Compose stack and Caddy, configure systemd units so they survive reboots, and report service status.
- Perform health checks – curl
http://localhost:8090/api/healthandhttp://localhost:4001/statusonce containers are up, surfacing failures early.
/opt/bosbase/
├── docker-compose.yml # From README.md (single-node stack)
├── .env # Contains OPENAI / encryption values
├── Caddyfile # Reverse-proxy definition
├── bosbase-data/ # Persistent PocketBase data
└── bosbasedb-node1-data/ # Persistent BosBaseDB data
Use install -d -m 755 to create the directory tree and tee/cat <<'EOF' to write files atomically.
docker-compose@bosbase.servicethat runsdocker compose --project-name bosbase up -din/opt/bosbase.- Native
caddy.servicefrom each distribution’s package manager; only the config file path needs to match.
sudo apt update
sudo apt install -y ca-certificates curl gnupg lsb-release
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] \
https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" |
sudo tee /etc/apt/sources.list.d/docker.list >/dev/null
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo groupadd -f docker
sudo usermod -aG docker "$SUDO_USER"
sudo systemctl enable --now dockerInstall Caddy via the official repository:
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https
curl -fsSL https://dl.cloudsmith.io/public/caddy/stable/gpg.key | sudo gpg --dearmor -o /usr/share/keyrings/caddy.gpg
echo "deb [signed-by=/usr/share/keyrings/caddy.gpg] https://dl.cloudsmith.io/public/caddy/stable/deb/ubuntu any-version main" |
sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install -y caddy- Parse flags/env vars (
--domain,--email,--openai-key,--encryption-key,--install-dir). - Run the package installation block above, but guard it with detection logic to skip re-installing Docker/Caddy if already present.
- Create
/opt/bosbase(or provided directory) and drop the Docker Compose file from the README verbatim. The script cancat <<'EOF' > docker-compose.ymlto embed the YAML. - Write
.env:cat > .env <<EOF OPENAI_API_KEY=${OPENAI_API_KEY} OPENAI_BASE_URL=${OPENAI_BASE_URL} BS_ENCRYPTION_KEY=${BS_ENCRYPTION_KEY} EOF
- Copy the repository
Caddyfile, but template theexample.comhost with the provided domain and point the upstream tohttp://localhost:8090. - Reload Caddy (
sudo systemctl reload caddy) after writing the config. - Start the stack:
sudo docker compose --project-name bosbase up -d. - Optionally create
/etc/systemd/system/docker-compose@bosbase.service:Enable via[Unit] Description=BosBase Docker Compose stack Requires=docker.service After=docker.service [Service] WorkingDirectory=/opt/bosbase ExecStart=/usr/bin/docker compose --project-name bosbase up -d ExecStop=/usr/bin/docker compose --project-name bosbase down RemainAfterExit=yes TimeoutStartSec=0 [Install] WantedBy=multi-user.target
sudo systemctl enable --now docker-compose@bosbase.
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf -y install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
sudo systemctl enable --now docker
sudo usermod -aG docker "$SUDO_USER"Install Caddy from the official COPR:
sudo dnf -y install 'dnf-command(copr)'
sudo dnf -y copr enable @caddy/caddy
sudo dnf -y install caddy
sudo systemctl enable --now caddy- Detect Rocky Linux via
/etc/os-releaseto avoid running on unsupported platforms. - Execute the package installation blocks above only when the respective binaries are missing.
- Configure SELinux and the firewall if needed:
sudo setsebool -P httpd_can_network_connect 1 sudo firewall-cmd --permanent --add-service=http sudo firewall-cmd --permanent --add-service=https sudo firewall-cmd --reload
- Create
/opt/bosbaseand populate the same files as in the Ubuntu script. - For
.envanddocker-compose.yml, reuse the exact content; only the package-management logic differs. - Ensure
ExecStart=/usr/bin/docker compose ...in the systemd unit (binary paths are identical on Rocky). - Reload systemd, enable the compose unit, and run health checks.
Use the repository Caddyfile as the base template:
{domain} {
encode gzip zstd
reverse_proxy 127.0.0.1:8090
}- Replace
{domain}with the provided hostname. - If Let’s Encrypt email is supplied, add
email you@example.comto the global options block. - To force HTTPS, Caddy’s defaults are enough; no extra flags needed.
After writing the file:
sudo caddy validate --config /opt/bosbase/Caddyfile
sudo caddy reload --config /opt/bosbase/Caddyfile- Run each script on a fresh VM snapshot (Ubuntu 22.04, Rocky Linux 9) to avoid cross-contamination.
- Verify
docker compose psshowsbosbasedb-nodeandbosbase-nodehealthy. - Confirm
systemctl status caddyis active and certificates were issued (check/var/lib/caddy/.local/share/caddy/acme). - Hit
https://your-domain/_/to confirm the admin UI loads via Caddy.
Following the instructions above ensures both shell installers provide a consistent end-to-end setup while honoring distribution-specific packaging differences.