Docker
This document explains how to install and run RustMailer using Docker.
It assumes you have Docker installed on your system.
π¦ Docker Imageβ
You can either use the official image published to Docker Hub or build it manually.
Option 1: Use Prebuilt Image from Docker Hubβ
# Pull the latest tagged image from Docker Hub
docker pull rustmailer/rustmailer:latest
Option 2: Build the Image Yourselfβ
Make sure you have the project cloned and compiled:
# Step 1: Build frontend assets
cd /home/user/rustmailer/web
pnpm install
pnpm run build
# Step 2: Compile Rust binary
cd /home/user/rustmailer
cargo build --release
# Step 3: Build Docker image using provided script
cd /home/user/rustmailer/docker
./build.sh
π Running the Containerβ
Run the container using the following command:
docker run -d \
--name rustmailer \
-p 15630:15630 \
-p 16630:16630 \
-v /path/to/your/data:/data \
--env-file /path/to/your/env.file \
rustmailer/rustmailer:<version>
- Replace
<version>
with the image tag you want. - Replace
/path/to/your/data
with the actual directory where you want to persist data. - Replace
/path/to/your/env.file
with the actual path to your environment variable file (e.g.,/home/user/rustmailer.env
).
Pull and run the latest RustMailer container for a fast and easy hands-on experience
docker run -d --name rustmailer -p 15630:15630 -p 16630:16630 -e RUSTMAILER_ROOT_DIR=/data -v /sourcecode/rustmailer_data/:/data rustmailer/rustmailer:latest
The environment variable options for the rustmailer
container are detailed in the official documentation under Configuration Reference. Please refer to it for a complete list of supported variables.
Here's an example of an environment variable file (rustmailer.env
):
RUSTMAILER_ROOT_DIR=/data/rustmailer_data
RUSTMAILER_HTTP_PORT=15630
RUSTMAILER_GRPC_ENABLED=true
RUSTMAILER_GRPC_PORT=16630
RUSTMAILER_BIND_IP="0.0.0.0"
RUSTMAILER_PUBLIC_URL="http://localhost:15630"
RUSTMAILER_LOG_TO_FILE=true
π Health Checkβ
RustMailer exposes a health check endpoint:
GET http://localhost:15630/api/status
This is used internally by Dockerβs HEALTHCHECK
, but can also be used for monitoring or debugging.
View Logsβ
If your container fails to start or you want to troubleshoot its running status, use the following command to view the container logs:
sudo docker logs rustmailer
π Stopping the Containerβ
To stop and remove the container:
docker stop rustmailer
docker rm rustmailer
π§© Additional Notesβ
- The container runs as a non-root user (
rmailer
). - Data is persisted under
/data
inside the container. - Make sure your volume path is writable by Docker.