Installation Guide
This guide provides detailed instructions for installing and configuring PuzzleSpring for both development and production environments.
Prerequisites
- Docker Engine (version 20.10.0 or higher)
- Docker Compose (version 2.0.0 or higher)
- Git
Basic Installation
- Clone the repository:
git clone https://github.com/puzzlespring/puzzlespring.git cd puzzlespring
- Copy the sample environment file:
cp sample.env .env
- Configure your environment variables in
.env
. At minimum, you need to set:DJANGO_SECRET_KEY
: A secure random stringDB_PASSWORD
: Password for the PostgreSQL databaseDOMAIN
: Your domain name (uselocalhost
for development)
To generate a secure Django secret key, you can use Python:
python -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'
Copy the output into your
.env
file as theDJANGO_SECRET_KEY
value.
Development Setup
For local development:
- Start the development server:
docker compose up -d
- Run the initial setup command:
docker compose exec app python manage.py initial_setup
-
Follow the interactive prompts to create your superuser account
- Access the application at
http://${DOMAIN}:${HTTP_PORT}
(by defaulthttp://localhost:8000
)
Production Deployment
For production environments:
- Configure your domain:
- Set
DOMAIN
in.env
to your actual domain name (e.g.,puzzles.example.com
) - Remove any port number from the domain to enable automatic SSL
- Set
Ensure you’ve set secure values for
DJANGO_SECRET_KEY
andDB_PASSWORD
, and thatDJANGO_ENABLE_DEBUG=False
- Start the application:
docker compose up -d
- Run the initial setup:
docker compose exec app python manage.py initial_setup
- Access your site at
https://your-domain.com
The Caddy server will automatically obtain and manage SSL certificates for your domain.
Post-Installation
After installation, you should:
-
Log in to the admin interface at
/admin
using your superuser account -
Configure In-App Settings through the admin interface
-
Create your first hunt or import an existing hunt template
Troubleshooting
Common Issues
- SSL Certificate Issues
- Ensure your domain is pointed to your server
- Check that ports 80 and 443 are accessible
- Verify
DOMAIN
doesn’t include a port number
- Static Files Missing
- Run
docker compose exec app python manage.py collectstatic
- Run
Checking Logs
To view logs for any service:
docker compose logs [service_name]
Available services:
app
: Main applicationdb
: Databasecaddy
: Web serverredis
: Cachepushpin
: Real-time updateshuey
: Background tasks
Next Steps
- Review the Configuration Guide for detailed settings
Customizing Static Files
To override or add custom static files:
- Create a
custom/static
directory in your project root - Place your custom static files in this directory
- Restart the containers to apply changes:
docker compose restart app
The custom static directory is mounted as a volume, so changes will be reflected without rebuilding the container.
Customizing Templates
To override or customize templates:
- Create a
custom/templates
directory in your project root - Mirror the template structure you want to override. For example:
custom/templates/ └── puzzlehunt/ └── puzzle_base.html
- Files in this directory will take precedence over the default templates
- Restart the containers to apply changes:
docker compose restart app
The custom templates directory is mounted as a volume, so changes will be reflected without rebuilding the container.
When overriding templates, ensure you maintain the expected blocks and context variables. Refer to the Templates documentation for details.