Updates in install scripts
This commit is contained in:
		
							parent
							
								
									3f4044c0a9
								
							
						
					
					
						commit
						7b520387d2
					
				
					 10 changed files with 183 additions and 91 deletions
				
			
		
							
								
								
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							|  | @ -5,5 +5,4 @@ node_modules | |||
| npm-debug.log | ||||
| .DS_Store | ||||
| dump.rdb | ||||
| docker-compose.override.yml | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,5 +1,5 @@ | |||
| # Changelog | ||||
| 
 | ||||
| ## 2.0.0 2018-11-23 | ||||
| ## 2.0.0-rc1 2018-12-25 | ||||
| 
 | ||||
|   * This is a complete rewrite of Mailtrain v1 with many features added. Just check it out. | ||||
|  |  | |||
|  | @ -1,22 +1,22 @@ | |||
| FROM node:10.14-jessie | ||||
| 
 | ||||
| RUN apt-get update && apt-get install -y pwgen netcat | ||||
| 
 | ||||
| # First install dependencies | ||||
| COPY ../server/package.json ./app/server | ||||
| COPY ../client/package.json ./app/client | ||||
| COPY ../shared/package.json ./app/shared | ||||
| COPY ../zone-mta/package.json ./app/zone-mta | ||||
| COPY server/package.json /app/server/package.json | ||||
| COPY client/package.json /app/client/package.json | ||||
| COPY shared/package.json /app/shared/package.json | ||||
| COPY zone-mta/package.json /app/zone-mta/package.json | ||||
| 
 | ||||
| WORKDIR /app/ | ||||
| 
 | ||||
| ENV NODE_ENV production | ||||
| 
 | ||||
| RUN for idx in client shared server zone-mta; do (cd $idx && npm install); done | ||||
| 
 | ||||
| # Later, copy the app files. That improves development speed as buiding the Docker image will not have | ||||
| # to download and install all the NPM dependencies every time there's a change in the source code | ||||
| COPY .. /app | ||||
| COPY . /app | ||||
| 
 | ||||
| RUN cd client && npm run build | ||||
| 
 | ||||
| EXPOSE 3000 | ||||
| ENTRYPOINT ["bash", "/app/docker/docker-entrypoint.sh"] | ||||
| EXPOSE 3000 3003 3004 | ||||
| ENTRYPOINT ["bash", "/app/docker-entrypoint.sh"] | ||||
							
								
								
									
										61
									
								
								README.md
									
										
									
									
									
								
							
							
						
						
									
										61
									
								
								README.md
									
										
									
									
									
								
							|  | @ -14,10 +14,12 @@ | |||
