Hi, i’m have a vps with ubuntu 16.04 and i following this guide for install nginx + meteor.
The problem is that guide is for ubuntu 14.04 and use startup. In ubuntu 16.04 there is systemd.
How can i translate this startup’s code in sistemd?
upstart service file at /etc/init/todos.conf
description "Meteor.js (NodeJS) application"
author “Daniel Speichert daniel@speichert.pro”
When to start the service
start on started mongodb and runlevel [2345]
When to stop the service
stop on shutdown
Automatically restart process if crashed
respawn
respawn limit 10 5
we don’t use buil-in log because we use a script below
console log
drop root proviliges and switch to mymetorapp user
setuid todos
setgid todos
script
export PATH=/opt/local/bin:/opt/local/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export NODE_PATH=/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript
# set to home directory of the user Meteor will be running as
export PWD=/home/todos
export HOME=/home/todos
# leave as 127.0.0.1 for security
export BIND_IP=127.0.0.1
# the port nginx is proxying requests to
export PORT=8080
# this allows Meteor to figure out correct IP address of visitors
export HTTP_FORWARDED_COUNT=1
# MongoDB connection string using todos as database name
export MONGO_URL=mongodb://localhost:27017/todos
# The domain name as configured previously as server_name in nginx
export ROOT_URL=https://todos.net
# optional JSON config - the contents of file specified by passing “–settings” parameter to meteor command in development mode
export METEOR_SETTINGS=’{ “somesetting”: “someval”, “public”: { “othersetting”: “anothervalue” } }’
# this is optional: http://docs.meteor.com/#email
# commented out will default to no email being sent
# you must register with MailGun to have a username and password there
# export MAIL_URL=smtp://postmaster@mymetorapp.net:password123@smtp.mailgun.org
# alternatively install “apt-get install default-mta” and uncomment:
# export MAIL_URL=smtp://localhost
exec node /home/todos/bundle/main.js >> /home/todos/todos.log
end script