diff --git a/conf/app.src b/conf/app.src index 9c038a2..4ca86b2 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +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=kiwiirc_20.05.24.1-1_amd64.deb +SOURCE_EXTRACT=false diff --git a/conf/nginx.conf b/conf/nginx.conf index 508fc0a..3512ed3 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,9 +1,21 @@ -#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; -location __PATH__/ { - - # Path to source - alias __FINALPATH__/ ; - - # Include SSOWAT user panel. - include conf.d/yunohost_panel.conf.inc; +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"; } 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/manifest.json b/manifest.json index 5acca76..ee6da56 100644 --- a/manifest.json +++ b/manifest.json @@ -32,12 +32,6 @@ "name": "domain", "type": "domain" }, - { - "name": "path", - "type": "path", - "example": "/kiwiirc", - "default": "/kiwiirc" - }, { "name": "is_public", "type": "boolean", diff --git a/scripts/install b/scripts/install index 4e6b163..a805217 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 @@ -31,8 +31,8 @@ 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 @@ -60,37 +60,26 @@ 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 #================================================= -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" -#================================================= -#CREAT GATEWAYPATH -#================================================= -ynh_script_progression --message="Setting up gatheway path..." --weight=2 +tempdir="$(mktemp -d)" -webircgateway_path=/var/www/webircgateway -mkdir -p $webircgateway_path +ynh_setup_source --dest_dir=$tempdir --source_id=app -ynh_app_setting_set --app=$app --key=webircgateway_path --value=$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 +x "$webircgateway_path/kiwiirc" +ynh_exec_warn_less dpkg -i $tempdir/kiwiirc_20.05.24.1-1_amd64.deb #================================================= # NGINX CONFIGURATION @@ -103,18 +92,18 @@ 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 -#================================================= -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" chmod 600 "$final_path/static/config.json" chmod 600 "$webircgateway_path/config.conf" diff --git a/scripts/remove b/scripts/remove index eb5b1aa..55b61ec 100644 --- a/scripts/remove +++ b/scripts/remove @@ -45,11 +45,11 @@ ynh_remove_systemd_config #================================================= ynh_script_progression --message="Removing the app 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 #=================================================