mirror of
https://github.com/YunoHost-Apps/turtl_ynh.git
synced 2024-09-03 20:26:35 +02:00
commit
9622ba2418
11 changed files with 50 additions and 90 deletions
|
@ -47,7 +47,7 @@ Turtl is a free online service that allows you to create, synchronize and find y
|
|||
|
||||
## Documentation and resources
|
||||
|
||||
* Official app website: https://turtlapp.com/
|
||||
* Official app website: https://turtlapp.com
|
||||
* Official admin documentation: https://turtlapp.com/docs/
|
||||
* Upstream app code repository: https://github.com/turtl/server
|
||||
* YunoHost documentation for this app: https://yunohost.org/app_turtl
|
||||
|
|
|
@ -43,7 +43,7 @@ Turtl is a free online service that allows you to create, synchronize and find y
|
|||
|
||||
## Documentations et ressources
|
||||
|
||||
* Site officiel de l'app : https://turtlapp.com/
|
||||
* Site officiel de l'app : https://turtlapp.com
|
||||
* Documentation officielle de l'admin : https://turtlapp.com/docs/
|
||||
* Dépôt de code officiel de l'app : https://github.com/turtl/server
|
||||
* Documentation YunoHost pour cette app : https://yunohost.org/app_turtl
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld"
|
||||
path="/path"
|
||||
is_public=1
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
|
@ -14,6 +13,7 @@
|
|||
#upgrade=1 from_commit=CommitHash
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
port_already_use=0
|
||||
change_url=0
|
||||
;;; Options
|
||||
Email=
|
||||
|
@ -21,4 +21,3 @@ 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&
|
||||
|
|
7
conf/app.src
Normal file
7
conf/app.src
Normal file
|
@ -0,0 +1,7 @@
|
|||
SOURCE_URL=https://codeload.github.com/turtl/server/tar.gz/0e59ee0a47fc5937600999d14ceb1aca6392aec8
|
||||
SOURCE_SUM=be1482756fed2fc80dd8592049c2282727439c883eae732844a6e30856eb55da
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
SOURCE_EXTRACT=true
|
|
@ -8,7 +8,7 @@ Type=simple
|
|||
User=__APP__
|
||||
Group=__APP__
|
||||
WorkingDirectory=__FINALPATH__/
|
||||
Environment="PATH=__ENV_PATH__"
|
||||
Environment="PATH=__PATH__"
|
||||
ExecStart=__YNH_NODE__ __FINALPATH__/server.js
|
||||
StandardOutput=syslog
|
||||
StandardError=syslog
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
"fr": "Partagez des notes, des marque-pages et autre documents pour des projets sensibles"
|
||||
},
|
||||
"version": "1.0~ynh1",
|
||||
"url": "https://turtlapp.com/",
|
||||
"url": "https://turtlapp.com",
|
||||
"upstream": {
|
||||
"license": "MIT",
|
||||
"website": "https://turtlapp.com/",
|
||||
"website": "https://turtlapp.com",
|
||||
"admindoc": "https://turtlapp.com/docs/",
|
||||
"code": "https://github.com/turtl/server"
|
||||
},
|
||||
|
@ -21,14 +21,14 @@
|
|||
"url": "https://framasoft.org"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">> 4.3.0"
|
||||
"yunohost": ">= 4.3.0"
|
||||
},
|
||||
"multi_instance": false,
|
||||
"services": [
|
||||
"turtl"
|
||||
"nginx"
|
||||
],
|
||||
"arguments": {
|
||||
"install" : [
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain"
|
||||
|
@ -36,10 +36,6 @@
|
|||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Is it a public server? (should we announce it?)",
|
||||
"fr": "Est-ce un serveur public ? (devons-nous l'annoncer ?)"
|
||||
},
|
||||
"default": true
|
||||
}
|
||||
]
|
||||
|
|
|
@ -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
|
||||
|
@ -58,12 +57,6 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
|
||||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
#=================================================
|
||||
# BACKUP LOGROTATE
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# BACKUP SYSTEMD
|
||||
#=================================================
|
||||
|
|
|
@ -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,6 +26,7 @@ ynh_abort_if_errors
|
|||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url="/"
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
|
||||
hash=$(ynh_string_random --length=128)
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
@ -65,7 +65,6 @@ ynh_app_setting_set --app=$app --key=port --value=$port
|
|||
ynh_script_progression --message="Installing dependencies..." --weight=20
|
||||
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
# Install Nodejs
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
||||
#=================================================
|
||||
|
@ -85,7 +84,7 @@ db_name=$(ynh_sanitize_dbid --db_name=$app)
|
|||
db_user=$db_name
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_setup_db --db_user=$db_name --db_name=$db_name
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -93,7 +92,8 @@ ynh_psql_setup_db --db_user=$db_name --db_name=$db_name
|
|||
ynh_script_progression --message="Setting up source files..." --weight=3
|
||||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
git clone https://github.com/turtl/server "$final_path" --quiet
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
|
||||
mkdir -p $final_path/plugins
|
||||
|
||||
|
@ -115,9 +115,9 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
# ...
|
||||
# BUILD TURTLE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Building $app... (this will take some time and resources!)" --weight=20
|
||||
ynh_script_progression --message="Building turtl... (this will take some time and resources!)" --weight=20
|
||||
|
||||
pushd $final_path
|
||||
ynh_use_nodejs
|
||||
|
@ -153,26 +153,17 @@ chown $app:$app "$final_path/config/config.yaml"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Configuring a systemd service..." --weight=2
|
||||
|
||||
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring log rotation..." --weight=4
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
ynh_use_logrotate
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
|
||||
yunohost service add $app --description="Share notes, bookmarks, and documents" --log="/var/log/$app/$app.log"
|
||||
yunohost service add $app --description="Share notes, bookmarks, and documents"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
|
@ -180,7 +171,7 @@ yunohost service add $app --description="Share notes, bookmarks, and documents"
|
|||
ynh_script_progression --message="Starting a systemd service..." --weight=5
|
||||
|
||||
# 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=systemd --line_match="Listening for turtls on IP"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
|
@ -190,7 +181,9 @@ ynh_script_progression --message="Configuring permissions..." --weight=1
|
|||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
then
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
# Everyone can access the app.
|
||||
# The "main" permission is automatically created before the install script.
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -17,10 +17,10 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
|||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
|
@ -43,14 +43,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
|
|||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
|
||||
|
||||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
|
@ -59,14 +51,6 @@ ynh_script_progression --message="Removing the PostgreSQL database..." --weight=
|
|||
# Remove a database if it exists, along with the associated user
|
||||
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=3
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
|
@ -94,6 +78,14 @@ 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=3
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
|
@ -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
|
||||
|
@ -33,7 +32,6 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
|
@ -41,7 +39,8 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||
|
||||
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
|
@ -92,7 +91,6 @@ chown -R $app:www-data "$datadir"
|
|||
ynh_script_progression --message="Reinstalling dependencies..." --weight=20
|
||||
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
# Install Nodejs
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
||||
#=================================================
|
||||
|
@ -101,6 +99,7 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
|||
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6
|
||||
|
||||
ynh_psql_test_if_first_run
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
|
||||
|
||||
|
@ -112,26 +111,19 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig
|
|||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||
systemctl enable $app.service --quiet
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
|
||||
yunohost service add $app --description="Share notes, bookmarks, and documents" --log="/var/log/$app/$app.log"
|
||||
yunohost service add $app --description="Share notes, bookmarks, and documents"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=5
|
||||
|
||||
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=systemd --line_match="Listening for turtls on IP"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
|
@ -27,6 +27,7 @@ port=$(ynh_app_setting_get --app=$app --key=port)
|
|||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Checking version..."
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
|
@ -38,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
|
||||
}
|
||||
|
@ -51,7 +53,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped Turtl Server"
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
|
@ -81,12 +83,8 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
|
|||
then
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=2
|
||||
|
||||
pushd $final_path
|
||||
git fetch
|
||||
#git checkout master
|
||||
git reset --hard --quiet $version_commit
|
||||
git pull
|
||||
popd
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
fi
|
||||
|
||||
chmod 750 "$final_path"
|
||||
|
@ -107,7 +105,6 @@ ynh_add_nginx_config
|
|||
ynh_script_progression --message="Upgrading dependencies..." --weight=20
|
||||
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
# Install Nodejs
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
||||
#=================================================
|
||||
|
@ -115,33 +112,24 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
|||
#=================================================
|
||||
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
|
||||
|
||||
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
|
||||
|
||||
# Use logrotate to manage app-specific logfile(s)
|
||||
ynh_use_logrotate --non-append
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
|
||||
yunohost service add $app --description="Share notes, bookmarks, and documents" --log="/var/log/$app/$app.log"
|
||||
yunohost service add $app --description="Share notes, bookmarks, and documents"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=5
|
||||
|
||||
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=systemd --line_match="Listening for turtls on IP"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
Loading…
Reference in a new issue