Production Deployment
This guide covers deploying HiveCache to production. We use Coolify as an example, but the same principles apply to other Docker-based deployment systems.
Deployment Method
This deployment method is Docker-based.
Infrastructure Requirements
Step 1: Database Setup
Deploy PostgreSQL 16 in your infrastructure:
- Use
postgres:16image - Make it accessible in the internal Docker network
- Configure persistent storage for the database
Step 2: Build API Production Image
Build the API production image:
- Define all required environment variables (see
.envfile in the repository for a list) - Build the image:
docker build -t hivecache --target api-build -f infrastructure/docker/services/php/Dockerfile . - Start this image with the required environment variables
Step 3: JWT Key Pair Generation
Generate a JWT key pair for authentication:
- Run the Symfony console command:
bin/console lexik:jwt:generate-keypair - Save the generated files to the server:
/api/config/jwt/public.pem/api/config/jwt/private.pem
Step 4: Expose the API
- If using Coolify: Expose the API on port 80
- If deploying on your own: Expose the
api:80port to the internet via a reverse proxy/router (e.g., Nginx, Traefik, or Cloudflare)
Environment Variables
Ensure all required environment variables are set. Key variables include:
- Database connection settings
- JWT configuration
- Application environment (prod)
- ActivityPub instance URL
- File storage configuration
- And others as defined in the
.envfile
Additional Considerations
- SSL/TLS: Set up HTTPS using a reverse proxy or load balancer
- File Storage: Configure persistent storage for uploaded files and archives
- Backups: Set up regular database backups
- Monitoring: Consider adding monitoring and logging solutions
- Scaling: The current implementation is designed for up to 1000 users per instance to encourage decentralization
Note
The system is designed for max 1000 users per instance to encourage decentralization.