mirror of
https://github.com/YunoHost-Apps/osjs_ynh.git
synced 2024-09-03 19:56:11 +02:00
[Fix] System config (#3)
* [Fix] File system * Update install * [Fix] Configuration system + nginx * [Fix] Problem Conf error #20 * [Fix] Problem conf * [Fix] $app.service * [Fix] Nodejs command (1st try)
This commit is contained in:
parent
3fd56497aa
commit
e269a0427c
3 changed files with 11 additions and 9 deletions
|
@ -1,15 +1,16 @@
|
||||||
[Unit]
|
[Unit]
|
||||||
Description=OS.js is a web-desktop written in Nodejs and javascript.
|
Description=OS.js is a web-desktop written in Nodejs and javascript.
|
||||||
After=syslog.target
|
|
||||||
After=network.target
|
After=network.target
|
||||||
|
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=root
|
User=__APP__
|
||||||
WorkingDirectory=__FINALPATH__
|
Group=__APP__
|
||||||
|
ExecStartPre=__NODEJS__
|
||||||
|
Environment="PATH=__ENV_PATH__"
|
||||||
ExecStart=/usr/bin/node osjs run --port=__PORT__
|
ExecStart=/usr/bin/node osjs run --port=__PORT__
|
||||||
Restart=always
|
Restart=always
|
||||||
Environment=USER=osjs HOME=__FINALPATH__
|
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
|
@ -79,6 +79,7 @@ ynh_systemd_config () {
|
||||||
if test -n "${app:-}"; then
|
if test -n "${app:-}"; then
|
||||||
ynh_replace_string "__APP__" "$app" "$finalsystemdconf"
|
ynh_replace_string "__APP__" "$app" "$finalsystemdconf"
|
||||||
fi
|
fi
|
||||||
|
ynh_replace_string "__PORT__" "$port" "$finalsystemdconf"
|
||||||
ynh_store_file_checksum "$finalsystemdconf"
|
ynh_store_file_checksum "$finalsystemdconf"
|
||||||
|
|
||||||
sudo chown root: "$finalsystemdconf"
|
sudo chown root: "$finalsystemdconf"
|
||||||
|
|
|
@ -114,13 +114,14 @@ sudo chmod 755 $final_path -R
|
||||||
#=================================================
|
#=================================================
|
||||||
# Modify Nginx configuration file and copy it to Nginx conf directory
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_replace_string "__PORT__" "$port" "../conf/nginx.conf"
|
|
||||||
ynh_replace_string "__PORT__" "$port" "../conf/osjs.service"
|
ynh_nginx_config
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path" "../conf/osjs.service"
|
|
||||||
nginxconf=/etc/nginx/conf.d/$domain.d/$app.conf
|
nginxconf=/etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
sudo cp ../conf/nginx.conf $nginxconf
|
|
||||||
sudo chown root: $nginxconf
|
sudo chown root: $nginxconf
|
||||||
sudo chmod 600 $nginxconf
|
sudo chmod 600 $nginxconf
|
||||||
|
ynh_systemd_config
|
||||||
|
ynh_replace_string "__NODEJS__" "$nodejs_use_version" "/etc/systemd/system/$app.service"
|
||||||
|
ynh_replace_string "__ENV_PATH__" "$PATH" "/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Install OSjs
|
# Install OSjs
|
||||||
|
@ -137,7 +138,6 @@ sudo yunohost firewall allow Both $port
|
||||||
# Configure init script
|
# Configure init script
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
sudo cp ../conf/"$app".service /etc/systemd/system/
|
|
||||||
sudo systemctl daemon-reload
|
sudo systemctl daemon-reload
|
||||||
sudo systemctl enable "$app".service
|
sudo systemctl enable "$app".service
|
||||||
sudo systemctl start "$app".service
|
sudo systemctl start "$app".service
|
||||||
|
|
Loading…
Add table
Reference in a new issue