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

View file

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

View file

@ -6,36 +6,17 @@ location __PATH__/ {
rewrite ^ https://$server_name$request_uri? permanent; 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_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "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;
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; 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": { "description": {
"en": "CI runner for YunoHost" "en": "CI runner for YunoHost"
}, },
"version": "1.0~ynh1", "version": "240918~ynh1",
"url": "https://github.com/YunoHost/yunorunner", "url": "https://github.com/YunoHost/yunorunner",
"license": "free", "license": "free",
"maintainer": { "maintainer": {
@ -15,7 +15,7 @@
"requirements": { "requirements": {
"yunohost": ">= 3.1.0" "yunohost": ">= 3.1.0"
}, },
"multi_instance": false, "multi_instance": true,
"services": [ "services": [
"nginx" "nginx"
], ],

View file

@ -25,7 +25,7 @@ app=$YNH_APP_INSTANCE_NAME
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
# appname=$(ynh_app_setting_get $app appname) port=$(ynh_app_setting_get $app port)
#================================================= #=================================================
# CHECK THE SYNTAX OF THE PATHS # 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 # FIND AND OPEN A PORT
#================================================= #=================================================
# Ouvre le port 4242 dans le firewall port=$(ynh_find_port 4242)
ynh_exec_fully_quiet yunohost firewall allow --no-upnp TCP 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 # INSTALL DEPENDENCIES
@ -121,6 +123,13 @@ ve3/bin/pip3 install -r requirements.txt )
ynh_add_systemd_config 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 # GENERIC FINALISATION
#================================================= #=================================================
@ -152,4 +161,4 @@ ynh_system_reload --service_name=nginx
# START YUNORUNNER # 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 app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get $app domain)
port=$(ynh_app_setting_get $app port)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
@ -57,10 +58,10 @@ ynh_remove_nginx_config # Suppression de la configuration nginx
# CLOSE A PORT # CLOSE A PORT
#================================================= #=================================================
if yunohost firewall list | grep -q "\- 4242$" if yunohost firewall list | grep -q "\- $port$"
then then
ynh_print_info "Close port 4242" >&2 ynh_print_info "Close port $port" >&2
ynh_exec_quiet yunohost firewall disallow TCP 4242 ynh_exec_quiet yunohost firewall disallow TCP $port
fi fi
#================================================= #=================================================

View file

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

View file

@ -18,6 +18,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get $app domain) domain=$(ynh_app_setting_get $app domain)
path_url=$(ynh_app_setting_get $app path) path_url=$(ynh_app_setting_get $app path)
final_path=$(ynh_app_setting_get $app final_path) final_path=$(ynh_app_setting_get $app final_path)
port=$(ynh_app_setting_get $app port)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -29,6 +30,12 @@ upgrade_type=$(ynh_check_app_version_changed)
# ENSURE DOWNWARD COMPATIBILITY # 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 # 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 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 # GENERIC FINALISATION
#================================================= #=================================================
@ -117,7 +134,7 @@ ynh_system_reload --service_name=nginx
# RESTART YUNORUNNER # RESTART YUNORUNNER
#================================================= #=================================================
ynh_system_reload --service_name=yunorunner --action=restart ynh_system_reload --service_name=$app --action=restart
#================================================= #=================================================