diff --git a/README.MD b/README.MD index f45dede..f5f0e08 100644 --- a/README.MD +++ b/README.MD @@ -38,4 +38,55 @@ ```bash 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. +```bash +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 +```bash +systemctl enable labyrinth.service +``` + +You can start/stop/show status with +```bash +systemctl start/stop/status labyrinth.service ``` \ No newline at end of file diff --git a/README.MD b/README.MD index f45dede..f5f0e08 100644 --- a/README.MD +++ b/README.MD @@ -38,4 +38,55 @@ ```bash 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. +```bash +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 +```bash +systemctl enable labyrinth.service +``` + +You can start/stop/show status with +```bash +systemctl start/stop/status labyrinth.service ``` \ No newline at end of file diff --git a/src/app.ts b/src/app.ts index 0e54e57..a5ba318 100644 --- a/src/app.ts +++ b/src/app.ts @@ -4,7 +4,7 @@ import { CreateLabyrinthMiddleware } from "./LabyrinthMiddleware"; import { createSampleMaps } from "./SampleMaps"; -const port = 8080; +const port = 8085; const apiRoot = "/graphql"; const saveFile = "./repo.lgr"; const app = express();