From 14cf10e4b55cc1c14d2ec56de14e2f21f2685472 Mon Sep 17 00:00:00 2001
From: Lucas Fernandes de Oliveira <lfo14@inf.ufpr.br>
Date: Tue, 17 Oct 2017 11:39:56 -0200
Subject: [PATCH] Issue #51: Add service schema to BlenDB

Signed-off-by: Lucas Fernandes de Oliveira <lfo14@inf.ufpr.br>
---
 .gitignore                    |  1 +
 config/blendb.service.example | 23 +++++++++++++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100644 config/blendb.service.example

diff --git a/.gitignore b/.gitignore
index 832572ed..91b7119c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,7 @@
 /bower_components
 !/config/*.example
 /config/*.yaml
+/config/*.service
 /doc/build
 /coverage
 /typings
diff --git a/config/blendb.service.example b/config/blendb.service.example
new file mode 100644
index 00000000..1c1a5e48
--- /dev/null
+++ b/config/blendb.service.example
@@ -0,0 +1,23 @@
+[Unit]
+Description=BlenDB
+After=network.target
+
+[Service]
+# Here you must set the ABSOLUTE path to the DIRECTORY where node is (and npm)
+# If you are using nvm should be some similar to:
+# /home/$user/.nvm/versions/node/$version/bin
+Environment=NODE_PATH=/usr/bin/
+# Here you must set the port where you would like that this service runs
+Environment=BLENDB_PORT=3001
+# Here you must set the user that should run the service
+# We DO NOT recomend run as root but should work properly as root too
+# We recomend create a separeted user named blendb, but any user should work
+User=blendb
+# Here you must set the path to the BLENDB project DIRECTORY
+# We recomend use the ABSOLUTE path
+# Runing pwd on the git repository should give the right path
+WorkingDirectory=/opt/blendb/
+ExecStart=/bin/bash -c "PATH=$PATH:${NODE_PATH}; PORT=${BLENDB_PORT} npm start"
+
+[Install]
+WantedBy=multi-user.target
-- 
GitLab