How to Self-Host Mealie on a VPS (Complete Guide)
Self-hosting applications has become increasingly popular among developers and homelabbers. Mealie, a self-hosted recipe manager, allows you to organize recipes, create meal plans, and generate shopping lists. This guide demonstrates how to self-host Mealie on a VPS, providing clear steps for installation and configuration using Docker.
Prerequisites
Before starting, ensure you have the following:
- A VPS instance: We recommend providers like Contabo (5.99 EUR/mo), Hetzner Cloud (4.15 EUR/mo), DigitalOcean (6 USD/mo), Vultr (6 USD/mo), or Linode (5 USD/mo). For a complete comparison, check our full VPS comparison.
- A domain name for accessing Mealie.
- Basic knowledge of command line and Docker.
Step-by-Step Installation Guide
1. Deploy Your VPS
Start by deploying your VPS from the provider of your choice. Use Ubuntu 20.04 or later for compatibility. Connect to your VPS via SSH:
ssh root@your_vps_ip
2. Install Docker and Docker Compose
Update your package index and install Docker using the following commands:
apt-get update
apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
apt-get update
apt-get install -y docker-ce
Next, install Docker Compose:
curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
3. Setting Up Mealie
Create a new directory for Mealie:
mkdir mealie
cd mealie
Create a docker-compose.yml file:
version: '3.8'
services:
mealie:
image: hkotel/mealie
container_name: mealie
environment:
- [email protected]
- MEALIE_ADMIN_PASSWORD=your_secure_password
volumes:
- ./data:/app/data
ports:
- "9925:80"
restart: unless-stopped
Replace [email protected] and your_secure_password with your desired email and password. This file configures the environment for Mealie, including persistent storage and network settings.
4. Start Mealie
Run Mealie using Docker Compose:
docker-compose up -d
To verify Mealie is running, check the logs:
docker-compose logs -f
5. Access Mealie
Navigate to http://your_vps_ip:9925 in your web browser. You should see the Mealie interface. Log in with the credentials you set earlier.
6. Configure a Domain (Optional)
For a more professional touch, you can point a domain to your VPS. Update your DNS settings to create an A record pointing to your VPS IP. To access Mealie without the port number, set up a reverse proxy using Nginx or Traefik.
Comparison of Popular VPS Providers
| Provider | Monthly Price | Features |
|---|---|---|
| Contabo VPS | 5.99 EUR | High storage options, good performance |
| Hetzner Cloud | 4.15 EUR | Affordable, efficient resource allocation |
| DigitalOcean | 6 USD | Simple interface, scalable resources |
| Vultr | 6 USD | Fast deployment, various locations |
| Linode | 5 USD | Reliable performance, easy-to-use platform |
FAQs
How can I secure Mealie on my VPS?
Securing Mealie involves several steps. Firstly, ensure you use HTTPS for your application. This can be achieved by obtaining an SSL certificate through Let’s Encrypt and configuring it with your Nginx or Traefik reverse proxy. Additionally, avoid using default credentials – always set a strong admin password. Regularly update your containers to incorporate the latest security patches and monitor your logs for unauthorized access attempts.
Can I backup my Mealie data?
Yes, backing up Mealie is straightforward. Since you are using Docker, your data is stored in the ./data directory within your mealie directory. You can create a tarball of this directory as a simple backup:
tar -czvf mealie_backup.tar.gz ./data
You can also leverage Docker volumes for more advanced backup options, potentially even setting up automated scripts to ensure regular backups of your data.
What if I experience issues while using Mealie?
If you encounter issues, consult the r/selfhosted community or the official Mealie repository on GitHub for guidance. These platforms provide a wealth of troubleshooting resources, and you can find solutions to common issues shared by others who have experienced similar problems. Always check the logs from your Docker container for error messages that can provide insight into specific issues.
By following the steps outlined in this guide, you can successfully self-host Mealie on your VPS, allowing you to manage your recipes efficiently. Happy cooking!