https://github.com/mpolinowski/nomadic-mautic
Using Hashicorp Nomad to deploy the Mautic Marketing Automation Platform
https://github.com/mpolinowski/nomadic-mautic
docker hashicorp-nomad mautic
Last synced: 2 months ago
JSON representation
Using Hashicorp Nomad to deploy the Mautic Marketing Automation Platform
- Host: GitHub
- URL: https://github.com/mpolinowski/nomadic-mautic
- Owner: mpolinowski
- Created: 2022-11-16T08:09:49.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-11-16T08:10:05.000Z (over 2 years ago)
- Last Synced: 2025-01-28T19:17:39.580Z (4 months ago)
- Topics: docker, hashicorp-nomad, mautic
- Language: HCL
- Homepage: https://mpolinowski.github.io/docs/DevOps/Hashicorp/2022-11-16-hashicorp-nomad-mautic/2022-11-16
- Size: 1.95 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Deploy Mautic
[Mautic is an Open Source Marketing Automation](https://github.com/mautic) platform that provides you with the greatest level of audience intelligence, thus enabling you to make more meaningful customer connections. Use Mautic to engage your customers and create an efficient marketing strategy. It can be installed using the official [Docker Image](https://hub.docker.com/r/mautic/mautic).
- [Deploy Mautic](#deploy-mautic)
- [Docker-Compose](#docker-compose)
- [Hashicorp Nomad](#hashicorp-nomad)
- [Complete Job File](#complete-job-file)## Docker-Compose
```yml
version: "3.9"services:
database:
image: mariadb:latest
container_name: mautic-db
environment:
MYSQL_ROOT_PASSWORD: mypassword
ports:
- "3306:3306"
volumes:
- database:/var/lib/mysql:rw
restart: always
networks:
- mauticnet
command: --character-set-server=utf8mb4 --collation-server=utf8mb4_general_ci --sql-mode=""mautic:
container_name: mautic
image: mautic/mautic:v4-apache
volumes:
- mautic_data:/var/www/html:rw
environment:
- MAUTIC_DB_HOST=database
- MAUTIC_DB_USER=root
- MAUTIC_DB_PASSWORD=mypassword
- MAUTIC_DB_NAME=mautic4
- MAUTIC_DB_TABLE_PREFIX=mautic4
restart: always
depends_on:
- database
links:
- database
networks:
- mauticnet
ports:
- "8888:80"networks:
mauticnet:volumes:
database:
mautic_data:
```> `docker-compose up -d`
## Hashicorp Nomad
In Nomad we first need to create the volumes on our host in _/etc/nomad.d/client.hcl_ and then define it here:
```bash
volume "mautic_db" {
type = "host"
read_only = false
source = "mautic_db"
}volume "mautic_data" {
type = "host"
read_only = false
source = "mautic_data"
}
```It can then be mounted into the container:
```bash
volume_mount {
volume = "mautic_db"
destination = "/var/lib/mysql"
read_only = false
}volume_mount {
volume = "mautic_data"
destination = "/var/www/html"
read_only = false
}
```### Complete Job File
```bash
job "mautic" {
datacenters = ["dc1"]
group "mautic" {
network {
mode = "host"
port "tcp" {
static = 3306
}
port "http" {
static = 80
}
}update {
max_parallel = 1
min_healthy_time = "10s"
healthy_deadline = "5m"
progress_deadline = "10m"
auto_revert = true
auto_promote = true
canary = 1
}restart {
attempts = 10
interval = "5m"
delay = "25s"
mode = "delay"
}volume "mautic_db" {
type = "host"
read_only = false
source = "mautic_db"
}volume "mautic_data" {
type = "host"
read_only = false
source = "mautic_data"
}service {
name = "mautic-db"
port = "tcp"
tags = [
"database"
]check {
name = "DB Health"
port = "tcp"
type = "tcp"
interval = "30s"
timeout = "4s"
}
}service {
name = "mautic-frontend"
port = "http"
tags = [
"frontend"
]check {
name = "HTTP Health"
path = "/"
type = "http"
protocol = "http"
interval = "10s"
timeout = "2s"
}
}task "mautic-db" {
driver = "docker"config {
image = "mariadb:latest"
ports = ["tcp"]
network_mode = "host"
force_pull = false
}volume_mount {
volume = "mautic_db"
destination = "/var/lib/mysql" # <-- inside container
read_only = false
}env {
MYSQL_ROOT_PASSWORD = "mypassword"
MYSQL_USER = "mautic4"
MYSQL_PASSWORD = "mypassword"
MYSQL_DATABASE = "mautic4"
CONTAINER_NAME = "127.0.0.1"
}
}task "mautic-frontend" {
driver = "docker"volume_mount {
volume = "mautic_data"
destination = "/var/www/html"
read_only = false
}config {
image = "mautic/mautic:v4-apache"
ports = ["http"]
network_mode = "host"
force_pull = false
}env {
MAUTIC_DB_HOST = "127.0.0.1"
MAUTIC_DB_USER = "mautic4"
MAUTIC_DB_PASSWORD = "mypassword"
MAUTIC_DB_NAME = "mautic4"
MAUTIC_DB_TABLE_PREFIX = "mautic4"
}resources {
cpu = 1000
memory = 1024
}
}
}
}
```