From 0c1684a7511b32018fee56c91caa942524f6c767 Mon Sep 17 00:00:00 2001 From: vladimir Date: Fri, 17 Mar 2017 16:48:50 +0200 Subject: [PATCH] [feature] Add Dockerfile and update README --- Dockerfile | 9 +++++++ README.md | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..efb056d1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,9 @@ +FROM centos +RUN curl --silent --location https://rpm.nodesource.com/setup_7.x | bash - +RUN yum install -y git make gcc nodejs && yum clean all +RUN git clone git://github.com/andris9/mailtrain.git /app +WORKDIR /app/ +ENV NODE_ENV production +RUN npm install --no-progress --production && npm install --no-progress passport-ldapjs +EXPOSE 3000 +CMD ["/usr/bin/node", "index.js"] diff --git a/README.md b/README.md index 3711c676..5770513e 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,77 @@ If you are using the bundled ZoneMTA then you should make sure you are using a p With proper SPF, DKIM and PTR records (DMARC wouldn't hurt either) I got perfect 10/10 score out from [MailTester](https://www.mail-tester.com/) when sending a campaign message to a MailTester test address. I did not have VERP turned on, so the sender address matched return path address. +### Simple Install (Docker) +##### Requirements: + * Docker + * docker-compose + + 1. Download Mailtrain files using git: `git clone git://github.com/andris9/mailtrain.git` (or download [zipped repo](https://github.com/andris9/mailtrain/archive/master.zip)) and open Mailtrain folder `cd mailtrain` + 2. Run `sudo docker build -t mailtrain-node:latest .` + 3. Copy default.toml to production.toml. Run `sudo mkdir -p /etc/mailtrain && sudo cp config/default.toml /etc/mailtrain/production.toml` + 4. Create `/etc/docker-compose.yml`. Example (dont forget change MYSQL_ROOT_PASS and MYSQL_USER_PASSWORD to your passwords): + ``` + version: '2' + services: + mailtrain-mysql: + image: mysql:latest + ports: + - "3306:3306" + container_name: "mailtrain-mysql" + restart: always + environment: + MYSQL_ROOT_PASSWORD: "MYSQL_ROOT_PASS" + MYSQL_DATABASE: "mailtrain" + MYSQL_USER: "mailtrain" + MYSQL_PASSWORD: "MYSQL_USER_PASSWORD" + volumes: + - mailtrain-mysq-data:/var/lib/mysql + + mailtrain-redis: + image: redis:3.0 + container_name: "mailtrain-redis" + volumes: + - mailtrain-redis-data:/data + + mailtrain-node: + image: mailtrain-node:latest + container_name: "mailtrain-node" + links: + - "mailtrain-mysql:mailtrain-mysql" + - "mailtrain-redis:mailtrain-redis" + ports: + - "3000:3000" + volumes: + - "/etc/mailtrain/production.toml:/app/config/production.toml" + volumes: + mailtrain-mysq-data: {} + mailtrain-redis-data: {} + + ``` + 5. Update MySQL and Redis credintial in `/etc/mailtrain/production.toml` like this: + ``` + [mysql] + host="mailtrain-mysql" + user="mailtrain" + password="MYSQL_USER_PASSWORD" + database="mailtrain" + port=3306 + charset="utf8mb4" + timezone="UTC" + + [redis] + enabled=true + host="mailtrain-redis" + port=6379 + db=5 + ``` + 6. Run docker container with command `sudo docker-compose -f /etc/docker-compose.yml up -d` + 7. Open [http://localhost:3000/](http://localhost:3000/) + 8. Authenticate as `admin`:`test` + 9. Navigate to [http://localhost:3000/settings](http://localhost:3000/settings) and update service configuration + 10. Navigate to [http://localhost:3000/users/account](http://localhost:3000/users/account) and update user information and password + + ### Manual Install (any OS that supports Node.js) 1. Download Mailtrain files using git: `git clone git://github.com/andris9/mailtrain.git` (or download [zipped repo](https://github.com/andris9/mailtrain/archive/master.zip)) and open Mailtrain folder `cd mailtrain`