Skip to content
Start free

Docker Compose

Open in ClaudeOpen in ChatGPT

Our Docker Compose setup runs DocSpring Enterprise on one Linux server: the web server and workers, PostgreSQL, Valkey (an open source fork of Redis) and Caddy, which gets a free HTTPS certificate from Let’s Encrypt. It’s the quickest way to try DocSpring, and suits a production install that one server can handle. For high availability across several servers, use Kubernetes or AWS ECS.

The files are in the docker-compose folder of DocSpring/docspring-enterprise.

  • A Linux server, amd64 or arm64, with at least 4 CPUs, 8 GB of memory and 50 GB of disk, and Docker Engine 24 or later with the Compose plugin. Docker Desktop on a Mac or Windows works for a trial.
  • A DNS name for DocSpring that points at the server, with ports 80 and 443 open to the internet (for Let’s Encrypt), unless your own proxy or load balancer handles HTTPS.
  • Your license key and Docker Hub credentials, which we email you.
  • Outbound HTTPS to api.docspring.com for the license check.
git clone https://github.com/DocSpring/docspring-enterprise.git
cd docspring-enterprise/docker-compose
./setup.sh

setup.sh writes a .env file with new secrets: the database password, SECRET_KEY_BASE, the encryption key and the first admin’s password. Open .env and set:

  • DOCSPRING_LICENSE: your license key.
  • DOCSPRING_DOMAIN_NAME: the DNS name, such as docspring.example.com.
  • DOCSPRING_ADMIN_EMAIL: your email address, for the first admin user.
  • Your email settings, then remove DOCSPRING_DISABLE_EMAILS.
  • An S3 bucket, if you’ll use one (File storage).

Keep a copy of .env somewhere safe: without its DOCSPRING_SUBMISSION_DATA_ENCRYPTION_KEY, the data in your database can’t be read.

Sign in to Docker Hub, start DocSpring and add the scheduled tasks to the server’s cron:

docker login --username <username from DocSpring>
docker compose up -d --wait
sudo ./install-schedule.sh

The first docker compose up creates the database and the admin user, then starts everything, which takes a minute or two. Go to https://<your domain>, sign in with DOCSPRING_ADMIN_EMAIL and the DOCSPRING_ADMIN_PASSWORD from .env, and change the password.

To check that the database, Redis, file storage and background jobs work, then generate a test PDF:

docker compose run --rm tasks run_as_deploy rake checks:health_check checks:generate_test_submission
ServiceWhat it does
releaseRuns first on each docker compose up: creates or migrates the database, then exits.
webThe app, the API and the admin dashboard, on port 4001.
workerGenerates documents, and sends email and webhooks.
worker_gjAccount exports and imports.
postgresPostgreSQL 17, with its data in the postgres volume.
redisValkey 8, with its data in the redis volume.
caddyHTTPS for DOCSPRING_DOMAIN_NAME.
tasksNot a running service: it runs one-off commands and the scheduled tasks.

install-schedule.sh writes /etc/cron.d/docspring, which runs the scheduled tasks with docker compose run --rm tasks run_as_deploy rake timers:hourly (and daily and weekly).

To use your own reverse proxy or load balancer instead of Caddy, set COMPOSE_PROFILES= (empty) in .env, and publish web’s port in a compose.override.yaml next to compose.yaml:

services:
web:
ports: ["127.0.0.1:4001:4001"]

Your proxy must set X-Forwarded-Proto: https, allow request bodies up to 110 MB, and wait at least 240 seconds for a response.

Without a bucket, DocSpring keeps template files and generated PDFs in the uploads volume, and backup.sh backs it up. For production we recommend an S3 bucket, which keeps the files off the server. Create it as the Requirements page describes, with its CORS rule, then set DOCSPRING_AWS_UPLOADS_S3_BUCKET, DOCSPRING_AWS_UPLOADS_S3_REGION, DOCSPRING_AWS_ACCESS_KEY_ID and DOCSPRING_AWS_ACCESS_KEY_SECRET in .env, and run docker compose up -d --wait.

Set the bucket up before people start using DocSpring: files already in the volume stay there.

Read the release notes, then run:

./update.sh <version>

It pulls the new image, backs up the database, migrates it and restarts the services on the new version. The site is down for the minute or so the restart takes. To go back, run ./update.sh with the version you had before.

./backup.sh writes a database dump, a copy of Redis (the job queues) and, when you don’t use a bucket, the uploads volume to ./backups, and keeps the last 14 of each. It stops the worker service while it copies them, so the copies match, and starts it again after; the site stays up. Run it from cron, and copy ./backups to another machine or a bucket:

/etc/cron.d/docspring-backup
30 2 * * * root cd /path/to/docspring-enterprise/docker-compose && ./backup.sh
docker compose ps # what's running
docker compose logs -f web worker # the logs
docker compose run --rm tasks run_as_deploy rails console # a Rails console
docker compose run --rm tasks run_as_deploy rake timers:daily # run the daily tasks now