From aca8bca997838c3d5347c6df647630090e132b0c Mon Sep 17 00:00:00 2001 From: "J. Fernando Lagrange" Date: Tue, 18 Jul 2017 05:29:03 +0200 Subject: [PATCH] Accurate systemd service (and replacements) --- conf/kresus.service | 6 +++--- scripts/install | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/conf/kresus.service b/conf/kresus.service index 65fcbe8..a6d96ad 100644 --- a/conf/kresus.service +++ b/conf/kresus.service @@ -3,8 +3,8 @@ Description=Kresus After=syslog.target network.target [Service] -WorkingDirectory=/home/yunohost.app/APP_TO_CHANGE -Environment=NODE_ENV=production +WorkingDirectory=YNH_HOME +Environment=NODE_ENV=production HOME=YNH_HOME KRESUS_URL_PREFIX=/$path ExecStart=/usr/bin/node bin/kresus.js Type=simple Restart=always @@ -14,4 +14,4 @@ StandardError=inherit SyslogIdentifier=kresus [Install] -WantedBy=multi-user.target \ No newline at end of file +WantedBy=multi-user.target diff --git a/scripts/install b/scripts/install index 304133b..ad8baf5 100644 --- a/scripts/install +++ b/scripts/install @@ -19,7 +19,7 @@ app=$YNH_APP_INSTANCE_NAME # Install dependencies sudo apt-get update sudo apt-get install nodejs-legacy npm python-weboob-core python-imaging -y -qq - + # Build the app src_path=/home/yunohost.app/$app sudo git clone https://framagit.org/bnjbvr/kresus.git $src_path @@ -34,10 +34,11 @@ app=$YNH_APP_INSTANCE_NAME # Setup service systemd_service=../conf/kresus.service - sed -i "s@APP_TO_CHANGE@$app@g" $systemd_service + sed -i "s@YNH_HOME@$src_path@g" $systemd_service + sed -i "s@YNH_WWW_PATH@$path@g" $systemd_service sudo cp $systemd_service /etc/systemd/system/$app.service systemctl enable $app systemctl start $app - + # Reload services sudo service nginx reload