1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/yunorunner_ynh.git synced 2024-09-03 20:36:13 +02:00

Update to last version and allow multi instance

This commit is contained in:
Maniack Crudelis 2018-10-14 17:45:28 +02:00
parent d06277fd0d
commit d7265028c5
9 changed files with 56 additions and 48 deletions

View file

@ -12,11 +12,11 @@
setup_private=0
setup_public=1
upgrade=1
# upgrade=1 from_commit=b86b9d09ed97bf04b7e1afad72376d8d695b418b
upgrade=1 from_commit=04cb5f0ec18def9d50fa861c16d491275843b9e7
backup_restore=1
multi_instance=0
multi_instance=1
incorrect_path=1
port_already_use=0
port_already_use=1 (4242)
change_url=1
;;; Levels
Level 1=auto
@ -33,7 +33,7 @@
;;; Options
Email=
Notification=down
#;;; Upgrade options
# ; commit=b86b9d09ed97bf04b7e1afad72376d8d695b418b
# name=20 Jan 2017 b86b9d09ed97bf04b7e1afad72376d8d695b418b
# manifest_arg=domain=DOMAIN&admin=USER&path=PATH&language=en&is_public=Yes&abiword=0&
;;; Upgrade options
; commit=04cb5f0ec18def9d50fa861c16d491275843b9e7
name=03 Sep 2018 04cb5f0ec18def9d50fa861c16d491275843b9e7
manifest_arg=domain=DOMAIN&path=PATH&

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/YunoHost/yunorunner/archive/5dc2c34a2939c537a539320df2c6882068aa5b64.zip
SOURCE_SUM=454d15c16637ded7d41cfbed3561fff0
SOURCE_URL=https://github.com/YunoHost/yunorunner/archive/7ce0982ca5bdb94f5fc955ff1612ae82ced4f2d6.zip
SOURCE_SUM=697a7946aaf7d4f5925870a435cb7fbd
SOURCE_SUM_PRG=md5sum
SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true

View file

@ -6,36 +6,17 @@ location __PATH__/ {
rewrite ^ https://$server_name$request_uri? permanent;
}
proxy_pass http://127.0.0.1:4242/;
proxy_pass http://127.0.0.1:__PORT__/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
# proxy_set_header Host $host;
# proxy_set_header X-Real-IP $remote_addr;
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# proxy_set_header X-Forwarded-Proto $scheme;
# proxy_set_header X-NginX-Proxy true;
# proxy_set_header X-Forwarded-User $remote_user;
# sendfile off;
# proxy_max_temp_file_size 0;
# client_max_body_size 10m;
# client_body_buffer_size 128k;
# proxy_connect_timeout 90;
# proxy_send_timeout 90;
# proxy_read_timeout 90;
# proxy_buffer_size 4k;
# proxy_buffers 4 32k;
# proxy_busy_buffers_size 64k;
# proxy_temp_file_write_size 64k;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
location __PATH__/logs {
alias /home/CI_package_check/logs/;
autoindex on;
}
}

View file

@ -5,7 +5,7 @@
"description": {
"en": "CI runner for YunoHost"
},
"version": "1.0~ynh1",
"version": "240918~ynh1",
"url": "https://github.com/YunoHost/yunorunner",
"license": "free",
"maintainer": {
@ -15,7 +15,7 @@
"requirements": {
"yunohost": ">= 3.1.0"
},
"multi_instance": false,
"multi_instance": true,
"services": [
"nginx"
],

View file

@ -25,7 +25,7 @@ app=$YNH_APP_INSTANCE_NAME
# LOAD SETTINGS
#=================================================
# appname=$(ynh_app_setting_get $app appname)
port=$(ynh_app_setting_get $app port)
#=================================================
# CHECK THE SYNTAX OF THE PATHS

View file

@ -57,8 +57,10 @@ ynh_app_setting_set $app path $path_url
# FIND AND OPEN A PORT
#=================================================
# Ouvre le port 4242 dans le firewall
ynh_exec_fully_quiet yunohost firewall allow --no-upnp TCP 4242
port=$(ynh_find_port 4242)
# Ouvre le port dans le firewall
ynh_exec_fully_quiet yunohost firewall allow --no-upnp TCP $port
ynh_app_setting_set $app port $port
#=================================================
# INSTALL DEPENDENCIES
@ -121,6 +123,13 @@ ve3/bin/pip3 install -r requirements.txt )
ynh_add_systemd_config
#=================================================
# CHANGE PORT IN YUNORUNNER
#=================================================
ynh_replace_string "localhost:4242" "localhost:$port" "$final_path/ciclic"
ynh_replace_string "port=4242" "port=$port" "$final_path/run.py"
#=================================================
# GENERIC FINALISATION
#=================================================
@ -152,4 +161,4 @@ ynh_system_reload --service_name=nginx
# START YUNORUNNER
#=================================================
ynh_system_reload --service_name=yunorunner --action=start
ynh_system_reload --service_name=$app --action=start

View file

@ -16,6 +16,7 @@ source /usr/share/yunohost/helpers
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
port=$(ynh_app_setting_get $app port)
#=================================================
# STANDARD REMOVE
@ -57,10 +58,10 @@ ynh_remove_nginx_config # Suppression de la configuration nginx
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- 4242$"
if yunohost firewall list | grep -q "\- $port$"
then
ynh_print_info "Close port 4242" >&2
ynh_exec_quiet yunohost firewall disallow TCP 4242
ynh_print_info "Close port $port" >&2
ynh_exec_quiet yunohost firewall disallow TCP $port
fi
#=================================================

View file

@ -101,7 +101,7 @@ ynh_system_reload --service_name=nginx
# START YUNORUNNER
#=================================================
ynh_system_reload --service_name=yunorunner --action=start
ynh_system_reload --service_name=$app --action=start
#=================================================
# DEACTIVE MAINTENANCE MODE

View file

@ -18,6 +18,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path)
final_path=$(ynh_app_setting_get $app final_path)
port=$(ynh_app_setting_get $app port)
#=================================================
# CHECK VERSION
@ -29,6 +30,12 @@ upgrade_type=$(ynh_check_app_version_changed)
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
# If port doesn't exist, create it
if [ -z "$port" ]; then
port=4242
ynh_app_setting_set $app port $port
fi
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
@ -91,6 +98,16 @@ ynh_system_user_create $app # Create the dedicated user, if not exist
ynh_add_systemd_config
#=================================================
# CHANGE PORT IN YUNORUNNER
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_replace_string "localhost:4242" "localhost:$port" "$final_path/ciclic"
ynh_replace_string "port=4242" "port=$port" "$final_path/run.py"
fi
#=================================================
# GENERIC FINALISATION
#=================================================
@ -117,7 +134,7 @@ ynh_system_reload --service_name=nginx
# RESTART YUNORUNNER
#=================================================
ynh_system_reload --service_name=yunorunner --action=restart
ynh_system_reload --service_name=$app --action=restart
#=================================================