Installing & Upgrading Mandrill - wollardj/Mandrill GitHub Wiki

DRAFT

===

sudo git clone https://github.com/wollardj/Mandrill.git /usr/local/Mandrill.git
sudo chown -R `whoami` /usr/local/Mandrill.git


cd /usr/local/Mandrill.git

# check out the latest stable tag
# If you want the bleeding edge code, use `git checkout master` instead
git pull
git checkout tags/`git tag -l | tail -n 1`

# Hint: to see which tag you just switched to...
# git reflog | head -n 1

mrt bundle Mandrill.tar.gz

sudo mkdir -p /usr/local/Mandrill
sudo tar --strip-components 1 -C /usr/local/Mandrill -zxf Mandrill.tar.gz


# create /usr/local/etc/mandrilld.json with the following contents
# be sure to change ROOT_URL and PORT to your IP/HOST and PORT
[{
	"name": "mandrilld",
	"script": "/usr/local/Mandrill/main.js",
	"env": {
		"ROOT_URL": "http://192.168.20.133:3001",
		"PORT": "3001",
		"MONGO_URL": "mongodb://localhost:27017/Mandrill",
		"MANDRILL_MODE": "production"
	},
	"instances": "1",
	"error_file": "/var/log/mandrill/mandrill-err.log",
	"out_file": "/var/log/mandrill/mandrill.log",
	"pid_file": "/var/run/mandrill.pid"
}]

sudo mkdir /var/logs/mandrill
pm2 start /usr/local/etc/mandrilld.json


# Open port 80 through the firewall
sudo iptables -I INPUT 4 -p tcp -m state --state NEW -m tcp --dport 80 -j ACCEPT


# /etc/nginx/nginx.conf
user nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events {
	worker_connections 1024;
}


http {
	include /etc/nginx/mime.types;
	default_type application/octet-stream;

	log_format main '$remote_addr - $remote_user [$time_local] "$request" '
		'$status $body_bytes_sent "$http_referer" '
		'"$http_user_agent" "$http_x_forwarded_for"';

	access_log /var/log/nginx/access.log main;

	sendfile on;
	#tcp_nopush on;

	keepalive_timeout 65;

	gzip on;
	gzip_disable "msie6";

	include /etc/nginx/conf.d/*.conf;
}


server {
	listen 80 default_server;
	listen [::]:80 default_server ipv6only=on;

	# Make site accessible from http://localhost/
	server_name localhost;

	location / {
		proxy_pass http://localhost:3001/;
	}
}