Newer
Older
Labyrinth / README.MD

Labyrinth

About

Labyrinth is a web API to navigate through a maze.

How to run

Install

Install typescript and tslint globally, if you haven't aready.

npm install -g typescript tslint

Local dependencies:

npm install

Build

Compile TypeScript to JavaScript.

tsc

Executing this in the application's root folder will apply the settings from tsconfig.json.

Run

Run the application.

node dist/app.js

Execute tests

npm test

Deploy

Prepare app

  1. Copy all js files from the dist folder to ther server in /var/www/labyrinth
  2. Copy package.json and package-lock.json too.
  3. Run npm install to get the depencencies.
  4. Change the owner to www-data

Apache

Add the following part to the available site in apache to route requests.

ProxyPass /labyrinth http://localhost:8085
ProxyPassReverse /labyrinth http://localhost:8085

This routing is purely internal. Then after each change reload apache to let the changes take effect.

service apache2 reload

Run service with SystemD

Create the following /etc/systemd/system/labyrinth.service.

[Unit]
Description=A good description

[Service]
PIDFile=/tmp/labyrinth.pid
User=www-data
Group=www-data
Restart=always
KillSignal=SIGQUIT
WorkingDirectory=/var/www/labyrinth/
ExecStart=/usr/bin/node /var/www/labyrinth/app.js

[Install]
WantedBy=multi-user.target

After each change run

systemctl enable labyrinth.service

You can start/stop/show status with

systemctl start/stop/status labyrinth.service