1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/pepettes_ynh.git synced 2024-09-03 19:56:35 +02:00
This commit is contained in:
yalh76 2021-03-05 10:41:39 +01:00
parent 796149b39b
commit f9084fa91c
7 changed files with 11 additions and 19 deletions

View file

@ -1,4 +1,4 @@
command = '__FINALPATH__/venv/bin/gunicorn' command = '__PYTHON_PATH__/gunicorn'
pythonpath = '__FINALPATH__' pythonpath = '__FINALPATH__'
workers = 4 workers = 4
user = '__NAME__' user = '__NAME__'

View file

@ -1,5 +1,5 @@
[Unit] [Unit]
Description=Small description of the service Description=__APP__ Daemon
After=network.target After=network.target
[Service] [Service]
@ -7,7 +7,7 @@ PIDFile=/run/gunicorn/__APP__-pid
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__FINALPATH__ WorkingDirectory=__FINALPATH__
ExecStart=__FINALPATH__/venv/bin/gunicorn -c __FINALPATH__/gunicorn.py wsgi:app ExecStart=__PYTHON_PATH__/gunicorn -c __FINALPATH__/gunicorn.py wsgi:app
ExecReload=/bin/kill -s HUP $MAINPID ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID ExecStop=/bin/kill -s TERM $MAINPID
PrivateTmp=true PrivateTmp=true

View file

@ -32,16 +32,6 @@
}, },
"example": "example.com" "example": "example.com"
}, },
{
"name": "path",
"type": "path",
"ask": {
"en": "Choose a path for pepettes",
"fr": "Choisissez un chemin pour pepettes"
},
"example": "/donation",
"default": "/donation"
},
{ {
"name": "is_public", "name": "is_public",
"type": "boolean", "type": "boolean",

View file

@ -25,7 +25,7 @@ ynh_abort_if_errors
#================================================= #=================================================
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url="/"
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
project_name=$YNH_APP_ARG_PROJECT_NAME project_name=$YNH_APP_ARG_PROJECT_NAME
contact_url=$YNH_APP_ARG_CONTACT_URL contact_url=$YNH_APP_ARG_CONTACT_URL
@ -120,6 +120,7 @@ ynh_script_progression --message="Installing Python dependencies..."
pushd $final_path pushd $final_path
ynh_use_python ynh_use_python
$ynh_pip install --upgrade pip
$ynh_pip install -r requirements.txt $ynh_pip install -r requirements.txt
$ynh_pip install gunicorn $ynh_pip install gunicorn
mkdir -p /var/log/$app mkdir -p /var/log/$app
@ -138,7 +139,7 @@ popd
ynh_script_progression --message="Configuring a systemd service..." --weight=1 ynh_script_progression --message="Configuring a systemd service..." --weight=1
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config --others_var="python_path"
#================================================= #=================================================
# MODIFY A CONFIG FILE # MODIFY A CONFIG FILE
@ -181,7 +182,7 @@ yunohost service add $app --description="A simple donation form" --log="/var/log
ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT

View file

@ -92,6 +92,7 @@ ynh_script_progression --message="Installing Python dependencies..."
pushd $final_path pushd $final_path
ynh_use_python ynh_use_python
$ynh_pip install --upgrade pip
$ynh_pip install -r requirements.txt $ynh_pip install -r requirements.txt
$ynh_pip install gunicorn $ynh_pip install gunicorn
mkdir -p /var/log/$app mkdir -p /var/log/$app

View file

@ -111,6 +111,7 @@ ynh_script_progression --message="Installing Python dependencies..."
pushd $final_path pushd $final_path
ynh_use_python ynh_use_python
$ynh_pip install --upgrade pip
$ynh_pip install -r requirements.txt $ynh_pip install -r requirements.txt
$ynh_pip install gunicorn $ynh_pip install gunicorn
mkdir -p /var/log/$app mkdir -p /var/log/$app
@ -129,7 +130,7 @@ popd
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config --others_var="python_path"
#================================================= #=================================================
# MODIFY A CONFIG FILE # MODIFY A CONFIG FILE

View file

@ -99,9 +99,8 @@ ynh_use_python () {
if [[ :$PATH: != *":$python_path"* ]]; then if [[ :$PATH: != *":$python_path"* ]]; then
PATH="$python_path:$PATH" PATH="$python_path:$PATH"
fi fi
python_path="$PATH"
# Create an alias to easily load the PATH # Create an alias to easily load the PATH
ynh_python_load_path="PATH=$python_path" ynh_python_load_path="PATH=$PATH"
# Sets the local application-specific Python version # Sets the local application-specific Python version
(cd $final_path (cd $final_path