From 46d88f193b53e8e9629ced95f03d1e42b67cd5f5 Mon Sep 17 00:00:00 2001
From: Ayc0 <benjamin.koltes@gmail.com>
Date: Tue, 10 Apr 2018 17:22:31 +0200
Subject: [PATCH] Add script that restart server

---
 scripts/ecosystem.config.json | 10 ++++++++++
 scripts/update_server.sh      | 23 +++++++++++++++++++++++
 2 files changed, 33 insertions(+)
 create mode 100644 scripts/ecosystem.config.json
 create mode 100644 scripts/update_server.sh

diff --git a/scripts/ecosystem.config.json b/scripts/ecosystem.config.json
new file mode 100644
index 0000000..8e35d18
--- /dev/null
+++ b/scripts/ecosystem.config.json
@@ -0,0 +1,10 @@
+{
+  "apps": [
+    {
+      "script": "../server/index.js",
+      "name": "tv-panel",
+      "instances": "1",
+      "exec_mode": "cluster"
+    }
+  ]
+}
diff --git a/scripts/update_server.sh b/scripts/update_server.sh
new file mode 100644
index 0000000..326c5a8
--- /dev/null
+++ b/scripts/update_server.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+CWD=$(pwd)
+
+DIRECTORY=$(cd `dirname $0` && pwd)
+cd $DIRECTORY
+
+# Pull code
+git fetch
+# git reset --hard origin/master
+
+# Install deps
+cd ../
+yarn install --pure-lockfile
+
+# Build front
+yarn build:front
+
+# Restart server
+cd scripts
+pm2 startOrRestart ecosystem.config.json
+
+cd $CWD
-- 
GitLab