This guide walks through a self-hosted installation of Cannery, a firearm and ammunition inventory tracker.
For Docker installation, see Docker.
Create a directory for your Cannery installation:
mkdir -p ~/cannery && cd ~/cannery
Create a docker-compose.yml file with the following content:
version: '3.8'
services:
cannery:
image: shibaobun/cannery:latest
restart: unless-stopped
ports:
- "4000:4000"
environment:
- DATABASE_URL=postgresql://cannery:password@cannery-db:5432/cannery
- SECRET_KEY_BASE= # Generate with: docker run -it shibaobun/cannery /app/priv/random.sh
- HOST=http://localhost:4000 # Change to your domain
- PORT=4000
- REGISTRATION=invite_only # Options: public, invite_only, disabled
depends_on:
- cannery-db
cannery-db:
image: postgres:15-alpine
restart: unless-stopped
volumes:
- cannery_postgres_data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=cannery
- POSTGRES_USER=cannery
- POSTGRES_PASSWORD=password
volumes:
cannery_postgres_data:
Generate a secure secret key base for your installation:
docker run -it shibaobun/cannery /app/priv/random.sh
Copy the output and add it to your docker-compose.yml file as the SECRET_KEY_BASE value.
Start the services with Docker Compose:
docker compose up -d
Once started, access Cannery at http://your-server-ip:4000 or through your reverse proxy if configured.
The first user account created will automatically be granted admin privileges.
For production use, it’s recommended to run Cannery behind a reverse proxy like nginx or Traefik.
server {
listen 80;
server_name cannery.yourdomain.com;
location / {
proxy_pass http://127.0.0.1:4000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Update your docker-compose.yml to reflect the correct external URL:
environment:
- HOST=https://cannery.yourdomain.com
Prefer automation? See Cannery Ansible Setup for an example playbook.
Prefer containers? See Cannery Docker Setup.
Any questions?
Feel free to contact us. Find all contact information on our contact page.