mirror of
https://github.com/YunoHost-Apps/codimd_ynh.git
synced 2024-09-03 18:16:32 +02:00
various changes
This commit is contained in:
parent
510b61b407
commit
1c97a6d361
12 changed files with 32 additions and 73 deletions
|
@ -5,7 +5,7 @@
|
|||
|
||||
*[Read this readme in english.](./README.md)*
|
||||
|
||||
> *Ce package vous permet d'installer CodiMD rapidement et simplement sur un serveur Yunohost.
|
||||
> *Ce package vous permet d'installer CodiMD rapidement et simplement sur un serveur YunoHost.
|
||||
Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.*
|
||||
|
||||
## Vue d'ensemble
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
backup_restore=1
|
||||
multi_instance=1
|
||||
port_already_use=0
|
||||
change_url=0
|
||||
change_url=1
|
||||
;;; Levels
|
||||
Level 5=auto
|
||||
;;; Options
|
||||
|
|
|
@ -3,10 +3,16 @@
|
|||
"protocolUseSSL": true,
|
||||
"domain": "__DOMAIN__",
|
||||
"port": "__PORT__",
|
||||
"sessionSecret": "__SESSION__",
|
||||
"loglevel": "info",
|
||||
"useCDN": false,
|
||||
"allowGravatar": false,
|
||||
"allowFreeURL": false,
|
||||
"allowAnonymousEdits": true,
|
||||
"defaultPermission": "locked",
|
||||
"email": true,
|
||||
"allowEmailRegister": true,
|
||||
"imageUploadType": "filesystem",
|
||||
"hsts": {
|
||||
"enable": true,
|
||||
"maxAgeSeconds": 31536000,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
[Unit]
|
||||
Description=__APP__: collaborative Markdown notes
|
||||
After=network.target
|
||||
After=postgresql.service
|
||||
Description=CodiMD: collaborative Markdown notes
|
||||
Documentation=https://github.com/codimd/server
|
||||
After=network.target postgresql.service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
@ -10,7 +10,7 @@ Group=__APP__
|
|||
WorkingDirectory=__FINALPATH__
|
||||
Environment="PATH=__ENV_PATH__"
|
||||
Environment="NODE_ENV=production"
|
||||
ExecStart=__YNH_NPM__ start
|
||||
ExecStart=__YNH_NPM__ start --production
|
||||
Restart=always
|
||||
PrivateTmp=true
|
||||
PrivateDevices=true
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"en": "Collaborative editor to work on notes written in Markdown",
|
||||
"fr": "Éditeur collaboratif pour travailler sur des notes en Markdown"
|
||||
},
|
||||
"version": "1.6.0~ynh2",
|
||||
"version": "1.6.0~ynh3",
|
||||
"url": "https://github.com/codimd/server",
|
||||
"license": "AGPL-3.0-only",
|
||||
"maintainer": {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
# dependencies used by the app
|
||||
pkg_dependencies="postgresql apt-transport-https"
|
||||
|
||||
nodejs_version=10
|
||||
nodejs_version=12
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
|
|
|
@ -49,12 +49,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
|
||||
#=================================================
|
||||
|
@ -64,7 +58,7 @@ ynh_backup --src_path="/etc/systemd/system/$app.service"
|
|||
#=================================================
|
||||
# BACKUP THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_print_info --message="Backing up the Postgresql database..."
|
||||
ynh_print_info --message="Backing up the PostgreSQL database..."
|
||||
|
||||
ynh_psql_dump_db --database="$db_name" > db.sql
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
|||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
|
|
|
@ -26,6 +26,7 @@ ynh_abort_if_errors
|
|||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url="/"
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
session=$(ynh_string_random --length=30)
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -123,7 +124,7 @@ ynh_script_progression --message="Building $app... (this will take some time and
|
|||
pushd "$final_path" || ynh_die
|
||||
|
||||
ynh_use_nodejs
|
||||
yarn install --frozen-lockfile
|
||||
bin/setup
|
||||
ynh_exec_warn_less yarn run build
|
||||
|
||||
popd || ynh_die
|
||||
|
@ -133,10 +134,9 @@ popd || ynh_die
|
|||
#=================================================
|
||||
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
||||
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../conf/systemd.service"
|
||||
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="../conf/systemd.service"
|
||||
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
|
||||
ynh_replace_string --match_string="__NODE__" --replace_string="$nodejs_path" --target_file="../conf/systemd.service"
|
||||
#ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../conf/systemd.service"
|
||||
#ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="../conf/systemd.service"
|
||||
#ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
|
||||
ynh_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service"
|
||||
|
||||
ynh_add_systemd_config
|
||||
|
@ -149,11 +149,11 @@ ynh_script_progression --message="Modifying a config file..."
|
|||
# Main config File
|
||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/config.json.example"
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/config.json.example"
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string="${path_url:1}" --target_file="../conf/config.json.example"
|
||||
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="../conf/config.json.example"
|
||||
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="../conf/config.json.example"
|
||||
ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="../conf/config.json.example"
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../conf/config.json.example"
|
||||
ynh_replace_string --match_string="__SESSION__" --replace_string="$session" --target_file="../conf/config.json.example"
|
||||
|
||||
cp ../conf/config.json.example "$final_path/config.json"
|
||||
|
||||
|
@ -178,14 +178,6 @@ ynh_script_progression --message="Securing files and directories..."
|
|||
# Set permissions to app files
|
||||
chown -R $app:$app $final_path
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring log rotation..." --weight=2
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
ynh_use_logrotate
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
|
@ -206,11 +198,12 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l
|
|||
#=================================================
|
||||
ynh_script_progression --message="Configuring SSOwat..." --weight=1
|
||||
|
||||
# Make app public if necessary
|
||||
# Make app public if necessary or protect it
|
||||
if [ $is_public -eq 1 ]
|
||||
then
|
||||
# unprotected_uris allows SSO credentials to be passed anyway.
|
||||
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
|
||||
# Everyone can access the app.
|
||||
# The "main" permission is automatically created before the install script.
|
||||
ynh_permission_update --permission "main" --add "visitors"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -77,14 +77,6 @@ ynh_script_progression --message="Removing Nginx web server configuration..." --
|
|||
# Remove the dedicated nginx config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
|
||||
|
||||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
|
@ -122,13 +122,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
|
|||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP Server listening"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=5
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
|
|
@ -21,6 +21,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|||
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
session=$(ynh_app_setting_get --app=$app --key=session)
|
||||
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
|
@ -126,7 +127,7 @@ then
|
|||
pushd "$final_path" || ynh_die
|
||||
|
||||
ynh_use_nodejs
|
||||
yarn install --frozen-lockfile
|
||||
bin/setup
|
||||
ynh_exec_warn_less yarn run build
|
||||
|
||||
popd || ynh_die
|
||||
|
@ -142,34 +143,25 @@ ynh_backup_if_checksum_is_different --file="$final_path/config.json"
|
|||
# Main config File
|
||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/config.json.example"
|
||||
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="../conf/config.json.example"
|
||||
ynh_replace_string --match_string="__PATH__" --replace_string="${path_url:1}" --target_file="../conf/config.json.example"
|
||||
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="../conf/config.json.example"
|
||||
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="../conf/config.json.example"
|
||||
ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="../conf/config.json.example"
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../conf/config.json.example"
|
||||
ynh_replace_string --match_string="__SESSION__" --replace_string="$session" --target_file="../conf/config.json.example"
|
||||
|
||||
cp ../conf/config.json.example "$final_path/config.json"
|
||||
|
||||
# Recalculate and store the checksum of the file for the next upgrade.
|
||||
ynh_store_file_checksum --file="$final_path/config.json"
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=2
|
||||
|
||||
# Use logrotate to manage app-specific logfile(s)
|
||||
ynh_use_logrotate --non-append
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring a systemd service..." --weight=2
|
||||
|
||||
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../conf/systemd.service"
|
||||
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="../conf/systemd.service"
|
||||
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
|
||||
ynh_replace_string --match_string="__NODE__" --replace_string="$nodejs_path" --target_file="../conf/systemd.service"
|
||||
#ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="../conf/systemd.service"
|
||||
#ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="../conf/systemd.service"
|
||||
#ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
|
||||
ynh_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service"
|
||||
|
||||
# Create a dedicated systemd config
|
||||
|
@ -185,18 +177,6 @@ ynh_script_progression --message="Securing files and directories..."
|
|||
# Set permissions on app files
|
||||
chown -R $app:$app $final_path
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading SSOwat configuration..." --weight=1
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
then
|
||||
# unprotected_uris allows SSO credentials to be passed anyway
|
||||
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue