1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ssbroom_ynh.git synced 2024-09-03 20:26:29 +02:00

Merge pull request #8 from YunoHost-Apps/upgrade

Upgrade
This commit is contained in:
yalh76 2022-07-02 21:40:41 +02:00 committed by GitHub
commit a1dc0c5305
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 195 additions and 186 deletions

View file

@ -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: <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>
## 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
**More info regarding app packaging:** <https://yunohost.org/packaging_apps>

View file

@ -1,10 +1,14 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# 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 : <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>
## 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
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>

View file

@ -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&

View file

@ -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()

View file

@ -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

7
conf/arm64.src Normal file
View file

@ -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

7
conf/arm7.src Normal file
View file

@ -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

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -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",

View file

@ -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
}

View file

@ -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
#=================================================

View file

@ -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

View file

@ -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<<EOF
set force_conservative 0 ;
set timeout -1
@ -172,18 +168,13 @@ yunohost service add $app --description="$description" --log="/var/log/$app/$app
ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service
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"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1
# for normal operation of the app, is_public should equal True,
# and all visitors should be able to access the /admin section, with or without SSO
# as go-ssb-room has its own authentication and user-system
# which operates outside of yunohost SSO
# Make app public if necessary
if [ $is_public -eq 1 ]
then

View file

@ -51,14 +51,6 @@ ynh_script_progression --message="Removing logrotate configuration..." --weight
# Remove the app-specific logrotate config
ynh_remove_logrotate
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
@ -70,10 +62,13 @@ ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE DATA DIR
#=================================================
ynh_script_progression --message="Removing data directory..." --weight=1
# Remove the data directory securely
ynh_secure_remove --file="$datadir"
# Remove the data directory if --purge option is used
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
then
ynh_script_progression --message="Removing app data directory..."
ynh_secure_remove --file="$datadir"
fi
#=================================================
# REMOVE NGINX CONFIGURATION
@ -83,16 +78,18 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $port$"
then
ynh_script_progression --message="Closing port $port..." --weight=1
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
if yunohost firewall list | grep -q "\- $ssbport$"
then
ynh_script_progression --message="Closing ssbport $ssbport..." --weight=1

View file

@ -15,8 +15,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
@ -44,13 +43,6 @@ test ! -d $final_path \
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
@ -66,7 +58,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight
ynh_restore_file --origin_path="$final_path"
# permissions
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
@ -80,7 +71,6 @@ ynh_restore_file --origin_path="$datadir" --not_mandatory
mkdir -p $datadir
# permissions
chmod 750 "$datadir"
chmod -R o-rwx "$datadir"
chown -R $app:www-data "$datadir"
@ -95,6 +85,13 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# OPEN SSBPORT
#=================================================
@ -130,12 +127,12 @@ yunohost service add $app --description="$description" --log="/var/log/$app/$app
#=================================================
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"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server" --weight=1

View file

@ -20,20 +20,15 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
ssb_admin_id=$(ynh_app_setting_get --app=$app --key=ssb_admin_id)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
port=$(ynh_app_setting_get --app=$app --key=port)
ssbport=$(ynh_app_setting_get --app=$app --key=ssbport)
architecture=$(ynh_detect_arch)
#=================================================
# CHECK VERSION
#=================================================
ynh_script_progression --message="Checking version..."
### This helper will compare the version of the currently installed app and the version of the upstream package.
### $upgrade_type can have 2 different values
### - UPGRADE_APP if the upstream app version has changed
### - UPGRADE_PACKAGE if only the YunoHost package has changed
### ynh_check_app_version_changed will stop the upgrade if the app is up to date.
### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do.
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
@ -44,6 +39,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_clean_check_starting
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
@ -64,27 +60,6 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
#
# N.B. : the followings setting migrations snippets are provided as *EXAMPLES*
# of what you may want to do in some cases (e.g. a setting was not defined on
# some legacy installs and you therefore want to initiaze stuff during upgrade)
#
# If db_name doesn't exist, create it
#if [ -z "$db_name" ]; then
# db_name=$(ynh_sanitize_dbid --db_name=$app)
# ynh_app_setting_set --app=$app --key=db_name --value=$db_name
#fi
# If final_path doesn't exist, create it
#if [ -z "$final_path" ]; then
# final_path=/var/www/$app
# ynh_app_setting_set --app=$app --key=final_path --value=$final_path
#fi
### If nobody installed your app before 4.1,
### then you may safely remove these lines
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
@ -109,27 +84,13 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=1
# 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"
fi
# FIXME: this should be managed by the core in the future
# Here, as a packager, you may have to tweak the ownerhsip/permissions
# such that the appropriate users (e.g. maybe www-data) can access
# files in some cases.
# But FOR THE LOVE OF GOD, do not allow r/x for "others" on the entire folder -
# this will be treated as a security issue.
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
@ -139,11 +100,15 @@ ynh_install_app_dependencies $pkg_dependencies
#=================================================
# SPECIFIC UPGRADE
#=================================================
# ...
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC UPGRADE
#=================================================
# SETUP SYSTEMD
#=================================================
@ -174,7 +139,7 @@ yunohost service add $app --description="$description" --log="/var/log/$app/$app
#=================================================
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"
#=================================================

View file

@ -1,2 +0,0 @@
*~
*.sw[op]

View file

@ -1,2 +0,0 @@
*~
*.sw[op]