mirror of
https://github.com/YunoHost-Apps/ztncui_ynh.git
synced 2024-09-03 18:06:05 +02:00
[fix] overhaul
See #2. Getting rid of start script. cp instead of ln the "fake" ssl certificates.
This commit is contained in:
parent
b4fe63f9a7
commit
234fe49cc5
3 changed files with 10 additions and 14 deletions
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
pushd __FINALPATH__/src/
|
|
||||||
npm start
|
|
||||||
popd
|
|
|
@ -4,11 +4,11 @@ After=network.target
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
User=root
|
User=ztncui
|
||||||
Group=root
|
Group=ztncui
|
||||||
Environment="PATH=__ENV_PATH__"
|
Environment="PATH=__ENV_PATH__"
|
||||||
WorkingDirectory=__FINALPATH__/src/
|
WorkingDirectory=__FINALPATH__/src/
|
||||||
ExecStart=/bin/bash __FINALPATH__/src/start.sh >> /var/log/__APP__/__APP__.log 2>&1
|
ExecStart=__NODEJS_PATH__/npm start
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
|
@ -161,14 +161,11 @@ popd
|
||||||
mkdir -p $final_path
|
mkdir -p $final_path
|
||||||
env_file=$final_path/src/.env
|
env_file=$final_path/src/.env
|
||||||
touch $env_file
|
touch $env_file
|
||||||
|
chmod 600 $env_file
|
||||||
|
|
||||||
echo "ZT_TOKEN=$(</var/lib/zerotier-one/authtoken.secret)" >> $env_file
|
echo "ZT_TOKEN=$(</var/lib/zerotier-one/authtoken.secret)" >> $env_file
|
||||||
echo "HTTP_PORT=$port" >> $env_file
|
echo "HTTP_PORT=$port" >> $env_file
|
||||||
|
|
||||||
cp ../conf/start.sh $final_path/src/
|
|
||||||
ynh_replace_string "__APP__" "$app" "$final_path/src/start.sh"
|
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path" "$final_path/src/start.sh"
|
|
||||||
|
|
||||||
cp $final_path/src/etc/default.passwd $final_path/src/etc/passwd
|
cp $final_path/src/etc/default.passwd $final_path/src/etc/passwd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -178,8 +175,8 @@ cp $final_path/src/etc/default.passwd $final_path/src/etc/passwd
|
||||||
# Even though one can stay in HTTP mode, the ztncui requires SSL certificates
|
# Even though one can stay in HTTP mode, the ztncui requires SSL certificates
|
||||||
# let's use the ones of the domain
|
# let's use the ones of the domain
|
||||||
pushd $final_path/src/etc/tls
|
pushd $final_path/src/etc/tls
|
||||||
ln -s /etc/yunohost/certs/$domain/key.pem privkey.pem
|
cp /etc/yunohost/certs/$domain/key.pem privkey.pem
|
||||||
ln -s /etc/yunohost/certs/$domain/crt.pem fullchain.pem
|
cp /etc/yunohost/certs/$domain/crt.pem fullchain.pem
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -201,6 +198,9 @@ ynh_script_progression --message="Configuring a systemd service..." --time --wei
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
ynh_replace_string "__ENV_PATH__" "$PATH" "/etc/systemd/system/$app.service"
|
ynh_replace_string "__ENV_PATH__" "$PATH" "/etc/systemd/system/$app.service"
|
||||||
|
ynh_replace_string "__NODEJS_PATH__" "/opt/node_n/n/versions/node/$nodejs_version/bin/" "/etc/systemd/system/$app.service"
|
||||||
|
ynh_replace_string "__FINALPATH__" "$final_path" "/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -294,3 +294,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installation of $app completed" --time --last
|
ynh_script_progression --message="Installation of $app completed" --time --last
|
||||||
|
ynh_print_warn --message="Installation of $app completed. Default credentials: admin/password"
|
||||||
|
|
Loading…
Add table
Reference in a new issue