| * Automation (triggered and RSS campaigns) | ||||
| * Multiple users with granular user permissions and flexible sharing | ||||
| * Hierarchical namespaces for enterprise-level situations | ||||
| * Builtin Zone-MTA (https://github.com/zone-eu/zone-mta) for close-to-zero setup of mail delivery | ||||
| 
 | ||||
| ## Recommended minimal hardware Requirements | ||||
| * 2 vCPU | ||||
| * 4096 MB RAM | ||||
| 
 | ||||
| ## Hardware Requirements | ||||
| * 1 vCPU | ||||
| * 2048 MB RAM | ||||
| 
 | ||||
| ## Quick Start | ||||
| 
 | ||||
|  | @ -34,7 +36,6 @@ The recommended deployment of Mailtrain would use 3 DNS entries that all points | |||
| - *sbox.mailtrain.example.com* - sandbox endpoint (CNAME record `sbox.mailtrain` under `example.com` domain that points to `lists`) | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| ### Installation on fresh CentOS 7 or Ubuntu 18.04 LTS (public website secured by SSL) | ||||
| 
 | ||||
| This will setup a publicly accessible Mailtrain instance. All endpoints (trusted, sandbox, public) will provide both HTTP (on port 80) | ||||
|  | @ -54,14 +55,14 @@ Thus, by running this script below, you agree with the Let's Encrypt's Terms of | |||
|     sudo su - | ||||
|     ``` | ||||
| 
 | ||||
| 2. Install git | ||||
| 2. Install GIT | ||||
| 
 | ||||
|    For Centos 7 type: | ||||
|     ``` | ||||
|     yum install -y git | ||||
|     ``` | ||||
| 
 | ||||
|    For Ubuntu 18.04 LTS type: | ||||
|    For Ubuntu 18.04 LTS type | ||||
|     ``` | ||||
|     apt-get install -y git | ||||
|     ``` | ||||
|  | @ -162,23 +163,43 @@ All endpoints (trusted, sandbox, public) will provide only HTTP as follows: | |||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| ## Quick Start - Deploy with Docker | ||||
| #### Requirements: | ||||
| ### Deployment with Docker and Docker compose | ||||
| 
 | ||||
|   * [Docker](https://www.docker.com/) | ||||
|   * [Docker Compose](https://docs.docker.com/compose/) | ||||
| This setup starts a stack composed of Mailtrain, MongoDB, Redis, and MariaDB. It will setup a locally accessible Mailtrain instance with HTTP endpoints as follows. | ||||
| - http://localhost:3000 - trusted endpoint | ||||
| - http://localhost:3003 - sandbox endpoint | ||||
| - http://localhost:3004 - public endpoint | ||||
| 
 | ||||
| #### Steps: | ||||
| Depending on how you have configured your system and Docker you may need to prepend the commands below with `sudo`. | ||||
| To make this publicly accessible, you should add reverse proxy that makes these endpoints publicly available over HTTPS. | ||||
| 
 | ||||
| * Download Mailtrain files using git: `git clone git://github.com/Mailtrain-org/mailtrain.git` (or download [zipped repo](https://github.com/Mailtrain-org/mailtrain/archive/master.zip)) and open Mailtrain folder `cd mailtrain` | ||||
| * Copy the file `docker-compose.override.yml.tmpl` to `docker-compose.override.yml` and modify it if you need to. | ||||
| * Bring up the stack with: `docker-compose up -d` | ||||
| * Start: `docker-compose start` | ||||
| * Open [http://localhost:3000/](http://localhost:3000/) (change the host name `localhost` to the name of the host where you are deploying the system). | ||||
| * Authenticate as user `admin` with password `test` | ||||
| * Navigate to [http://localhost:3000/settings](http://localhost:3000/settings) and update service configuration. | ||||
| * Navigate to [http://localhost:3000/users/account](http://localhost:3000/users/account) and update user information and password. | ||||
| To deploy Mailtrain with Docker, you need the following three dependencies installed: | ||||
| 
 | ||||
| - [Docker](https://www.docker.com/) | ||||
| - [Docker Compose](https://docs.docker.com/compose/) | ||||
| - Git - Typically already present. If not, just use the package manager of your OS distribution to install it. | ||||
| 
 | ||||
| These are the steps to start Mailtrain via docker-compose: | ||||
| 
 | ||||
| 1. Download Mailtrain using git | ||||
|     ``` | ||||
|     git clone https://github.com/Mailtrain-org/mailtrain.git | ||||
|     cd mailtrain | ||||
|     git checkout development | ||||
|     ``` | ||||
| 
 | ||||
| 2. Deploy Mailtrain via docker-compose (in the root directory of the Mailtrain project). This will take quite some time when run for the first time. Subsequent executions will be fast. | ||||
|     ``` | ||||
|     docker-compose up | ||||
|     ``` | ||||
| 
 | ||||
|     You can specify Mailtrain's URL bases via the `MAILTRAIN_SETTINGS` environment variable as follows. The `--withProxy` parameter is to be used when Mailtrain is put behind a reverse proxy. | ||||
|     ``` | ||||
|     MAILTRAIN_SETTINGS="--trustedUrlBase https://mailtrain.example.com --sandboxUrlBase https://sbox.mailtrain.example.com --publicUrlBase https://lists.example.com --withProxy" docker-compose up | ||||
|     ``` | ||||
| 
 | ||||
| 3. Open the trusted endpoint http://localhost:3000 | ||||
| 
 | ||||
| 4. Authenticate as `admin`:`test` | ||||
| 
 | ||||
| 
 | ||||
| ## License | ||||
|  |  | |||
							
								
								
									
										41
									
								
								docker-compose.yml
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								docker-compose.yml
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,41 @@ | |||
| version: '3' | ||||
| 
 | ||||
| services: | ||||
|   mysql: | ||||
|     image: mariadb:10.4 | ||||
|     environment: | ||||
|     - MYSQL_ROOT_PASSWORD=mailtrain | ||||
|     - MYSQL_DATABASE=mailtrain | ||||
|     - MYSQL_USER=mailtrain | ||||
|     - MYSQL_PASSWORD=mailtrain | ||||
|     volumes: | ||||
|     - mysql-data:/var/lib/mysql | ||||
| 
 | ||||
|   redis: | ||||
|     image: redis:5 | ||||
|     volumes: | ||||
|     - redis-data:/data | ||||
| 
 | ||||
|   mongo: | ||||
|     image: mongo:4-xenial | ||||
|     volumes: | ||||
|     - mongo-data:/data/db | ||||
| 
 | ||||
|   mailtrain: | ||||
|     build: . | ||||
|     command: ${MAILTRAIN_SETTINGS} | ||||
|     ports: | ||||
|     - "3000:3000" | ||||
|     - "3003:3003" | ||||
|     - "3004:3004" | ||||
|     volumes: | ||||
|     - mailtrain-files:/app/server/files | ||||
|     - mailtrain-reports:/app/protected/reports | ||||
| 
 | ||||
| volumes: | ||||
|   mysql-data: | ||||
|   redis-data: | ||||
|   mongo-data: | ||||
|   mailtrain-files: | ||||
|   mailtrain-reports: | ||||
| 
 | ||||
							
								
								
									
										91
									
								
								docker-entrypoint.sh
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										91
									
								
								docker-entrypoint.sh
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,91 @@ | |||
| #!/bin/bash | ||||
| set -e | ||||
| 
 | ||||
| function printHelp { | ||||
|     cat <<EOF | ||||
| 
 | ||||
| Optional parameters: | ||||
|   --trustedUrlBase XXX  - sets the trusted url of the instance (default: http://localhost:3000) | ||||
|   --sandboxUrlBase XXX  - sets the sandbox url of the instance (default: http://localhost:3003) | ||||
|   --publicUrlBase XXX   - sets the public url of the instance (default: http://localhost:3004) | ||||
|   --withProxy           - use if Mailtrain is behind an http reverse proxy | ||||
| EOF | ||||
| 
 | ||||
|     exit 1 | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| urlBaseTrusted=http://localhost:3000 | ||||
| urlBaseSandbox=http://localhost:3003 | ||||
| urlBasePublic=http://localhost:3004 | ||||
| wwwProxy=false | ||||
| 
 | ||||
| while [ $# -gt 0 ]; do | ||||
|     case "$1" in | ||||
|         --help) | ||||
|             printHelp | ||||
|             ;; | ||||
|         --trustedUrlBase) | ||||
|             urlBaseTrusted="$2" | ||||
|             shift 2 | ||||
|             ;; | ||||
|         --sandboxUrlBase) | ||||
|             urlBaseSandbox="$2" | ||||
|             shift 2 | ||||
|             ;; | ||||
|         --publicUrlBase) | ||||
|             urlBasePublic="$2" | ||||
|             shift 2 | ||||
|             ;; | ||||
|         --withProxy) | ||||
|             wwwProxy=true | ||||
|             shift 1 | ||||
|             ;; | ||||
|         *) | ||||
|             echo "Error: unrecognized option $1." | ||||
|             printHelp | ||||
|     esac | ||||
| done | ||||
| 
 | ||||
| 
 | ||||
| cat > server/config/production.yaml <<EOT | ||||
| www: | ||||
|   host: 0.0.0.0 | ||||
|   proxy: $wwwProxy | ||||
|   secret: "`pwgen -1`" | ||||
|   trustedUrlBase: $urlBaseTrusted | ||||
|   sandboxUrlBase: $urlBaseSandbox | ||||
|   publicUrlBase: $urlBasePublic | ||||
| 
 | ||||
| mysql: | ||||
|   host: mysql | ||||
| 
 | ||||
| redis: | ||||
|   enabled: true | ||||
|   host: redis | ||||
| 
 | ||||
| log: | ||||
|   level: info | ||||
| 
 | ||||
| builtinZoneMTA: | ||||
|   log: | ||||
|     level: warn | ||||
|   mongo: mongodb://mongo:27017/zone-mta | ||||
|   redis: redis://redis:6379/2 | ||||
| 
 | ||||
| queue: | ||||
|   processes: 5 | ||||
| EOT | ||||
| 
 | ||||
| cat >> server/services/workers/reports/config/production.yaml <<EOT | ||||
| log: | ||||
|   level: warn | ||||
| EOT | ||||
| 
 | ||||
| # Wait for the other services to start | ||||
| while ! nc -z mysql 3306; do sleep 1; done | ||||
| while ! nc -z redis 6379; do sleep 1; done | ||||
| while ! nc -z mongo 27017; do sleep 1; done | ||||
| 
 | ||||
| cd server | ||||
| NODE_ENV=production node index.js | ||||
|  | @ -1,14 +0,0 @@ | |||
| version: '2' | ||||
| services: | ||||
|   mysql: | ||||
|     restart: always | ||||
|   redis: | ||||
|     restart: always | ||||
|   mailtrain: | ||||
|     build: ./ | ||||
|     # volumes: | ||||
|       # - ./:/app | ||||
|     ports: | ||||
|       - "3000:3000" | ||||
|     restart: always | ||||
|    | ||||
|  | @ -1,33 +0,0 @@ | |||
| # FIXME - this is not yet upgraded to Mailtrain 2 | ||||
| 
 | ||||
| version: '2' | ||||
| services: | ||||
|   mysql: | ||||
|     image: mysql:5.7 | ||||
|     environment: | ||||
|       - MYSQL_ROOT_PASSWORD=mailtrain | ||||
|       - MYSQL_DATABASE=mailtrain | ||||
|       - MYSQL_USER=mailtrain | ||||
|       - MYSQL_PASSWORD=mailtrain | ||||
|     volumes: | ||||
|       - mailtrain-mysq-data:/var/lib/mysql | ||||
|   redis: | ||||
|     image: redis:3.0 | ||||
|     volumes: | ||||
|       - mailtrain-redis-data:/data | ||||
|   mailtrain: | ||||
|     image: mailtrain:latest | ||||
|     depends_on: | ||||
|       - mysql | ||||
|       - redis | ||||
|     volumes: | ||||
|       - mailtrain-node-config:/app/config | ||||
|       - mailtrain-node-data:/app/public/grapejs/uploads | ||||
|       - mailtrain-node-data:/app/public/mosaico/uploads | ||||
|       - mailtrain-node-reports:/app/protected/reports | ||||
| volumes: | ||||
|   mailtrain-mysq-data: {} | ||||
|   mailtrain-redis-data: {} | ||||
|   mailtrain-node-data: {} | ||||
|   mailtrain-node-config: {} | ||||
|   mailtrain-node-reports: {} | ||||
|  | @ -1,4 +0,0 @@ | |||
| #!/bin/bash | ||||
| set -e | ||||
| 
 | ||||
| bash | ||||
|  | @ -1,9 +0,0 @@ | |||
| [mysql] | ||||
| host="mysql" | ||||
| 
 | ||||
| [redis] | ||||
| enabled=true | ||||
| host="redis" | ||||
| 
 | ||||
| [reports] | ||||
| enabled=true | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue