From 934aa739d524ebaccebbfa8557809dd529ae393b Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Tue, 12 Oct 2021 11:38:38 +0000 Subject: [PATCH 1/7] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 82b0fda..35d0b55 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ 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~ynh2 **Demo:** https://hermies.club/ diff --git a/README_fr.md b/README_fr.md index 9e734c0..768c6f4 100644 --- a/README_fr.md +++ b/README_fr.md @@ -26,7 +26,7 @@ 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~ynh2 **Démo :** https://hermies.club/ From 62720d41781cd1bd80725f717391e7d0d3f15e07 Mon Sep 17 00:00:00 2001 From: mhfowler Date: Mon, 18 Oct 2021 18:02:47 +0200 Subject: [PATCH 2/7] Add support for arm64 --- compile_binaries/cross_compile_ssbroom.py | 64 +++++++++++++++++++++++ conf/amd64.src | 4 +- conf/arm64.src | 7 +++ manifest.json | 2 +- 4 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 compile_binaries/cross_compile_ssbroom.py create mode 100644 conf/arm64.src diff --git a/compile_binaries/cross_compile_ssbroom.py b/compile_binaries/cross_compile_ssbroom.py new file mode 100644 index 0000000..d51a57f --- /dev/null +++ b/compile_binaries/cross_compile_ssbroom.py @@ -0,0 +1,64 @@ +""" +script to cross-compile go-ssb-room for arm64 and other architectures + +before running, run: +- sudo apt install gcc-aarch64-linux-gnu + +""" +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(): + 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 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, output_folder_path]) + + +if __name__ == '__main__': + pull_repo() + crosscompile_go_ssb_room() + compile_go_ssb_room() diff --git a/conf/amd64.src b/conf/amd64.src index 40dae93..43efee3 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=b03a3b9c440f0946e403618f5e9c2b65cf4fe3a31a282f877d5cf6dff2f18043 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..8eaf127 --- /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=39dee2ccaa3cc3cfb696dd86e39ae2cfae4565c9862935bd7a815869089a0bd2 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=tar.gz +SOURCE_IN_SUBDIR=true +SOURCE_FILENAME= +SOURCE_EXTRACT=true diff --git a/manifest.json b/manifest.json index 1598135..4399451 100644 --- a/manifest.json +++ b/manifest.json @@ -5,7 +5,7 @@ "description": { "en": "Secure Scuttlebutt room server implemented in Go" }, - "version": "2.0.6~ynh2", + "version": "2.0.6~ynh3", "url": "https://github.com/ssb-ngi-pointer/go-ssb-room", "upstream": { "license": "free", From 8493f23e70ddc83d9d0937e2c56fea29690e7e40 Mon Sep 17 00:00:00 2001 From: mhfowler Date: Mon, 18 Oct 2021 18:19:04 +0200 Subject: [PATCH 3/7] Fix arm64 --- compile_binaries/cross_compile_ssbroom.py | 2 +- conf/amd64.src | 2 +- conf/arm64.src | 2 +- conf/systemd.service | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/compile_binaries/cross_compile_ssbroom.py b/compile_binaries/cross_compile_ssbroom.py index d51a57f..584d1e0 100644 --- a/compile_binaries/cross_compile_ssbroom.py +++ b/compile_binaries/cross_compile_ssbroom.py @@ -55,7 +55,7 @@ def publish(architecture): 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, output_folder_path]) + subprocess.check_call(["tar", "-czvf", tar_path, "-C", output_folder_path, "."]) if __name__ == '__main__': diff --git a/conf/amd64.src b/conf/amd64.src index 43efee3..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_amd64.tar.gz -SOURCE_SUM=b03a3b9c440f0946e403618f5e9c2b65cf4fe3a31a282f877d5cf6dff2f18043 +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 index 8eaf127..606d438 100644 --- a/conf/arm64.src +++ b/conf/arm64.src @@ -1,5 +1,5 @@ SOURCE_URL=https://files.commoninternet.net/go-ssb-room_2.0.6_Linux_aarch64.tar.gz -SOURCE_SUM=39dee2ccaa3cc3cfb696dd86e39ae2cfae4565c9862935bd7a815869089a0bd2 +SOURCE_SUM=8f9d357d54fd8bdc1c2e906919ddefef21ae51b13e5ae1939424c6c1e94c9d23 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/systemd.service b/conf/systemd.service index 3f55017..08eb433 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,7 +7,7 @@ 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 +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 From a94d5cc0b530e8f1e4aecf2ca002f91d5614d32f Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Mon, 18 Oct 2021 16:24:14 +0000 Subject: [PATCH 4/7] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 35d0b55..1bcea76 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ For a comprehensive introduction to rooms 2.0, watch [this video](https://www.yo - HTTP Invites - Alias management -**Shipped version:** 2.0.6~ynh2 +**Shipped version:** 2.0.6~ynh3 **Demo:** https://hermies.club/ diff --git a/README_fr.md b/README_fr.md index 768c6f4..9555b6e 100644 --- a/README_fr.md +++ b/README_fr.md @@ -26,7 +26,7 @@ For a comprehensive introduction to rooms 2.0, watch [this video](https://www.yo - HTTP Invites - Alias management -**Version incluse :** 2.0.6~ynh2 +**Version incluse :** 2.0.6~ynh3 **Démo :** https://hermies.club/ From 12df0060455e33458a37b7da6376506ce87e0513 Mon Sep 17 00:00:00 2001 From: mhfowler Date: Tue, 19 Oct 2021 12:53:28 +0200 Subject: [PATCH 5/7] Add arm7 architecture support --- README.md | 2 +- compile_binaries/cross_compile_ssbroom.py | 18 ++++++++++++++++-- conf/arm7.src | 7 +++++++ conf/systemd.service | 2 +- doc/DISCLAIMER.md | 2 +- scripts/install | 9 +++++++++ 6 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 conf/arm7.src diff --git a/README.md b/README.md index 35d0b55..653a72a 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ For a comprehensive introduction to rooms 2.0, watch [this video](https://www.yo ## 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 diff --git a/compile_binaries/cross_compile_ssbroom.py b/compile_binaries/cross_compile_ssbroom.py index 584d1e0..0093f4f 100644 --- a/compile_binaries/cross_compile_ssbroom.py +++ b/compile_binaries/cross_compile_ssbroom.py @@ -3,6 +3,7 @@ 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 @@ -34,6 +35,18 @@ def crosscompile_go_ssb_room(): "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]") @@ -60,5 +73,6 @@ def publish(architecture): if __name__ == '__main__': pull_repo() - crosscompile_go_ssb_room() - compile_go_ssb_room() + # crosscompile_go_ssb_room() + crosscompile_go_ssb_room_for_arm7() + # compile_go_ssb_room() 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/systemd.service b/conf/systemd.service index 08eb433..2456797 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,7 +6,7 @@ After=network.target Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__DATADIR__/ +WorkingDirectory=__DATADIR__ 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/scripts/install b/scripts/install index e3b69d2..6814af3 100755 --- a/scripts/install +++ b/scripts/install @@ -147,6 +147,15 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1 # Create a dedicated systemd config ynh_add_systemd_config +# for yunohost version < 4.2, this is a workaround to replace string variables +ynh_script_progression --message="String replacing systemd service with $datadir" --weight=1 +systemd_file="/etc/systemd/system/$app.service" +ynh_replace_string --match_string=__DATADIR__ --replace_string=$datadir --target_file=$systemd_file +ynh_replace_string --match_string=__PORT__ --replace_string=$port --target_file=$systemd_file +ynh_replace_string --match_string=__DOMAIN__ --replace_string=$domain --target_file=$systemd_file +ynh_replace_string --match_string=__SSBPORT__ --replace_string=$ssbport --target_file=$systemd_file +systemctl daemon-reload + #================================================= # GENERIC FINALIZATION #================================================= From 40a3d3b2133ca0253e077b2af7ac48d2e91a6a88 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Tue, 19 Oct 2021 10:54:03 +0000 Subject: [PATCH 6/7] Auto-update README --- README_fr.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README_fr.md b/README_fr.md index 9555b6e..cf614b4 100644 --- a/README_fr.md +++ b/README_fr.md @@ -37,7 +37,7 @@ For a comprehensive introduction to rooms 2.0, watch [this video](https://www.yo ## 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 From 9a5a847b61a2da7b4fc43bd025842105f9887886 Mon Sep 17 00:00:00 2001 From: mhfowler Date: Tue, 19 Oct 2021 12:57:07 +0200 Subject: [PATCH 7/7] Clean-up python script --- compile_binaries/cross_compile_ssbroom.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/compile_binaries/cross_compile_ssbroom.py b/compile_binaries/cross_compile_ssbroom.py index 0093f4f..ae81b06 100644 --- a/compile_binaries/cross_compile_ssbroom.py +++ b/compile_binaries/cross_compile_ssbroom.py @@ -23,7 +23,7 @@ def pull_repo(): subprocess.check_call(["git", "pull"], cwd=WORKING_DIR) -def crosscompile_go_ssb_room(): +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", @@ -35,6 +35,7 @@ def crosscompile_go_ssb_room(): "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]") @@ -47,6 +48,7 @@ def crosscompile_go_ssb_room_for_arm7(): "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]") @@ -73,6 +75,6 @@ def publish(architecture): if __name__ == '__main__': pull_repo() - # crosscompile_go_ssb_room() + crosscompile_go_ssb_room_for_arm64() crosscompile_go_ssb_room_for_arm7() - # compile_go_ssb_room() + compile_go_ssb_room()