From 006d86d0cfe122b281a926343df06b1d65a80d5e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Wed, 2 Feb 2022 23:23:32 +0100 Subject: [PATCH 1/8] Fix --- conf/app.src | 9 +++++---- scripts/install | 24 +++++++++++++++--------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/conf/app.src b/conf/app.src index f53f889..da13b92 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,6 +1,7 @@ -SOURCE_URL=https://github.com/kiwiirc/kiwiirc/releases/download/v1.5.0/kiwiirc_v1.5.0.zip -SOURCE_SUM=c7b31b2a92b173db4a3878d95aa74c8eb796e7b4d5600a80a00a73d80aa12ada +SOURCE_URL=https://kiwiirc.com/downloads/kiwiirc_20.05.24.1-1_amd64.deb +SOURCE_SUM=c99504c6de678fd91aed357ff0dada16a8df9e932970ed85767b516a9f87df52 SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=zip +SOURCE_FORMAT=deb SOURCE_IN_SUBDIR=true -SOURCE_FILENAME= +SOURCE_FILENAME=kiwiirc_20.05.24.1-1_amd64.deb +SOURCE_EXTRACT=false \ No newline at end of file diff --git a/scripts/install b/scripts/install index b454e28..00bdde1 100644 --- a/scripts/install +++ b/scripts/install @@ -69,27 +69,33 @@ ynh_script_progression --message="Setting up source files..." --weight=2 ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$final_path" +#ynh_setup_source --dest_dir="$final_path" chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" +tempdir="$(mktemp -d)" + +ynh_setup_source --dest_dir=$tempdir --source_id=app + +ynh_exec_warn_less dpkg -i $tempdir/kiwiirc_20.05.24.1-1_amd64.deb + #================================================= #CREAT GATEWAYPATH #================================================= -ynh_script_progression --message="Setting up gatheway path..." --weight=2 +# ynh_script_progression --message="Setting up gatheway path..." --weight=2 -webircgateway_path=/var/www/webircgateway -mkdir -p $webircgateway_path +# webircgateway_path=/var/www/webircgateway +# mkdir -p $webircgateway_path -ynh_app_setting_set --app=$app --key=webircgateway_path --value=$webircgateway_path +# ynh_app_setting_set --app=$app --key=webircgateway_path --value=$webircgateway_path -mv ../sources/webircgateway/* $webircgateway_path +# mv ../sources/webircgateway/* $webircgateway_path -chmod 750 "$webircgateway_path" -chmod -R o-rwx "$webircgateway_path" -chown -R $app:www-data "$webircgateway_path" +# chmod 750 "$webircgateway_path" +# chmod -R o-rwx "$webircgateway_path" +# chown -R $app:www-data "$webircgateway_path" #================================================= # NGINX CONFIGURATION From d8b5c8049281a9315fcf05f4e550a0e74322bc2e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 3 Feb 2022 08:19:27 +0100 Subject: [PATCH 2/8] Update nginx.conf --- conf/nginx.conf | 5 ----- 1 file changed, 5 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 052c370..508fc0a 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -4,11 +4,6 @@ location __PATH__/ { # Path to source alias __FINALPATH__/ ; - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; } From 644ac6a23d3fd0522a79258ace48fb1c51f78d47 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 3 Feb 2022 18:49:01 +0100 Subject: [PATCH 3/8] Update install --- scripts/install | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/scripts/install b/scripts/install index 00bdde1..2aa3206 100644 --- a/scripts/install +++ b/scripts/install @@ -48,11 +48,11 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Finding an available port..." --weight=1 +# ynh_script_progression --message="Finding an available port..." --weight=1 -# Find an available port -port=$(ynh_find_port --port=7778) -ynh_app_setting_set --app=$app --key=port --value=$port +# # Find an available port +# port=$(ynh_find_port --port=7778) +# ynh_app_setting_set --app=$app --key=port --value=$port #================================================= # CREATE DEDICATED USER @@ -65,15 +65,15 @@ ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=2 +# ynh_script_progression --message="Setting up source files..." --weight=2 -ynh_app_setting_set --app=$app --key=final_path --value=$final_path -# Download, check integrity, uncompress and patch the source from app.src -#ynh_setup_source --dest_dir="$final_path" +# ynh_app_setting_set --app=$app --key=final_path --value=$final_path +# # Download, check integrity, uncompress and patch the source from app.src +# #ynh_setup_source --dest_dir="$final_path" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +# chmod 750 "$final_path" +# chmod -R o-rwx "$final_path" +# chown -R $app:www-data "$final_path" tempdir="$(mktemp -d)" @@ -100,10 +100,10 @@ ynh_exec_warn_less dpkg -i $tempdir/kiwiirc_20.05.24.1-1_amd64.deb #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." --weight=2 +# ynh_script_progression --message="Configuring NGINX web server..." --weight=2 -# Create a dedicated NGINX config -ynh_add_nginx_config +# # Create a dedicated NGINX config +# ynh_add_nginx_config #================================================= # SETUP SYSTEMD @@ -113,13 +113,13 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1 # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# MODIFY A CONFIG FILE -#================================================= -ynh_script_progression --message="Modifying a config file..." +# #================================================= +# # MODIFY A CONFIG FILE +# #================================================= +# ynh_script_progression --message="Modifying a config file..." -ynh_add_config --template="../conf/config.json.example" --destination="$final_path/static/config.json" -ynh_add_config --template="../conf/config.conf.example" --destination="$webircgateway_path/config.conf" +# ynh_add_config --template="../conf/config.json.example" --destination="$final_path/static/config.json" +# ynh_add_config --template="../conf/config.conf.example" --destination="$webircgateway_path/config.conf" #================================================= # INTEGRATE SERVICE IN YUNOHOST From 8efcb6bc7b777433cbd0423021ef8e7629d48142 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 3 Feb 2022 18:51:24 +0100 Subject: [PATCH 4/8] Fix --- conf/nginx.conf | 14 ++++++++++---- scripts/install | 8 ++++---- scripts/remove | 8 ++++---- 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 508fc0a..2424f64 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,9 +1,15 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - # Path to source - alias __FINALPATH__/ ; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header x-forwarded-for $remote_addr; - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; + proxy_pass http://127.0.0.1:__PORT__; + proxy_redirect default; + + # Websocket support (from version 1.4) + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; } diff --git a/scripts/install b/scripts/install index 2aa3206..4ffd8e5 100644 --- a/scripts/install +++ b/scripts/install @@ -48,11 +48,11 @@ ynh_app_setting_set --app=$app --key=path --value=$path_url #================================================= # FIND AND OPEN A PORT #================================================= -# ynh_script_progression --message="Finding an available port..." --weight=1 +ynh_script_progression --message="Finding an available port..." --weight=1 -# # Find an available port -# port=$(ynh_find_port --port=7778) -# ynh_app_setting_set --app=$app --key=port --value=$port +# Find an available port +port=$(ynh_find_port --port=7778) +ynh_app_setting_set --app=$app --key=port --value=$port #================================================= # CREATE DEDICATED USER diff --git a/scripts/remove b/scripts/remove index 65fc0d6..d09b0bd 100644 --- a/scripts/remove +++ b/scripts/remove @@ -45,11 +45,11 @@ ynh_remove_systemd_config #================================================= ynh_script_progression --message="Removing KiwiIRC main directory..." --weight=6 -# Remove the app directory securely -ynh_secure_remove --file="$final_path" - -ynh_secure_remove --file="/var/www/webircgateway" +# # Remove the app directory securely +# ynh_secure_remove --file="$final_path" +# ynh_secure_remove --file="/var/www/webircgateway" +dpkg --remove kiwiirc #================================================= # REMOVE NGINX CONFIGURATION #================================================= From f8bc5e34a446804c7f1d68ee3d7acb18c40c54ae Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 3 Feb 2022 18:58:38 +0100 Subject: [PATCH 5/8] Fix --- conf/nginx.conf | 2 +- scripts/install | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 2424f64..f4bb9b0 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -5,7 +5,7 @@ location __PATH__/ { proxy_set_header X-Real-IP $remote_addr; proxy_set_header x-forwarded-for $remote_addr; - proxy_pass http://127.0.0.1:__PORT__; + proxy_pass http://127.0.0.1:__PORT__/kiwi/; proxy_redirect default; # Websocket support (from version 1.4) diff --git a/scripts/install b/scripts/install index 4ffd8e5..f06dd46 100644 --- a/scripts/install +++ b/scripts/install @@ -100,10 +100,10 @@ ynh_exec_warn_less dpkg -i $tempdir/kiwiirc_20.05.24.1-1_amd64.deb #================================================= # NGINX CONFIGURATION #================================================= -# ynh_script_progression --message="Configuring NGINX web server..." --weight=2 +ynh_script_progression --message="Configuring NGINX web server..." --weight=2 -# # Create a dedicated NGINX config -# ynh_add_nginx_config +# Create a dedicated NGINX config +ynh_add_nginx_config #================================================= # SETUP SYSTEMD From 73173b86ad97c33cfaa7de73edf337b54f2042e4 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 3 Feb 2022 19:18:24 +0100 Subject: [PATCH 6/8] Fix --- conf/nginx.conf | 34 ++++++++++++++++++++-------------- conf/systemd.service | 14 -------------- scripts/install | 12 ++++++------ 3 files changed, 26 insertions(+), 34 deletions(-) delete mode 100644 conf/systemd.service diff --git a/conf/nginx.conf b/conf/nginx.conf index f4bb9b0..19d6268 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,15 +1,21 @@ -#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; -location __PATH__/ { - - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header x-forwarded-for $remote_addr; - - proxy_pass http://127.0.0.1:__PORT__/kiwi/; - proxy_redirect default; - - # Websocket support (from version 1.4) - proxy_http_version 1.1; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection "upgrade"; +location / { + index index.html; + root /usr/share/kiwiirc/; } + +location /webirc/ { + # Forward incoming requests to local webircgateway socket + proxy_pass http://127.0.0.1:__PORT__/webirc/; + + # Set http version and headers + proxy_http_version 1.1; + + # Add X-Forwarded-* headers + proxy_set_header X-Forwarded-Host $host; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Forwarded-For $remote_addr; + + # Allow upgrades to websockets + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; +} \ No newline at end of file diff --git a/conf/systemd.service b/conf/systemd.service deleted file mode 100644 index defb1a1..0000000 --- a/conf/systemd.service +++ /dev/null @@ -1,14 +0,0 @@ -[Unit] -Description=Websocket gateway to IRC networks -Documentation=https://github.com/kiwiirc/webircgateway -After=network.target - -[Service] -User=__APP__ -Group=__APP__ -ExecStart=/var/www/webircgateway/kiwiirc --config=/var/www/webircgateway/config.conf -ExecReload=/usr/bin/kill -USR1 $MAINPID -LimitNOFILE=1048576 - -[Install] -WantedBy=multi-user.target diff --git a/scripts/install b/scripts/install index f06dd46..fb02465 100644 --- a/scripts/install +++ b/scripts/install @@ -31,11 +31,11 @@ app=$YNH_APP_INSTANCE_NAME #================================================= ynh_script_progression --message="Validating installation parameters..." --weight=1 -final_path=/var/www/$app -test ! -e "$final_path" || ynh_die --message="This path already contains a folder" +# final_path=/var/www/$app +# test ! -e "$final_path" || ynh_die --message="This path already contains a folder" -# Register (book) web path -ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url +# # Register (book) web path +# ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST @@ -108,10 +108,10 @@ ynh_add_nginx_config #================================================= # SETUP SYSTEMD #================================================= -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 -ynh_add_systemd_config +#ynh_add_systemd_config # #================================================= # # MODIFY A CONFIG FILE From 8bfc4cc4bf67e812de77e0cbfd0e9d721c2dff5d Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 3 Feb 2022 19:19:20 +0100 Subject: [PATCH 7/8] Fix --- manifest.json | 6 ------ scripts/install | 6 +++--- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/manifest.json b/manifest.json index 836a938..c60def0 100644 --- a/manifest.json +++ b/manifest.json @@ -34,12 +34,6 @@ "type": "domain", "example": "domain.org" }, - { - "name": "path", - "type": "path", - "example": "/kiwiirc", - "default": "/kiwiirc" - }, { "name": "is_public", "type": "boolean", diff --git a/scripts/install b/scripts/install index fb02465..d8f211c 100644 --- a/scripts/install +++ b/scripts/install @@ -21,7 +21,7 @@ ynh_abort_if_errors #================================================= domain=$YNH_APP_ARG_DOMAIN -path_url=$YNH_APP_ARG_PATH +path_url="/" is_public=$YNH_APP_ARG_IS_PUBLIC app=$YNH_APP_INSTANCE_NAME @@ -34,8 +34,8 @@ ynh_script_progression --message="Validating installation parameters..." --weigh # final_path=/var/www/$app # test ! -e "$final_path" || ynh_die --message="This path already contains a folder" -# # Register (book) web path -# ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url +# Register (book) web path +ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST From 8a0c75c1132eee4998e3f0dc1c02a8e1e8403aed Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 3 Feb 2022 19:22:11 +0100 Subject: [PATCH 8/8] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index d8f211c..d893956 100644 --- a/scripts/install +++ b/scripts/install @@ -60,7 +60,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port ynh_script_progression --message="Configuring system user..." --weight=3 # Create a system user -ynh_system_user_create --username=$app --home_dir=$final_path +#ynh_system_user_create --username=$app --home_dir=$final_path #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE