diff --git a/README.md b/README.md index 82b0fda..acb5023 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ It shall NOT be edited by hand. # Scuttlebutt Room for YunoHost -[![Integration level](https://dash.yunohost.org/integration/ssbroom.svg)](https://dash.yunohost.org/appci/app/ssbroom) ![](https://ci-apps.yunohost.org/ci/badges/ssbroom.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/ssbroom.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/ssbroom.svg)](https://dash.yunohost.org/appci/app/ssbroom) ![Working status](https://ci-apps.yunohost.org/ci/badges/ssbroom.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/ssbroom.maintain.svg) [![Install Scuttlebutt Room with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=ssbroom) *[Lire ce readme en français.](./README_fr.md)* @@ -30,37 +30,38 @@ For a comprehensive introduction to rooms 2.0, watch [this video](https://www.yo - HTTP Invites - Alias management -**Shipped version:** 2.0.6~ynh1 +**Shipped version:** 2.0.6~ynh4 **Demo:** https://hermies.club/ ## Screenshots -![](./doc/screenshots/ssbroom-screenshot.png) +![Screenshot of Scuttlebutt Room](./doc/screenshots/ssbroom-screenshot.png) ## Disclaimers / important information * requires a full dedicated domain and does not support sub-paths - * currently ony supported on amd64 architecture (until more binaries are built upstream) + * currently ony supports the following architectures: amd64, arm64, arm7 * ssb rooms work best when the app is in public mode. ssb-room has its own user and authentication system, and doesn't need yunohost SSO ## Documentation and resources -* Official app website: https://github.com/ssb-ngi-pointer/go-ssb-room -* Official user documentation: https://github.com/ssb-ngi-pointer/go-ssb-room/blob/master/README.md -* Official admin documentation: https://github.com/ssb-ngi-pointer/go-ssb-room/blob/master/README.md -* Upstream app code repository: https://github.com/ssb-ngi-pointer/go-ssb-room -* YunoHost documentation for this app: https://yunohost.org/app_ssbroom -* Report a bug: https://github.com/YunoHost-Apps/ssbroom_ynh/issues +* Official app website: +* Official user documentation: +* Official admin documentation: +* Upstream app code repository: +* YunoHost documentation for this app: +* Report a bug: ## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/ssbroom_ynh/tree/testing). To try the testing branch, please proceed like that. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/ssbroom_ynh/tree/testing --debug or sudo yunohost app upgrade ssbroom -u https://github.com/YunoHost-Apps/ssbroom_ynh/tree/testing --debug ``` -**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file +**More info regarding app packaging:** diff --git a/README_fr.md b/README_fr.md index 9e734c0..32811da 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,10 +1,14 @@ + + # Scuttlebutt Room pour YunoHost -[![Niveau d'intégration](https://dash.yunohost.org/integration/ssbroom.svg)](https://dash.yunohost.org/appci/app/ssbroom) ![](https://ci-apps.yunohost.org/ci/badges/ssbroom.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/ssbroom.maintain.svg) +[![Niveau d'intégration](https://dash.yunohost.org/integration/ssbroom.svg)](https://dash.yunohost.org/appci/app/ssbroom) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/ssbroom.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/ssbroom.maintain.svg) [![Installer Scuttlebutt Room avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=ssbroom) *[Read this readme in english.](./README.md)* -*[Lire ce readme en français.](./README_fr.md)* > *Ce package vous permet d'installer Scuttlebutt Room rapidement et simplement sur un serveur YunoHost. Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* @@ -26,37 +30,38 @@ For a comprehensive introduction to rooms 2.0, watch [this video](https://www.yo - HTTP Invites - Alias management -**Version incluse :** 2.0.6~ynh1 +**Version incluse :** 2.0.6~ynh4 **Démo :** https://hermies.club/ ## Captures d'écran -![](./doc/screenshots/ssbroom-screenshot.png) +![Capture d'écran de Scuttlebutt Room](./doc/screenshots/ssbroom-screenshot.png) ## Avertissements / informations importantes * requires a full dedicated domain and does not support sub-paths - * currently ony supported on amd64 architecture (until more binaries are built upstream) + * currently ony supports the following architectures: amd64, arm64, arm7 * ssb rooms work best when the app is in public mode. ssb-room has its own user and authentication system, and doesn't need yunohost SSO ## Documentations et ressources -* Site officiel de l'app : https://github.com/ssb-ngi-pointer/go-ssb-room -* Documentation officielle utilisateur : https://github.com/ssb-ngi-pointer/go-ssb-room/blob/master/README.md -* Documentation officielle de l'admin : https://github.com/ssb-ngi-pointer/go-ssb-room/blob/master/README.md -* Dépôt de code officiel de l'app : https://github.com/ssb-ngi-pointer/go-ssb-room -* Documentation YunoHost pour cette app : https://yunohost.org/app_ssbroom -* Signaler un bug : https://github.com/YunoHost-Apps/ssbroom_ynh/issues +* Site officiel de l'app : +* Documentation officielle utilisateur : +* Documentation officielle de l'admin : +* Dépôt de code officiel de l'app : +* Documentation YunoHost pour cette app : +* Signaler un bug : ## Informations pour les développeurs Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/ssbroom_ynh/tree/testing). Pour essayer la branche testing, procédez comme suit. -``` + +``` bash sudo yunohost app install https://github.com/YunoHost-Apps/ssbroom_ynh/tree/testing --debug ou sudo yunohost app upgrade ssbroom -u https://github.com/YunoHost-Apps/ssbroom_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file +**Plus d'infos sur le packaging d'applications :** diff --git a/check_process b/check_process index fefa192..2736616 100644 --- a/check_process +++ b/check_process @@ -1,26 +1,19 @@ -# See here for more information -# https://github.com/YunoHost/package_check#syntax-check_process-file - -# Move this file from check_process.default to check_process when you have filled it. - ;; Test complet ; Manifest domain="domain.tld" - path="/path" - admin="john" - language="fr" is_public=1 + ssb_admin_id="@5Pt3dKy2HTJ0mWuS78oIiklIX0gBz6BTfEnXsbvke9c=.ed25519" password="1Strong-Password" - port="666" ; Checks pkg_linter=1 - setup_sub_dir=1 + setup_sub_dir=0 setup_root=1 setup_nourl=0 setup_private=1 setup_public=1 upgrade=1 - upgrade=1 from_commit=CommitHash + # 2.0.6~ynh3 + upgrade=1 from_commit=c759c5f400660031676a0f92d5c5ffcc68bd6da9 backup_restore=1 multi_instance=1 port_already_use=0 @@ -28,7 +21,3 @@ ;;; Options Email= Notification=none -;;; Upgrade options - ; commit=CommitHash - name=Name and date of the commit. - manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666& diff --git a/compile_binaries/cross_compile_ssbroom.py b/compile_binaries/cross_compile_ssbroom.py new file mode 100644 index 0000000..ae81b06 --- /dev/null +++ b/compile_binaries/cross_compile_ssbroom.py @@ -0,0 +1,80 @@ +""" +script to cross-compile go-ssb-room for arm64 and other architectures + +before running, run: +- sudo apt install gcc-aarch64-linux-gnu +- sudo apt install gcc-arm-linux-gnueabi + +""" +import subprocess +import os + +# path to project directory +PROJECT_PATH = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) +WORKING_DIR = "/srv/build_ssbroom" +GIT_URL = "https://github.com/ssb-ngi-pointer/go-ssb-room.git" +OUTPUT_DIR = "/srv/files.commoninternet.net" + + +def pull_repo(): + if not os.path.exists(WORKING_DIR): + subprocess.check_call(["git", "clone", GIT_URL, WORKING_DIR]) + else: + subprocess.check_call(["git", "pull"], cwd=WORKING_DIR) + + +def crosscompile_go_ssb_room_for_arm64(): + subprocess.check_call(["git", "pull"], cwd=WORKING_DIR) + print("[CROSS-COMPILING go-ssb-room/server]") + subprocess.check_call(["env", "CGO_ENABLED=1", "CC=aarch64-linux-gnu-gcc", + "CC_FOR_TARGET=gcc-aarch64-linux-gnu", "GOOS=linux", + "GOARCH=arm64", "go", "build", "./cmd/server"], cwd=WORKING_DIR) + print("[CROSS-COMPILING go-ssb-room/insert-user]") + subprocess.check_call(["env", "CGO_ENABLED=1", "CC=aarch64-linux-gnu-gcc", + "CC_FOR_TARGET=gcc-aarch64-linux-gnu", "GOOS=linux", + "GOARCH=arm64", "go", "build", "./cmd/insert-user"], cwd=WORKING_DIR) + publish(architecture="aarch64") + + +def crosscompile_go_ssb_room_for_arm7(): + subprocess.check_call(["git", "pull"], cwd=WORKING_DIR) + print("[CROSS-COMPILING for arm7 go-ssb-room/server]") + subprocess.check_call(["env", "CGO_ENABLED=1", "CC=arm-linux-gnueabi-gcc", + "GOOS=linux", + "GOARCH=arm", "GOARM=7", "go", "build", "./cmd/server"], cwd=WORKING_DIR) + print("[CROSS-COMPILING for arm7 go-ssb-room/insert-user]") + subprocess.check_call(["env", "CGO_ENABLED=1", "CC=arm-linux-gnueabi-gcc", + "GOOS=linux", + "GOARCH=arm", "GOARM=7", "go", "build", "./cmd/insert-user"], cwd=WORKING_DIR) + publish(architecture="arm7") + + +def compile_go_ssb_room(): + subprocess.check_call(["git", "pull"], cwd=WORKING_DIR) + print("[COMPILING go-ssb-room/server for amd64]") + subprocess.check_call(["go", "build", "./cmd/server"], cwd=WORKING_DIR) + print("[COMPILING go-ssb-room/insert-user for amd64]") + subprocess.check_call(["go", "build", "./cmd/insert-user"], cwd=WORKING_DIR) + publish(architecture="amd64") + + +def publish(architecture): + subprocess.check_call(["mkdir", "-p", OUTPUT_DIR]) + binaries = ["insert-user", "server"] + output_folder_name = "go-ssb-room_2.0.6_Linux_{}".format(architecture) + output_folder_path = os.path.join(OUTPUT_DIR, output_folder_name) + subprocess.check_call(["mkdir", "-p", output_folder_path]) + for binary in binaries: + f_path = os.path.join(WORKING_DIR, binary) + output_path = os.path.join(output_folder_path, binary) + subprocess.check_call(["cp", f_path, output_path]) + # create a tar + tar_path = output_folder_path + ".tar.gz" + subprocess.check_call(["tar", "-czvf", tar_path, "-C", output_folder_path, "."]) + + +if __name__ == '__main__': + pull_repo() + crosscompile_go_ssb_room_for_arm64() + crosscompile_go_ssb_room_for_arm7() + compile_go_ssb_room() diff --git a/conf/amd64.src b/conf/amd64.src index 40dae93..f80fcc2 100644 --- a/conf/amd64.src +++ b/conf/amd64.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://files.commoninternet.net/go-ssb-room_2.0.6_Linux_x86_64.tar.gz -SOURCE_SUM=7823838a42daac48c39f13563552b84920d66e782acf239d1da5fbd3b475c5bf +SOURCE_URL=https://files.commoninternet.net/go-ssb-room_2.0.6_Linux_amd64.tar.gz +SOURCE_SUM=1a1c4368df219e907e15996bd6d62b653f54017993b1cc607ab09a9a01fb8558 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/arm64.src b/conf/arm64.src new file mode 100644 index 0000000..606d438 --- /dev/null +++ b/conf/arm64.src @@ -0,0 +1,7 @@ +SOURCE_URL=https://files.commoninternet.net/go-ssb-room_2.0.6_Linux_aarch64.tar.gz +SOURCE_SUM=8f9d357d54fd8bdc1c2e906919ddefef21ae51b13e5ae1939424c6c1e94c9d23 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= +SOURCE_EXTRACT=true diff --git a/conf/arm7.src b/conf/arm7.src new file mode 100644 index 0000000..d648c9d --- /dev/null +++ b/conf/arm7.src @@ -0,0 +1,7 @@ +SOURCE_URL=https://files.commoninternet.net/go-ssb-room_2.0.6_Linux_arm7.tar.gz +SOURCE_SUM=8894b7b21031976e1d79265fefdcef4edb6fde38f34231e8aea4cebcc85a4f88 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= +SOURCE_EXTRACT=true diff --git a/conf/nginx.conf b/conf/nginx.conf index da0252d..a0b8a31 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,10 +1,6 @@ +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - # Force usage of https - if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; - } - proxy_set_header Accept-Encoding ""; try_files $uri @proxy; diff --git a/conf/systemd.service b/conf/systemd.service index 3f55017..8973d36 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,8 +6,8 @@ After=network.target Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__DATADIR__/ -ExecStart=__FINALPATH__/go-ssb-room -repo __DATADIR__/ -lishttp localhost:__PORT__ -https-domain __DOMAIN__ -lismux :__SSBPORT__ -aliases-as-subdomains false +WorkingDirectory=__FINALPATH__/ +ExecStart=__FINALPATH__/server -repo __DATADIR__/ -lishttp localhost:__PORT__ -https-domain __DOMAIN__ -lismux :__SSBPORT__ -aliases-as-subdomains false StandardOutput=append:/var/log/__APP__/__APP__.log StandardError=inherit diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index a80e63e..a05a19f 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -1,3 +1,3 @@ * requires a full dedicated domain and does not support sub-paths - * currently ony supported on amd64 architecture (until more binaries are built upstream) + * currently ony supports the following architectures: amd64, arm64, arm7 * ssb rooms work best when the app is in public mode. ssb-room has its own user and authentication system, and doesn't need yunohost SSO \ No newline at end of file diff --git a/manifest.json b/manifest.json index 1645ac3..26185ee 100644 --- a/manifest.json +++ b/manifest.json @@ -5,7 +5,7 @@ "description": { "en": "Secure Scuttlebutt room server implemented in Go" }, - "version": "2.0.6~ynh1", + "version": "2.0.6~ynh4", "url": "https://github.com/ssb-ngi-pointer/go-ssb-room", "upstream": { "license": "free", @@ -21,18 +21,25 @@ "email": "max@mfowler.info" }, "requirements": { - "yunohost": ">= 4.1.7" + "yunohost": ">= 4.3.0" }, "multi_instance": true, "services": [ "nginx" ], "arguments": { - "install" : [ + "install": [ { "name": "domain", - "type": "domain", - "example": "example.com" + "type": "domain" + }, + { + "name": "is_public", + "type": "boolean", + "default": true, + "help": { + "en": "If false, ssbroom will only be usable by yunohost users." + } }, { "name": "ssb_admin_id", @@ -45,14 +52,6 @@ }, "example": "@5Pt3dKy2HTJ0mWuS78oIiklIX0gBz6BTfEnXsbvke9c=.ed25519" }, - { - "name": "is_public", - "type": "boolean", - "default": true, - "help": { - "en": "If false, ssbroom will only be usable by yunohost users." - } - }, { "name": "password", "type": "password", diff --git a/scripts/_common.sh b/scripts/_common.sh index 24254a6..e3a9683 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -20,22 +20,3 @@ description="Secure Scuttlebutt room server implemented in Go" #================================================= # FUTURE OFFICIAL HELPERS #================================================= - - -ynh_detect_arch(){ - local architecture - if [ -n "$(uname -m | grep arm64)" ] || [ -n "$(uname -m | grep aarch64)" ]; then - architecture="arm64" - elif [ -n "$(uname -m | grep 64)" ]; then - architecture="amd64" - elif [ -n "$(uname -m | grep 86)" ]; then - architecture="386" - elif [ -n "$(uname -m | grep armv7)" ]; then - architecture="arm7" - elif [ -n "$(uname -m | grep armv6)" ]; then - architecture="arm6" - else - architecture="unknown" - fi - echo $architecture -} \ No newline at end of file diff --git a/scripts/backup b/scripts/backup index 01326c1..67278fd 100755 --- a/scripts/backup +++ b/scripts/backup @@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script @@ -37,11 +36,6 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= ynh_print_info --message="Declaring files to be backed up..." -### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs -### to be backuped and not an actual copy of any file. The actual backup that -### creates and fill the archive with the files happens in the core after this -### script is called. Hence ynh_backups calls takes basically 0 seconds to run. - #================================================= # BACKUP THE APP MAIN DIR #================================================= diff --git a/scripts/change_url b/scripts/change_url index a5c36d2..f6b8b78 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -37,6 +37,7 @@ ynh_script_progression --message="Backing up the app before changing its URL (ma # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { + ynh_clean_check_starting # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" @@ -98,6 +99,9 @@ then mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf # Store file checksum for the new config file location ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" + # replace domain in systemd service file + ynh_replace_string --match_string=$old_domain --replace_string=$new_domain --target_file=/etc/systemd/system/$app.service + systemctl daemon-reload fi #================================================= @@ -107,7 +111,7 @@ fi #================================================= 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" +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="event=serving" #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index a22a1b1..74411c8 100755 --- a/scripts/install +++ b/scripts/install @@ -14,8 +14,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. - true + ynh_clean_check_starting } # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -27,11 +26,9 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url="/" is_public=$YNH_APP_ARG_IS_PUBLIC -#ssb_admin_id=$YNH_APP_ARG_SSB_ADMIN_ID -# workaround for CI test -ssb_admin_id="@5Pt3dKy2HTJ0mWuS78oIiklIX0gBz6BTfEnXsbvke9c=.ed25519" +ssb_admin_id=$YNH_APP_ARG_SSB_ADMIN_ID password=$YNH_APP_ARG_PASSWORD -architecture=$(ynh_detect_arch) + app=$YNH_APP_INSTANCE_NAME #================================================= @@ -95,9 +92,8 @@ ynh_script_progression --message="Setting up source files..." --weight=1 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" --source_id="$architecture" +ynh_setup_source --dest_dir="$final_path" --source_id="$YNH_ARCH" -# permissions chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" @@ -107,7 +103,7 @@ chown -R $app:www-data "$final_path" #================================================= ynh_script_progression --message="Configuring NGINX web server..." --weight=1 -# add nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -120,7 +116,6 @@ ynh_app_setting_set --app=$app --key=datadir --value=$datadir mkdir -p $datadir -# permissions chmod 750 "$datadir" chmod -R o-rwx "$datadir" chown -R $app:www-data "$datadir" @@ -129,6 +124,7 @@ chown -R $app:www-data "$datadir" # CREATE FIRST ADMIN USER #================================================= ynh_script_progression --message="Creating first ssbroom admin user" --weight=1 + ynh_exec_as $app /usr/bin/expect<