mirror of
https://github.com/taogaetz/chefbible.git
synced 2025-12-06 11:47:24 -05:00
81 lines
1.8 KiB
Markdown
81 lines
1.8 KiB
Markdown
# Chef Bible - Docker Deployment
|
|
|
|
## Portainer Deployment
|
|
|
|
This application is designed to be deployed on Portainer with SQLite database persistence.
|
|
|
|
### Environment Variables
|
|
|
|
Set these environment variables in Portainer:
|
|
|
|
**Required:**
|
|
```
|
|
NODE_ENV=production
|
|
DATABASE_URL=file:/app/data/database.db
|
|
ORIGIN=https://birba.redbackpack.ca
|
|
```
|
|
|
|
**Optional (for photo uploads):**
|
|
```
|
|
CLOUDINARY_URL=cloudinary://api_key:api_secret@cloud_name
|
|
```
|
|
|
|
*Note: If CLOUDINARY_URL is not provided, photo uploads will be disabled but the application will still function normally.*
|
|
|
|
### Volume Mounts
|
|
|
|
Create a volume mount for database persistence:
|
|
|
|
- **Host Path**: `/var/lib/docker/volumes/chef-bible-data/_data`
|
|
- **Container Path**: `/app/data`
|
|
- **Type**: Bind Mount or Named Volume
|
|
|
|
### Port Configuration
|
|
|
|
- **Container Port**: 3000
|
|
- **Host Port**: 80 (or your preferred port)
|
|
- **Protocol**: HTTP
|
|
|
|
### Docker Build
|
|
|
|
To build the image locally:
|
|
|
|
```bash
|
|
docker build -t chef-bible .
|
|
```
|
|
|
|
### Database Initialization
|
|
|
|
The application will automatically:
|
|
1. Create the SQLite database on first run
|
|
2. Run Prisma migrations
|
|
3. Seed the database with initial recipes
|
|
|
|
### Health Check
|
|
|
|
The container includes a health check endpoint at `/health` that Portainer can use to monitor the application status.
|
|
|
|
### Security Notes
|
|
|
|
- The application runs as a non-root user (`sveltekit`)
|
|
- Database files are stored in a persistent volume
|
|
- Environment variables are used for configuration
|
|
- No sensitive data is hardcoded
|
|
|
|
### Backup
|
|
|
|
To backup the database:
|
|
|
|
```bash
|
|
# Copy the database file from the volume
|
|
docker cp <container_id>:/app/data/database.db ./backup-$(date +%Y%m%d).db
|
|
```
|
|
|
|
### Updates
|
|
|
|
To update the application:
|
|
1. Build new image with updated code
|
|
2. Deploy new container in Portainer
|
|
3. Database will persist through updates via volume mount
|
|
|