mirror of
https://github.com/YunoHost-Apps/pleroma_ynh.git
synced 2024-09-03 20:15:59 +02:00
Added systemd.service
This commit is contained in:
parent
77acdb108c
commit
eae309860f
3 changed files with 53 additions and 2 deletions
26
conf/systemd.service
Executable file
26
conf/systemd.service
Executable file
|
@ -0,0 +1,26 @@
|
|||
[Unit]
|
||||
Description=__APP__ social network
|
||||
After=network.target postgresql.service
|
||||
|
||||
[Service]
|
||||
User=__APP__
|
||||
WorkingDirectory=__FINALPATH__
|
||||
Environment="HOME=__FINALPATH__"
|
||||
ExecStart=/usr/local/bin/mix phx.server
|
||||
ExecReload=/bin/kill $MAINPID
|
||||
KillMode=process
|
||||
Restart=on-failure
|
||||
|
||||
; Some security directives.
|
||||
; Use private /tmp and /var/tmp folders inside a new file system namespace, which are discarded after the process stops.
|
||||
PrivateTmp=true
|
||||
; Mount /usr, /boot, and /etc as read-only for processes invoked by this service.
|
||||
ProtectSystem=full
|
||||
; Sets up a new /dev mount for the process and only adds API pseudo devices like /dev/null, /dev/zero or /dev/random but not physical devices. Disabled by default because it may not work on devices like the Raspberry Pi.
|
||||
PrivateDevices=false
|
||||
; Ensures that the service process and all its children can never gain new privileges through execve().
|
||||
NoNewPrivileges=true
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
@ -83,11 +83,14 @@ ynh_app_setting_set "$app" port "$port"
|
|||
#=================================================
|
||||
|
||||
# Add erlang for Debian Jessie
|
||||
|
||||
if [ "$(lsb_release --codename --short)" == "jessie" ]; then
|
||||
echo "deb http://binaries.erlang-solutions.com/debian jessie contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list
|
||||
elif
|
||||
[ "$(lsb_release --codename --short)" == "stretch" ]; then
|
||||
echo "deb http://binaries.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list
|
||||
fi
|
||||
|
||||
echo "deb http://binaries.erlang-solutions.com/debian stretch contrib" | tee /etc/apt/sources.list.d/erlang-solutions.list
|
||||
|
||||
# install dependencies
|
||||
ynh_install_app_dependencies git build-essential postgresql postgresql-contrib openssl g++ apt-transport-https erlang-inets elixir erlang-dev erlang-parsetools erlang-xmerl erlang-tools
|
||||
|
@ -152,7 +155,8 @@ ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/config/setu
|
|||
#=================================================
|
||||
# SETUP
|
||||
#=================================================
|
||||
|
||||
( cd $final_path && mix deps.get )
|
||||
( cd $final_path && MIX_ENV=prod mix ecto.migrate )
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
@ -172,6 +176,11 @@ fi
|
|||
# Give permisiion to the final_path
|
||||
chown -R "$app":"$app" "$final_path"
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
systemctl enable "$app"
|
||||
systemctl start "$app"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
|
|
@ -21,6 +21,22 @@ port=$(ynh_app_setting_get "$app" port)
|
|||
db_name=$(ynh_app_setting_get "$app" psql_db)
|
||||
final_path=$(ynh_app_setting_get "$app" final_path)
|
||||
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE SERVICE FROM ADMIN PANEL
|
||||
#=================================================
|
||||
|
||||
if yunohost service status | grep -q "$app"
|
||||
then
|
||||
echo "Remove $app service"
|
||||
yunohost service remove "$app"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue