Learn how to self-host Mealie, a modern recipe manager, on an AlmaLinux 10 server. This comprehensive guide covers deployment with Docker, Nginx, and SSL.
What is Mealie?
Mealie stands out as a modern, feature-rich recipe manager with a beautiful user interface. Mealie offers a delightful way to organize recipes, plan meals, and even generate shopping lists. Its strength lies in its intuitive design, powerful recipe import capabilities (including web scraping), multi-user support, and an API for integrations. By leveraging Docker, we gain portability, consistency, and simplified management of the application and its dependencies.
Prerequisites
Before we begin, ensure we have the following:
- An AlmaLinux 10 dedicate server or KVM VPS.
- Domain Name point A record to the server IP.
- Basic Linux Command Line Knowledge.
Deploy Mealie on AlmaLinux 10 Using Docker
Step 1: Update Our AlmaLinux 10 System
Keeping our system up-to-date is always the first step to ensure security and access to the latest packages.
sudo dnf update -y
sudo dnf upgrade -y
Step 2: Install Docker and Docker Compose
Docker is essential for running Mealie. We'll install Docker Engine and Docker Compose, which helps define and run multi-container Docker applications.
2.1 Install dnf-plugins-core
This package provides the dnf config-manager utility, which we'll use to add the Docker repository.
sudo dnf install dnf-plugins-core -y
2.2 Add the Docker Repository
sudo dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
2.3 Install Docker Engine and Docker Compose Plugin
sudo dnf install docker-ce -y
2.4 Start and Enable Docker Service
sudo systemctl start docker
sudo systemctl enable docker
Step 3: Deploy Mealie with Docker Compose
Now that Docker is set up, we can deploy Mealie. We'll create a docker-compose.yml file to define Mealie's services.
3.1 Create a Directory for Mealie
mkdir ~/mealie && cd ~/mealie
3.2 Create the docker-compose.yml File
We'll create a docker-compose.yml
file. This configuration defines the Mealie service, including its image, container name, restart policy, port mapping, data volume, and environment variables.
nano docker-compose.yml
Add following content:
services:
mealie:
image: ghcr.io/mealie-recipes/mealie:latest
container_name: mealie
restart: always
ports:
- "9925:9000" # Host_Port:Container_Port. You can change 9925 to any available port.
volumes:
- mealie_data:/app/data # Persistent storage for Mealie data
environment:
# General Settings
- TZ=Asia/Kolkata # Replace with your desired timezone, e.g., Europe/London, America/New_York
- PUID=1000 # User ID for permissions (match your server user ID)
- PGID=1000 # Group ID for permissions (match your server group ID)
- ALLOW_SIGNUP=true # Set to false after initial user creation for security
- BASE_URL=http://your-server-ip:9925 # Replace with your server's IP address or domain and port
- API_DOCS=True # Enable API documentation (useful for developers)
# Database Settings (for SQLite, these are generally sufficient)
- DB_ENGINE=sqlite
# Email Settings (Optional: Uncomment and configure for password resets, invitations)
# - SMTP_HOST=your.smtp.host
# - SMTP_PORT=587
# - SMTP_FROM_NAME=Mealie
# - SMTP_AUTH_STRATEGY=TLS
# - SMTP_FROM_EMAIL=your@email.com
# - SMTP_USER=your_smtp_username
# - SMTP_PASSWORD=your_smtp_password
volumes:
mealie_data: # Define the named volume for persistence
3.3 Deploy Mealie
Navigate to the directory containing our docker-compose.yml file and run:
docker compose up -d
This command starts the Mealie service in detached mode, meaning it runs in the background. We can check the status with docker compose ps or docker logs mealie.
Step 4: Install and Configure Nginx
Nginx will act as a reverse proxy, directing incoming web requests to our Mealie container.
4.1 Install Nginx
sudo dnf install nginx -y
4.2 Start and Enable Nginx
sudo systemctl start nginx
sudo systemctl enable nginx
4.3 Configure Firewall
Allow HTTP and HTTPS traffic through our firewall.
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload
4.4 Configure SELinux
If you have SELinux enabled, execute following command:
sudo setsebool -P httpd_can_network_connect on
4.5 Create Nginx Configuration for Mealie
We'll create a new Nginx configuration file for our Mealie instance.
sudo nano /etc/nginx/conf.d/mealie.conf
Paste the following configuration. Replace mealie.example.com with our actual domain.
server {
listen 80;
listen [::]:80;
server_name mealie.example.com;
location / {
proxy_pass http://localhost:9925; # Mealie is accessible on host port 9925
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;
proxy_read_timeout 90s; # Adjust if large imports timeout
proxy_send_timeout 90s;
proxy_connect_timeout 90s;
# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
Test Nginx Configuration and Reload
sudo nginx -t
sudo systemctl reload nginx
Step 5: Secure Mealie with Let's Encrypt SSL using Certbot
SSL is crucial for encrypting traffic between our users and Mealie. Certbot automates obtaining and renewing free SSL certificates from Let's Encrypt.
5.1 Install EPEL Release
EPEL (Extra Packages for Enterprise Linux) is a repository that provides additional high-quality packages.
sudo dnf install epel-release -y
5.2 Install Certbot Nginx Package
sudo dnf install certbot python3-certbot-nginx -y
5.3 Obtain SSL Certificate
This command will interactively guide us through obtaining the certificate. Certbot will automatically configure Nginx for SSL.
sudo certbot --nginx -d mealie.example.com
Now, open your web browser and navigate to https://example.com
.
Conclusion
By following this step-by-step guide, we've successfully deployed Mealie on an AlmaLinux 10 server using Docker Compose. We now have a powerful, self-hosted recipe management system at our fingertips, offering a modern and intuitive way to organize our culinary world.
The beauty of this Dockerized setup is its simplicity for updates and maintenance, ensuring our Mealie instance remains a reliable companion in the kitchen for years to come. Enjoy managing your recipes and planning delicious meals!