If you’re looking for an efficient and streamlined way to integrate mosparo, an open-source spam protection solution, into your workflow, running it via Docker is an excellent choice. Docker allows you to deploy mosparo quickly without worrying about dependencies or manual configurations. In this guide, we’ll walk through setting up mosparo with Docker.
Prerequisites
Before getting started, ensure you have the following installed on your system:
- Docker (Install Docker)
- Docker Compose (if using a
docker-compose.yml
file)
Setting Up mosparo with Docker
1. Pull the mosparo Docker Image
First, you need to pull the official mosparo Docker image:
1 2 3 |
docker pull mosparo/mosparo |
2. Create a Docker Network (Optional)
If you plan to use mosparo with other services like a database, creating a dedicated Docker network can be helpful:
1 2 3 |
docker network create mosparo-network |
3. Run mosparo Using Docker
To start mosparo as a standalone container, use the following command:
1 2 3 4 5 6 7 8 |
docker run -d \ --name mosparo \ -p 8080:80 \ -e APP_ENV=production \ -v mosparo-data:/var/www/html/storage \ mosparo/mosparo |
This will:
- Run mosparo in detached mode (
-d
) - Name the container
mosparo
- Map port
8080
on your host to port80
inside the container - Set the environment variable
APP_ENV
toproduction
- Persist data in a named Docker volume (
mosparo-data
)
4. Using Docker Compose (Alternative Setup)
For a more structured setup, use Docker Compose. Create a docker-compose.yml
file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
version: '3.8' services: mosparo: image: mosparo/mosparo container_name: mosparo ports: - "8080:80" environment: - APP_ENV=production volumes: - mosparo-data:/var/www/html/storage restart: always volumes: mosparo-data: |
Then, start mosparo with:
1 2 3 |
docker-compose up -d |
5. Using a Portainer Stack
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
services: mosparo_web: image: mosparo/mosparo:latest ports: - 3030:80 restart: always environment: - MOSPARO_ENABLE_WEBSERVER=1 - MOSPARO_ENABLE_CRON=0 volumes: - ~/docker/mosparo_data:/mosparo-data network_mode: bridge mosparo_cron: image: mosparo/mosparo:latest restart: always environment: - MOSPARO_ENABLE_WEBSERVER=0 - MOSPARO_ENABLE_CRON=1 volumes: - ~/docker/mosparo_data:/mosparo-data network_mode: bridge |
Accessing mosparo
Once the container is running, open your browser and visit:
1 2 3 |
http://localhost:8080 |
Follow the setup wizard to complete the installation.
Configuring mosparo
After installation, you may want to:
- Set up an admin account
- Connect to an external database (e.g., MySQL, PostgreSQL)
- Secure the instance using HTTPS with a reverse proxy (e.g., Nginx, Traefik)
More Info
Currently active on the contact page!