1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pagure_ynh.git synced 2024-09-03 19:56:19 +02:00

Upgrade uwsgi helper

This commit is contained in:
Jean-Baptiste Holcroft 2018-05-20 21:37:45 +02:00
parent 26fe5423f8
commit 636a871b02
7 changed files with 31 additions and 36 deletions

View file

@ -6,8 +6,6 @@ location __PATH__ {
include uwsgi_params;
# Needed for long running operations in admin interface
uwsgi_read_timeout 3600;
uwsgi_param SCRIPT_NAME __PATH__;
uwsgi_modifier1 30;
uwsgi_pass unix:///var/run/uwsgi/__NAME__.socket;
# Include SSOWAT user panel.

View file

@ -6,6 +6,7 @@ After=syslog.target
ExecStart=/usr/bin/uwsgi \
--ini /etc/uwsgi/apps-available/%i.ini \
--socket /var/run/uwsgi/%i.socket \
--chmod-socket=775 \
--logto /var/log/uwsgi/app/%i
User=%i
Group=www-data
@ -14,3 +15,6 @@ KillSignal=SIGQUIT
Type=notify
StandardError=syslog
NotifyAccess=all
[Install]
WantedBy=multi-user.target

View file

@ -1,11 +0,0 @@
[Unit]
Description=Socket for uWSGI app %i
[Socket]
ListenStream=/var/run/uwsgi/%i.socket
SocketUser=%i
SocketGroup=www-data
SocketMode=0775
[Install]
WantedBy=sockets.target

View file

@ -4,9 +4,16 @@ master = true
protocol = uwsgi
socket = /var/run/uwsgi/__APP__.socket
virtualenv = __FINALPATH__/venv
wsgi-file = __FINALPATH__/pagure.wsgi
## master = [master process (true of false)]
master = true
# http://uwsgi-docs.readthedocs.io/en/latest/Nginx.html#hosting-multiple-apps-in-the-same-process-aka-managing-script-name-and-path-info
mount = __PATH__=__FINALPATH__/pagure.wsgi
manage-script-name = true
# Increase number of workers for heavily loaded sites
# Needed for background processing
enable-threads = true
# Child processes do not need file descriptors
close-on-exec = true
## processes = [number of processes]
processes = 5

View file

@ -8,7 +8,7 @@
"description": {
"en": "Pagure is a git-centered forge, python based using pygit2."
},
"version": "3.13.2-1",
"version": "3.13.2-2",
"url": "https://pagure.io/pagure",
"license": "AGPL-3.0",
"maintainer": {

View file

@ -3,13 +3,7 @@
ynh_check_global_uwsgi_config () {
uwsgi --version || ynh_die "You need to add uwsgi (and appropriate plugin) as a dependency"
if [ -f /etc/systemd/system/uwsgi-app@.service ];
then
echo "Uwsgi generic file is already installed"
else
cp ../conf/uwsgi-app@.socket /etc/systemd/system/uwsgi-app@.socket
cp ../conf/uwsgi-app@.service /etc/systemd/system/uwsgi-app@.service
fi
cp ../conf/uwsgi-app@.service /etc/systemd/system/uwsgi-app@.service
# make sure the folder for sockets exists and set authorizations
mkdir -p /var/run/uwsgi/
@ -61,12 +55,12 @@ ynh_add_uwsgi_service () {
ynh_store_file_checksum "$finaluwsgiini"
chown root: "$finaluwsgiini"
systemctl enable "uwsgi-app@$app.socket"
systemctl start "uwsgi-app@$app.socket"
systemctl daemon-reload
systemctl enable "uwsgi-app@$app.service"
# Add as a service
yunohost service add "uwsgi-app@$app.socket" --log "/var/log/uwsgi/app/$app"
yunohost service add "uwsgi-app@$app.service" --log "/var/log/uwsgi/app/$app"
}
# Remove the dedicated uwsgi ini file
@ -75,17 +69,15 @@ ynh_add_uwsgi_service () {
ynh_remove_uwsgi_service () {
finaluwsgiini="/etc/uwsgi/apps-available/$app.ini"
if [ -e "$finaluwsgiini" ]; then
systemctl stop "uwsgi-app@$app.socket"
systemctl disable "uwsgi-app@$app.socket"
yunohost service remove "uwsgi-app@$app.socket"
systemctl stop "uwsgi-app@$app.service"
systemctl disable "uwsgi-app@$app.service"
yunohost service remove "uwsgi-app@$app.service"
ynh_secure_remove "$finaluwsgiini"
ynh_secure_remove "/var/run/uwsgi/$app.socket"
ynh_secure_remove "/var/log/uwsgi/app/$app"
fi
}
#=================================================
#
# POSTGRES HELPERS

View file

@ -84,11 +84,10 @@ ynh_install_app_dependencies git python-virtualenv libgit2-dev \
ynh_psql_test_if_first_run
db_name=$(ynh_sanitize_dbid "$app")
db_pwd=$(ynh_string_random)
# Initialize database and store postgres password for upgrade
ynh_psql_create_db "$db_name" "$app" "$db_pwd"
ynh_app_setting_set "$app" db_name "$db_name"
ynh_app_setting_set "$app" db_pwd "$db_pwd"
# Initialize database and store postgres password for upgrade
ynh_psql_setup_db "$db_name" "$app"
systemctl reload postgresql
@ -195,6 +194,12 @@ then
ynh_app_setting_set "$app" unprotected_uris "/"
fi
#=================================================
# START PAGURE
#=================================================
systemctl start "uwsgi-app@$app.service"
#=================================================
# RELOAD NGINX
#=================================================