Running on systemd

Dmitry Ustalov edited this page Aug 25, 2015 · 3 revisions

Although it is recommended to use Docker or Heroku to run Mechanical Tsar, one may be interested in running it on an arbitrary Linux system. This kind of deployment requires Mechanical Tsar to be successfully compiled (see Running). Assuming that the software has been compiled successfully, select a directory like /srv/mtsar in which the software will be deployed.

Environment Variables

Write environment variables to the /srv/mtsar/environment file.

JVM_OPTIONS=-Xms512m -Xmx512m

System Configuration

Configure Mechanical Tsar and store the resulting YAML configuration as /srv/mtsar/environment.yml (see Building for details).

Service File

Create a systemd service file /etc/systemd/system/mtsar.service.

[Unit]
Description=Mechanical Tsar
After=local-fs.target network.target

[Service]
User=mtsar
EnvironmentFile=/srv/mtsar/environment
WorkingDirectory=/srv/mtsar
ExecStart=/usr/java/default/bin/java -jar -server $JVM_OPTIONS mtsar.jar server /srv/mtsar/environment.yml
Restart=always

[Install]
WantedBy=multi-user.target

First Time Setup

Run database migrations using /usr/java/default/bin/java -jar mtsar.jar db migrate /srv/mtsar/mtsar.yml.

Create a special user for Mechanical Tsar (sudo useradd mtsar) and change the ownership of the /srv/mtsar content: sudo chown -R mtsar:mtsar /srv/mtsar.

nginx

setsebool -P httpd_can_network_connect on

http://gary-rowe.com/agilestack/2013/02/13/an-nginx-config-file-for-dropwizard-with-static-content/

Running

Finally, enable (sudo systemctl enable mtsar) and start (sudo systemctl start mtsar) Mechanical Tsar.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.