From f039ce7b351b89a6bd1d195f5d99bef9a44a278f Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 25 Oct 2020 09:00:51 +0100 Subject: [PATCH 01/10] add webircgateway --- .DS_Store | Bin 0 -> 8196 bytes conf/config.conf.example | 128 +++++++++++++++++++++++++++++++++++++++ conf/config.json.example | 2 +- conf/systemd.service | 14 +++++ scripts/backup | 6 ++ scripts/install | 48 +++++++++++---- scripts/remove | 20 ++++++ scripts/restore | 22 +++++++ 8 files changed, 228 insertions(+), 12 deletions(-) create mode 100644 .DS_Store create mode 100644 conf/config.conf.example create mode 100644 conf/systemd.service diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a041dd0994dd52e24a31063a1f2aa4f16a4b2270 GIT binary patch literal 8196 zcmeHMU2GIZ9G~A&=q@ah##1Sz3%2WyE zMdL@*7^C8YA3-B%qKP4j`h+Hc#`vHTNmRfGAAB$-zNnbsi~rf#D{w77nTWEJ%=~Bm zU%T_$-|XD%F~-nRFc&ixXN)OSh1ADUGeQw|QHPaSs2M{N6wk5)UVqkhvo!vFn0KUz z5Qq?n5Qq?n5Qq@C9uS~CTNLFQ`@XbBZG=FCzzvCjct0em3YiM!pp?O@gPPz7K(d0= zL7~1bIwX^!Ooeh#O0rOa3?(T;5gsuh!%3eE{ZgSElv0K>goh7=S4Mb3L2z}-pA6g? zQc^~3gg}JAa0JBJy@KVK%N*8w<@r6^Z(E*UU;iy)qbf#^sZ`Xls-{j*wY$@M+<~-j z_yw=U$oJ?o)0WAzM!wTB{XH4(thITOJDcAYjR z&Ti5P|4QZ&NClQBusHMnt57vGE+u%DEdD2;DucxKimmeNPwZHUJ?Ad7XPh=ZzJ9~{ zJGJ&ME9W|C>jB=QPxOc%8)(>(=SAX0XU???eU8_oSLF;lSFnjhYiwIMlWwAy%e%JS z;d+*DxlVVN&-eMIL|2)*wtH^gZw-?5=z789TR7#iioA_7QmRSfYMc8-8gCoVdnBt< zDSFOS)VC*0ojGUT!bOeEt6R@b)T<_GleHYbIpz?RsDTsr%89R$u&i!Dg9^1Z&8#T zLf@L_)JnBh6Tel}4JG3d3Nl5lR;TKon%PUsMTRcc8Wi1Bx7tRQ+fubmTdwFE)y|@v zo>Z>XRw-4eRl9O-UmxAKC)KHVi=uy~>=M^*H#~oHKX)$Q)jCD#7M3-p$xWqNqQqEr zYJuzqQ&x4chtFd3*>d`|kYT;FTn@6Q*kN{@onRla&)L`PJo|zD%r3G&*d_KS7*vdf zhVht!1d^DGYSg0{E3guGpaXXyjSRYxMGhRj*b5&83}7D~#AA3IPvA*BhnMjRUd3y8 z3-94LKEQ|g6kp;ioWXfqz>oL^zv4G}pRv-y-&C4{l(`n-Vk^;+ z?<-#*rG=wc3gRheh4-AfiG(f~Cx`QE5}FQL6l!3-t%j_z(6*?aY@>+(($=_COX#DC z>N2u zj^W*axF_&2PT~|!;}d*=Z*ZZEvh8J*{eC!Q%XX}*14bB)lDfD!|F6CF_x}+hBUOYz zguwp=0aUc5+gfNgrR}kNV&bfwq/dev/null +then + ynh_script_progression --message="Removing $app service integration..." --weight=1 + yunohost service remove $app +fi + +#================================================= +# STOP AND REMOVE SERVICE +#================================================= +ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 + +# Remove the dedicated systemd config +ynh_remove_systemd_config + #================================================= # REMOVE APP MAIN DIR #================================================= diff --git a/scripts/restore b/scripts/restore index f36582a..f5481c0 100644 --- a/scripts/restore +++ b/scripts/restore @@ -70,6 +70,28 @@ ynh_script_progression --message="Restoring user rights..." --weight=1 # Restore permissions on app files chown -R $app:$app $final_path +#================================================= +# RESTORE SYSTEMD +#================================================= +ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 + +ynh_restore_file --origin_path="/etc/systemd/system/$app.service" +systemctl enable $app.service + +#================================================= +# INTEGRATE SERVICE IN YUNOHOST +#================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 + +yunohost service add $app --description "A short description of the app" --log "/var/log/$app/$app.log" + +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." --weight=1 + +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" + #================================================= # RELOAD NGINX #================================================= From 7e89a08929ad74f29bae00f2e107b873e58f80d0 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 25 Oct 2020 09:05:58 +0100 Subject: [PATCH 02/10] Update install --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 1e7004e..ddaaf11 100644 --- a/scripts/install +++ b/scripts/install @@ -103,11 +103,11 @@ ynh_script_progression --message="Modifying a config file..." cp ../conf/config.json.example "$final_path/static/config.json" # Main config File -ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/config.json" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/static/config.json" cp ../conf/config.conf.example "$webircgateway_path/config.conf" -ynh_store_file_checksum --file="$final_path/config.json" +ynh_store_file_checksum --file="$final_path/static/config.json" ynh_store_file_checksum --file="$webircgateway_path/config.conf" #================================================= From 6e5296d59028e41b09778e44cac86882e0c1f39c Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 25 Oct 2020 09:10:23 +0100 Subject: [PATCH 03/10] Fix --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index ddaaf11..25f1b74 100644 --- a/scripts/install +++ b/scripts/install @@ -121,7 +121,7 @@ chown -R $app:$app $final_path #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --time --weight=1 +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --description "A short description of the app" --log "/var/log/$app/$app.log" From 03bf0492189e866ebaa09b9d61586eeb878c4caf Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 25 Oct 2020 09:14:16 +0100 Subject: [PATCH 04/10] Update install --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 25f1b74..aa12204 100644 --- a/scripts/install +++ b/scripts/install @@ -40,6 +40,7 @@ test ! -e "$final_path" || ynh_die --message="This path already contains a folde # Register (book) web path ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url +mkdir -p /var/www/webircgateway webircgateway_path=/var/www/webircgateway #================================================= From c60cf118901a52b309d872b4a84c6bc5c2403ffa Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 25 Oct 2020 09:23:33 +0100 Subject: [PATCH 05/10] Update remove --- scripts/remove | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/remove b/scripts/remove index 622cfa6..65fc0d6 100644 --- a/scripts/remove +++ b/scripts/remove @@ -48,6 +48,8 @@ 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 NGINX CONFIGURATION #================================================= From 346d6e8e5de60e74dc2c517144a3804b474e0552 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 25 Oct 2020 09:27:51 +0100 Subject: [PATCH 06/10] Update systemd.service --- conf/systemd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index cb2dbb9..af430d0 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,7 +6,7 @@ After=network.target [Service] User=http Group=http -ExecStart=/var/www/webircgateway/webircgateway --config=/var/www/webircgateway/config.conf +ExecStart=/var/www/webircgateway/kiwiirc --config=/var/www/webircgateway/config.conf ExecReload=/usr/bin/kill -USR1 $MAINPID LimitNOFILE=1048576 From cc0fd87fdb68aefa007a7daf60d5cd7d9d713cfa Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 25 Oct 2020 09:36:08 +0100 Subject: [PATCH 07/10] fix --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index aa12204..ae53773 100644 --- a/scripts/install +++ b/scripts/install @@ -118,6 +118,7 @@ ynh_script_progression --message="Securing files and directories..." # Set permissions to app files chown -R $app:$app $final_path +chown -R www-data:www-data $webircgateway_path #================================================= # INTEGRATE SERVICE IN YUNOHOST From 3f043603206462d7e997361523d66bffc3e746c5 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 25 Oct 2020 09:50:09 +0100 Subject: [PATCH 08/10] fix --- conf/config.conf.example | 6 +++--- conf/systemd.service | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/conf/config.conf.example b/conf/config.conf.example index c61ea25..7613a69 100644 --- a/conf/config.conf.example +++ b/conf/config.conf.example @@ -55,8 +55,8 @@ port = 80 # Example unix socket server #[server.3] -#bind = unix:/tmp/webircgateway.sock -#bind_mode = 0777 +bind = unix:/tmp/webircgateway.sock +bind_mode = 0777 # Serve static files from a web root folder. # Optional, but handy for serving the Kiwi IRC client if no other webserver is available @@ -88,7 +88,7 @@ kiwiirc # Connections will be sent to a random upstream [upstream.1] -hostname = "irc.kiwiirc.com" +hostname = "chat.freenode.net" port = 6667 tls = false # Connection timeout in seconds diff --git a/conf/systemd.service b/conf/systemd.service index af430d0..5044bc3 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -4,11 +4,11 @@ Documentation=https://github.com/kiwiirc/webircgateway After=network.target [Service] -User=http -Group=http +User=www-data +Group=www-data ExecStart=/var/www/webircgateway/kiwiirc --config=/var/www/webircgateway/config.conf ExecReload=/usr/bin/kill -USR1 $MAINPID LimitNOFILE=1048576 [Install] -WantedBy=multi-user.target \ No newline at end of file +WantedBy=multi-user.target From 31fcb88896b92f7d5d6ddb5fcd9a93d74005bc3b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 25 Oct 2020 10:31:51 +0100 Subject: [PATCH 09/10] fix --- conf/config.json.example | 4 ++-- scripts/install | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/config.json.example b/conf/config.json.example index c8fa37c..5f79dc8 100644 --- a/conf/config.json.example +++ b/conf/config.json.example @@ -1,5 +1,5 @@ { - "windowTitle": "Kiwi IRC - The web IRC client", + "windowTitle": "Kiwi IRC", "startupScreen": "welcome", "kiwiServer": "https://__DOMAIN__/webirc/kiwiirc/", "restricted": false, @@ -16,7 +16,7 @@ { "name": "Elite", "url": "static/themes/elite" } ], "startupOptions" : { - "server": "chat.freenode.net", + "server": "irc.freenode.net", "port": 6697, "tls": true, "channel": "#yunohost", diff --git a/scripts/install b/scripts/install index ae53773..dc1a1de 100644 --- a/scripts/install +++ b/scripts/install @@ -58,7 +58,7 @@ ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_script_progression --message="Configuring firewall..." --weight=1 # Find an available port -port=$(ynh_find_port --port=8095) +port=$(ynh_find_port --port=7778) ynh_app_setting_set --app=$app --key=port --value=$port #================================================= From 1e5390a662b6c76c809b89f0b1c517e0cadb0303 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Thu, 5 Nov 2020 15:08:24 +0100 Subject: [PATCH 10/10] Delete .DS_Store --- .DS_Store | Bin 8196 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index a041dd0994dd52e24a31063a1f2aa4f16a4b2270..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8196 zcmeHMU2GIZ9G~A&=q@ah##1Sz3%2WyE zMdL@*7^C8YA3-B%qKP4j`h+Hc#`vHTNmRfGAAB$-zNnbsi~rf#D{w77nTWEJ%=~Bm zU%T_$-|XD%F~-nRFc&ixXN)OSh1ADUGeQw|QHPaSs2M{N6wk5)UVqkhvo!vFn0KUz z5Qq?n5Qq?n5Qq@C9uS~CTNLFQ`@XbBZG=FCzzvCjct0em3YiM!pp?O@gPPz7K(d0= zL7~1bIwX^!Ooe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