Mealie is an open-source, self-hosted recipe manager and meal-planning app that allows you to organize your recipes, create shopping lists, and schedule mealsβall while keeping full control of your data. Its intuitive interface, API support, and advanced customization options make it an excellent choice for tech-savvy users who value privacy and flexibility. In this guide, we'll cover everything from installing Mealie to configuring it for production use, managing backups, and leveraging its unique features.
Installing Mealie
π¦ Docker/Docker Compose Setup
Docker is the recommended way to deploy Mealie due to its simplicity and portability. Below is an example docker-compose.yml
file for Mealie:
version: '3.8'
services:
mealie:
image: hkotel/mealie:latest
container_name: mealie
ports:
- "9925:80" # Map port 80 from the container to port 9925 on the host
volumes:
- ./data:/app/data # Persist data to the host machine
environment:
- TZ=America/New_York # Set your timezone
- BASE_URL=http://your-domain.com # Replace with your domain or IP
restart: unless-stopped
Run the following commands to deploy Mealie with Docker:
mkdir mealie && cd mealie
curl -o docker-compose.yml https://path-to-your-configuration/docker-compose.yml
docker-compose up -d
This will download the Mealie image, create a container, and start the service.
π Manual Installation
For those who prefer not to use Docker, you can manually install Mealie on a Linux server. Here's how to do it:
- Install Python and pip (ensure Python 3.10+ is installed):
sudo apt update
sudo apt install python3 python3-pip -y
- Clone the Mealie repository and install dependencies:
git clone https://github.com/hay-kot/mealie.git
cd mealie
pip install -r requirements.txt
- Run the application:
python3 -m uvicorn mealie.app:app --host 0.0.0.0 --port 80
This method is ideal for testing or development but may require additional steps for production use.
Configuring Nginx as a Reverse Proxy
π Nginx Configuration
Use Nginx as a reverse proxy to route traffic to Mealie. Create a new Nginx configuration file for your domain:
server {
listen 80;
server_name your-domain.com;
location / {
proxy_pass http://127.0.0.1:9925; # Forward traffic to Mealie
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Save this file as /etc/nginx/sites-available/mealie
and enable it:
sudo ln -s /etc/nginx/sites-available/mealie /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginx
π SSL/TLS Setup
Secure your site with Let's Encrypt:
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d your-domain.com
This will automatically configure SSL/TLS and renew certificates as needed.
π οΈ Testing and Reloading Nginx
After making changes, always test and reload your configuration:
sudo nginx -t
sudo systemctl reload nginx
Logging and Debugging Mealie
ποΈ Enabling Debug Logs
Enable debug-level logging in the data/config.yaml
file:
logging:
level: DEBUG
Restart Mealie to apply the changes:
docker-compose restart mealie
π Viewing Logs
Access logs using Docker:
docker logs -f mealie
If running manually, check the logs directory:
tail -f /var/log/mealie.log
π οΈ Troubleshooting Common Issues
Check for common issues such as incorrect file permissions or port conflicts. For example:
sudo chown -R $USER:$USER /path/to/mealie/data
π€ Exporting Logs
Forward logs to an external log management system by setting up a Syslog or using a tool like the ELK Stack.
Backup and Restore
ποΈ File-Based Backups
Archive your Mealie data directory:
tar -czvf mealie-backup.tar.gz /path/to/mealie/data
To restore:
tar -xzvf mealie-backup.tar.gz -C /path/to/mealie/data
π Database Backups
If you're using an external database, back it up using pg_dump
(PostgreSQL example):
pg_dump -U mealie_user mealie_db > mealie_db_backup.sql
Restore the database:
psql -U mealie_user mealie_db < mealie_db_backup.sql
π Automated Backup Scripts
Set up a cron job for periodic backups:
echo "0 2 * * * tar -czvf /backups/mealie-$(date +\%F).tar.gz /path/to/mealie/data" | crontab -
Updating and Upgrading Mealie
β¬οΈ Updating Docker Images
Pull the latest Mealie image and redeploy:
docker-compose pull
docker-compose up -d
π οΈ Manual Updates
For manual installations, pull the latest code and update dependencies:
cd mealie
git pull origin main
pip install -r requirements.txt
π Checking for Updates
Check for updates by visiting the Mealie GitHub repository or using the CLI:
docker-compose exec mealie python3 -m mealie --version
Leveraging Mealieβs Unique Features
π§ Enabling APIs
Activate the API in the configuration file:
api:
enabled: true
key: YOUR_API_KEY
Use the API for integration, e.g., fetching a recipe with curl
:
curl -H "Authorization: Bearer YOUR_API_KEY" http://your-domain.com/api/recipes
π Advanced Configurations
Enable advanced features such as custom themes by editing config.yaml
:
theme:
primary_color: "#3498db"
secondary_color: "#2ecc71"
Restart Mealie to apply the changes.
Wrapping Up
This guide has covered everything you need to deploy, configure, and manage Mealie, from installation to backups and leveraging its unique features. By following the steps outlined above, you can enjoy a fully self-hosted recipe management platform tailored to your specific needs. Dive in, customize your setup, and enjoy the flexibility that only self-hosting can provide!