mirror of
https://github.com/YunoHost-Apps/overleaf_ynh.git
synced 2024-09-03 19:56:27 +02:00
[autopatch] Automatic patch attempt for helpers 2.1
This commit is contained in:
parent
b4ec44231c
commit
612bc99d0f
21 changed files with 400 additions and 444 deletions
|
@ -10,7 +10,7 @@ WorkingDirectory=__INSTALL_DIR__/
|
||||||
EnvironmentFile=__INSTALL_DIR__/variables.env
|
EnvironmentFile=__INSTALL_DIR__/variables.env
|
||||||
Environment="CHAT_HOST=127.0.0.1"
|
Environment="CHAT_HOST=127.0.0.1"
|
||||||
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
||||||
ExecStart=__YNH_NODE__ __INSTALL_DIR__/live/services/chat/app.js
|
ExecStart=__NODEJS_DIR__/node __INSTALL_DIR__/live/services/chat/app.js
|
||||||
StandardOutput=append:/var/log/__APP__/chat.log
|
StandardOutput=append:/var/log/__APP__/chat.log
|
||||||
StandardError=inherit
|
StandardError=inherit
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
|
@ -10,7 +10,7 @@ WorkingDirectory=__INSTALL_DIR__/
|
||||||
EnvironmentFile=__INSTALL_DIR__/variables.env
|
EnvironmentFile=__INSTALL_DIR__/variables.env
|
||||||
Environment="CLSI_HOST=127.0.0.1"
|
Environment="CLSI_HOST=127.0.0.1"
|
||||||
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
||||||
ExecStart=__YNH_NODE__ __INSTALL_DIR__/live/services/clsi/app.js
|
ExecStart=__NODEJS_DIR__/node __INSTALL_DIR__/live/services/clsi/app.js
|
||||||
StandardOutput=append:/var/log/__APP__/clsi.log
|
StandardOutput=append:/var/log/__APP__/clsi.log
|
||||||
StandardError=inherit
|
StandardError=inherit
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
|
@ -10,7 +10,7 @@ WorkingDirectory=__INSTALL_DIR__/
|
||||||
EnvironmentFile=__INSTALL_DIR__/variables.env
|
EnvironmentFile=__INSTALL_DIR__/variables.env
|
||||||
Environment="CONTACTS_HOST=127.0.0.1"
|
Environment="CONTACTS_HOST=127.0.0.1"
|
||||||
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
||||||
ExecStart=__YNH_NODE__ __INSTALL_DIR__/live/services/contacts/app.js
|
ExecStart=__NODEJS_DIR__/node __INSTALL_DIR__/live/services/contacts/app.js
|
||||||
StandardOutput=append:/var/log/__APP__/contacts.log
|
StandardOutput=append:/var/log/__APP__/contacts.log
|
||||||
StandardError=inherit
|
StandardError=inherit
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
|
@ -10,7 +10,7 @@ WorkingDirectory=__INSTALL_DIR__/
|
||||||
EnvironmentFile=__INSTALL_DIR__/variables.env
|
EnvironmentFile=__INSTALL_DIR__/variables.env
|
||||||
Environment="DOCSTORE_HOST=127.0.0.1"
|
Environment="DOCSTORE_HOST=127.0.0.1"
|
||||||
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
||||||
ExecStart=__YNH_NODE__ __INSTALL_DIR__/live/services/docstore/app.js
|
ExecStart=__NODEJS_DIR__/node __INSTALL_DIR__/live/services/docstore/app.js
|
||||||
StandardOutput=append:/var/log/__APP__/docstore.log
|
StandardOutput=append:/var/log/__APP__/docstore.log
|
||||||
StandardError=inherit
|
StandardError=inherit
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
|
@ -11,7 +11,7 @@ EnvironmentFile=__INSTALL_DIR__/variables.env
|
||||||
Environment="DOCUMENT_UPDATER_HOST=127.0.0.1"
|
Environment="DOCUMENT_UPDATER_HOST=127.0.0.1"
|
||||||
Environment="DOCUPDATER_HOST=127.0.0.1"
|
Environment="DOCUPDATER_HOST=127.0.0.1"
|
||||||
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
||||||
ExecStart=__YNH_NODE__ __INSTALL_DIR__/live/services/document-updater/app.js
|
ExecStart=__NODEJS_DIR__/node __INSTALL_DIR__/live/services/document-updater/app.js
|
||||||
StandardOutput=append:/var/log/__APP__/document-updater.log
|
StandardOutput=append:/var/log/__APP__/document-updater.log
|
||||||
StandardError=inherit
|
StandardError=inherit
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
|
@ -10,7 +10,7 @@ WorkingDirectory=__INSTALL_DIR__/
|
||||||
EnvironmentFile=__INSTALL_DIR__/variables.env
|
EnvironmentFile=__INSTALL_DIR__/variables.env
|
||||||
Environment="FILESTORE_HOST=127.0.0.1"
|
Environment="FILESTORE_HOST=127.0.0.1"
|
||||||
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
||||||
ExecStart=__YNH_NODE__ __INSTALL_DIR__/live/services/filestore/app.js
|
ExecStart=__NODEJS_DIR__/node __INSTALL_DIR__/live/services/filestore/app.js
|
||||||
StandardOutput=append:/var/log/__APP__/filestore.log
|
StandardOutput=append:/var/log/__APP__/filestore.log
|
||||||
StandardError=inherit
|
StandardError=inherit
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
|
@ -11,7 +11,7 @@ EnvironmentFile=__INSTALL_DIR__/variables.env
|
||||||
Environment="HISTORY_V1_HOST=127.0.0.1"
|
Environment="HISTORY_V1_HOST=127.0.0.1"
|
||||||
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
||||||
Environment="NODE_CONFIG_DIR=__INSTALL_DIR__/live/services/history-v1/config"
|
Environment="NODE_CONFIG_DIR=__INSTALL_DIR__/live/services/history-v1/config"
|
||||||
ExecStart=__YNH_NODE__ __INSTALL_DIR__/live/services/history-v1/app.js
|
ExecStart=__NODEJS_DIR__/node __INSTALL_DIR__/live/services/history-v1/app.js
|
||||||
StandardOutput=append:/var/log/__APP__/history-v1.log
|
StandardOutput=append:/var/log/__APP__/history-v1.log
|
||||||
StandardError=inherit
|
StandardError=inherit
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
|
@ -10,7 +10,7 @@ WorkingDirectory=__INSTALL_DIR__/
|
||||||
EnvironmentFile=__INSTALL_DIR__/variables.env
|
EnvironmentFile=__INSTALL_DIR__/variables.env
|
||||||
Environment="NOTIFICATIONS_HOST=127.0.0.1"
|
Environment="NOTIFICATIONS_HOST=127.0.0.1"
|
||||||
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
||||||
ExecStart=__YNH_NODE__ __INSTALL_DIR__/live/services/notifications/app.js
|
ExecStart=__NODEJS_DIR__/node __INSTALL_DIR__/live/services/notifications/app.js
|
||||||
StandardOutput=append:/var/log/__APP__/notifications.log
|
StandardOutput=append:/var/log/__APP__/notifications.log
|
||||||
StandardError=inherit
|
StandardError=inherit
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
|
@ -10,7 +10,7 @@ WorkingDirectory=__INSTALL_DIR__/
|
||||||
EnvironmentFile=__INSTALL_DIR__/variables.env
|
EnvironmentFile=__INSTALL_DIR__/variables.env
|
||||||
Environment="PROJECT_HISTORY_HOST=127.0.0.1"
|
Environment="PROJECT_HISTORY_HOST=127.0.0.1"
|
||||||
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
||||||
ExecStart=__YNH_NODE__ __INSTALL_DIR__/live/services/project-history/app.js
|
ExecStart=__NODEJS_DIR__/node __INSTALL_DIR__/live/services/project-history/app.js
|
||||||
StandardOutput=append:/var/log/__APP__/project-history.log
|
StandardOutput=append:/var/log/__APP__/project-history.log
|
||||||
StandardError=inherit
|
StandardError=inherit
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
|
@ -10,7 +10,7 @@ WorkingDirectory=__INSTALL_DIR__/
|
||||||
Environment="REALTIME_HOST=127.0.0.1"
|
Environment="REALTIME_HOST=127.0.0.1"
|
||||||
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
||||||
EnvironmentFile=__INSTALL_DIR__/variables.env
|
EnvironmentFile=__INSTALL_DIR__/variables.env
|
||||||
ExecStart=__YNH_NODE__ __INSTALL_DIR__/live/services/real-time/app.js
|
ExecStart=__NODEJS_DIR__/node __INSTALL_DIR__/live/services/real-time/app.js
|
||||||
StandardOutput=append:/var/log/__APP__/real-time.log
|
StandardOutput=append:/var/log/__APP__/real-time.log
|
||||||
StandardError=inherit
|
StandardError=inherit
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
|
@ -10,7 +10,7 @@ WorkingDirectory=__INSTALL_DIR__/
|
||||||
Environment="SPELLING_HOST=127.0.0.1"
|
Environment="SPELLING_HOST=127.0.0.1"
|
||||||
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
||||||
EnvironmentFile=__INSTALL_DIR__/variables.env
|
EnvironmentFile=__INSTALL_DIR__/variables.env
|
||||||
ExecStart=__YNH_NODE__ __INSTALL_DIR__/live/services/spelling/app.js
|
ExecStart=__NODEJS_DIR__/node __INSTALL_DIR__/live/services/spelling/app.js
|
||||||
StandardOutput=append:/var/log/__APP__/spelling.log
|
StandardOutput=append:/var/log/__APP__/spelling.log
|
||||||
StandardError=inherit
|
StandardError=inherit
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
|
@ -12,7 +12,7 @@ Environment="WEB_API_HOST=127.0.0.1"
|
||||||
Environment="WEB_PORT=__PORT__"
|
Environment="WEB_PORT=__PORT__"
|
||||||
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
Environment="MONGO_CONNECTION_STRING=mongodb://127.0.0.1:27017/__DB_NAME__"
|
||||||
EnvironmentFile=__INSTALL_DIR__/variables.env
|
EnvironmentFile=__INSTALL_DIR__/variables.env
|
||||||
ExecStart=__YNH_NODE__ __INSTALL_DIR__/live/services/web/app.js
|
ExecStart=__NODEJS_DIR__/node __INSTALL_DIR__/live/services/web/app.js
|
||||||
StandardOutput=append:/var/log/__APP__/web.log
|
StandardOutput=append:/var/log/__APP__/web.log
|
||||||
StandardError=inherit
|
StandardError=inherit
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
|
@ -18,7 +18,8 @@ userdoc = "https://www.overleaf.com/learn"
|
||||||
code = "https://github.com/overleaf/overleaf"
|
code = "https://github.com/overleaf/overleaf"
|
||||||
|
|
||||||
[integration]
|
[integration]
|
||||||
yunohost = ">= 11.2.13"
|
yunohost = ">= 11.2.18"
|
||||||
|
helpers_version = "2.1"
|
||||||
architectures = ["amd64"]
|
architectures = ["amd64"]
|
||||||
multi_instance = false
|
multi_instance = false
|
||||||
|
|
||||||
|
@ -59,6 +60,7 @@ ram.runtime = "3G"
|
||||||
allow_email = true
|
allow_email = true
|
||||||
|
|
||||||
[resources.install_dir]
|
[resources.install_dir]
|
||||||
|
group = "www-data:r-x"
|
||||||
|
|
||||||
[resources.data_dir]
|
[resources.data_dir]
|
||||||
subdirs = [ "compiles", "output", "cache", "user_files", "template_files", "history" ]
|
subdirs = [ "compiles", "output", "cache", "user_files", "template_files", "history" ]
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
nodejs_version="20"
|
nodejs_version="20"
|
||||||
YNH_MONGO_VERSION="7.0"
|
mongo_version="7.0"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# PERSONAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# FUTURE OFFICIAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
|
@ -1,37 +1,28 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
ynh_print_info "Declaring files to be backed up..."
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info --message="Declaring files to be backed up..."
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$install_dir"
|
ynh_backup "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE DATA DIR
|
# BACKUP THE DATA DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$data_dir" --is_big
|
ynh_backup "$data_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC BACKUP
|
# SPECIFIC BACKUP
|
||||||
|
@ -39,34 +30,34 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
# BACKUP LOGROTATE
|
# BACKUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
ynh_backup "/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP SYSTEMD
|
# BACKUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app-chat.service"
|
ynh_backup "/etc/systemd/system/$app-chat.service"
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app-clsi.service"
|
ynh_backup "/etc/systemd/system/$app-clsi.service"
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app-contacts.service"
|
ynh_backup "/etc/systemd/system/$app-contacts.service"
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app-docstore.service"
|
ynh_backup "/etc/systemd/system/$app-docstore.service"
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app-document-updater.service"
|
ynh_backup "/etc/systemd/system/$app-document-updater.service"
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app-filestore.service"
|
ynh_backup "/etc/systemd/system/$app-filestore.service"
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app-history-v1.service"
|
ynh_backup "/etc/systemd/system/$app-history-v1.service"
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app-notifications.service"
|
ynh_backup "/etc/systemd/system/$app-notifications.service"
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app-project-history.service"
|
ynh_backup "/etc/systemd/system/$app-project-history.service"
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app-real-time.service"
|
ynh_backup "/etc/systemd/system/$app-real-time.service"
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app-spelling.service"
|
ynh_backup "/etc/systemd/system/$app-spelling.service"
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app-web.service"
|
ynh_backup "/etc/systemd/system/$app-web.service"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE MONGODB DATABASE
|
# BACKUP THE MONGODB DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Backing up the MongoDB database..."
|
ynh_print_info "Backing up the MongoDB database..."
|
||||||
|
|
||||||
ynh_mongo_dump_db --database="$db_name" > ./dump.bson
|
ynh_mongo_dump_db > ./dump.bson
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||||
|
|
|
@ -1,81 +1,82 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC STARTING
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP SYSTEMD SERVICE
|
# STOP SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..."
|
ynh_script_progression "Stopping $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app-chat" --action="stop" --log_path="/var/log/$app/$app.log"
|
ynh_systemctl --service="$app-chat" --action="stop"
|
||||||
ynh_systemd_action --service_name="$app-clsi" --action="stop" --log_path="/var/log/$app/$app.log"
|
|
||||||
ynh_systemd_action --service_name="$app-contacts" --action="stop" --log_path="/var/log/$app/$app.log"
|
ynh_systemctl --service="$app-clsi" --action="stop"
|
||||||
ynh_systemd_action --service_name="$app-docstore" --action="stop" --log_path="/var/log/$app/$app.log"
|
|
||||||
ynh_systemd_action --service_name="$app-document-updater" --action="stop" --log_path="/var/log/$app/$app.log"
|
ynh_systemctl --service="$app-contacts" --action="stop"
|
||||||
ynh_systemd_action --service_name="$app-filestore" --action="stop" --log_path="/var/log/$app/$app.log"
|
|
||||||
ynh_systemd_action --service_name="$app-history-v1" --action="stop" --log_path="/var/log/$app/$app.log"
|
ynh_systemctl --service="$app-docstore" --action="stop"
|
||||||
ynh_systemd_action --service_name="$app-notifications" --action="stop" --log_path="/var/log/$app/$app.log"
|
|
||||||
ynh_systemd_action --service_name="$app-project-history" --action="stop" --log_path="/var/log/$app/$app.log"
|
ynh_systemctl --service="$app-document-updater" --action="stop"
|
||||||
ynh_systemd_action --service_name="$app-real-time" --action="stop" --log_path="/var/log/$app/$app.log"
|
|
||||||
ynh_systemd_action --service_name="$app-spelling" --action="stop" --log_path="/var/log/$app/$app.log"
|
ynh_systemctl --service="$app-filestore" --action="stop"
|
||||||
ynh_systemd_action --service_name="$app-web" --action="stop" --log_path="/var/log/$app/$app.log"
|
|
||||||
|
ynh_systemctl --service="$app-history-v1" --action="stop"
|
||||||
|
|
||||||
|
ynh_systemctl --service="$app-notifications" --action="stop"
|
||||||
|
|
||||||
|
ynh_systemctl --service="$app-project-history" --action="stop"
|
||||||
|
|
||||||
|
ynh_systemctl --service="$app-real-time" --action="stop"
|
||||||
|
|
||||||
|
ynh_systemctl --service="$app-spelling" --action="stop"
|
||||||
|
|
||||||
|
ynh_systemctl --service="$app-web" --action="stop"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating NGINX web server configuration..."
|
ynh_script_progression "Updating NGINX web server configuration..."
|
||||||
|
|
||||||
ynh_change_url_nginx_config
|
ynh_config_change_url_nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC MODIFICATIONS
|
# SPECIFIC MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE A CONFIG FILE
|
# UPDATE A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating a configuration file..."
|
ynh_script_progression "Updating configuration..."
|
||||||
|
|
||||||
domain=$new_domain
|
domain=$new_domain
|
||||||
path=$new_path
|
path=$new_path
|
||||||
|
|
||||||
ynh_add_config --template="../conf/variables.env" --destination="$install_dir/variables.env"
|
ynh_config_add --template="variables.env" --destination="$install_dir/variables.env"
|
||||||
chmod 400 "$install_dir/variables.env"
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/variables.env"
|
||||||
chown $app:$app "$install_dir/variables.env"
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/variables.env"
|
||||||
|
|
||||||
ynh_add_config --template="../conf/settings.js" --destination="$install_dir/settings.js"
|
ynh_config_add --template="settings.js" --destination="$install_dir/settings.js"
|
||||||
chmod 400 "$install_dir/settings.js"
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/settings.js"
|
||||||
chown $app:$app "$install_dir/settings.js"
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/settings.js"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALISATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app-chat" --action="start" --log_path="/var/log/$app/chat.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-chat" --action="start" --log_path="/var/log/$app/chat.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-clsi" --action="start" --log_path="/var/log/$app/clsi.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-clsi" --action="start" --log_path="/var/log/$app/clsi.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-contacts" --action="start" --log_path="/var/log/$app/contacts.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-contacts" --action="start" --log_path="/var/log/$app/contacts.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-docstore" --action="start" --log_path="/var/log/$app/docstore.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-docstore" --action="start" --log_path="/var/log/$app/docstore.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-document-updater" --action="start" --log_path="/var/log/$app/document-updater.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-document-updater" --action="start" --log_path="/var/log/$app/document-updater.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-filestore" --action="start" --log_path="/var/log/$app/filestore.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-filestore" --action="start" --log_path="/var/log/$app/filestore.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-history-v1" --action="start" --log_path="/var/log/$app/history-v1.log" --line_match="Loading backend"
|
ynh_systemctl --service="$app-history-v1" --action="start" --log_path="/var/log/$app/history-v1.log" --wait_until="Loading backend"
|
||||||
ynh_systemd_action --service_name="$app-notifications" --action="start" --log_path="/var/log/$app/notifications.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-notifications" --action="start" --log_path="/var/log/$app/notifications.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-project-history" --action="start" --log_path="/var/log/$app/project-history.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-project-history" --action="start" --log_path="/var/log/$app/project-history.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-real-time" --action="start" --log_path="/var/log/$app/real-time.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-real-time" --action="start" --log_path="/var/log/$app/real-time.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-spelling" --action="start" --log_path="/var/log/$app/spelling.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-spelling" --action="start" --log_path="/var/log/$app/spelling.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-web" --action="start" --log_path="/var/log/$app/web.log" --line_match="listening on" --line_match="Using settings from"
|
ynh_systemctl --service="$app-web" --action="start" --log_path="/var/log/$app/web.log" --wait_until="listening on" --wait_until="Using settings from"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Change of URL completed for $app"
|
ynh_script_progression "Change of URL completed for $app"
|
||||||
|
|
156
scripts/install
156
scripts/install
|
@ -1,11 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -13,34 +7,32 @@ web_api_password=$(ynh_string_random --length=32 | base64 -w 0 | rev | cut -b 2-
|
||||||
crypto_random=$(ynh_string_random --length=32 | base64 -w 0 | rev | cut -b 2- | rev | tr -d '\n+/')
|
crypto_random=$(ynh_string_random --length=32 | base64 -w 0 | rev | cut -b 2- | rev | tr -d '\n+/')
|
||||||
admin_mail=$(ynh_user_get_info --username=$admin --key=mail)
|
admin_mail=$(ynh_user_get_info --username=$admin --key=mail)
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=crypto_random --value=$crypto_random
|
ynh_app_setting_set --key=crypto_random --value=$crypto_random
|
||||||
ynh_app_setting_set --app=$app --key=web_api_password --value=$web_api_password
|
ynh_app_setting_set --key=web_api_password --value=$web_api_password
|
||||||
|
|
||||||
# key for the .env __JWT_KEY__
|
# key for the .env __JWT_KEY__
|
||||||
jwt_key=$(ynh_string_random --length=45 | base64)
|
jwt_key=$(ynh_string_random --length=45 | base64)
|
||||||
ynh_app_setting_set --app=$app --key=jwt_key --value=$jwt_key
|
ynh_app_setting_set --key=jwt_key --value=$jwt_key
|
||||||
|
|
||||||
# Retrieve YunoHost main domain for mails to work
|
# Retrieve YunoHost main domain for mails to work
|
||||||
main_domain=$(cat /etc/yunohost/current_host)
|
main_domain=$(cat /etc/yunohost/current_host)
|
||||||
ynh_app_setting_set --app=$app --key=main_domain --value=$main_domain
|
ynh_app_setting_set --key=main_domain --value=$main_domain
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
ynh_nodejs_install
|
||||||
ynh_install_mongo
|
ynh_install_mongo
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A MONGODB DATABASE
|
# CREATE A MONGODB DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating a MongoDB database..."
|
ynh_script_progression "Creating a MongoDB database..."
|
||||||
|
|
||||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
ynh_app_setting_set --key=db_name --value=$db_name
|
||||||
ynh_mongo_setup_db --db_user=$db_user --db_name=$db_name
|
ynh_mongo_setup_db --db_user=$db_user --db_name=$db_name
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -48,21 +40,21 @@ ynh_mongo_setup_db --db_user=$db_user --db_name=$db_name
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE MONGOD
|
# CONFIGURE MONGOD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring MongoDB..." --weight=10
|
ynh_script_progression "Configuring MongoDB..."
|
||||||
|
|
||||||
ynh_replace_string --match_string="#replication:" --replace_string="replication:\n replSetName: rs0" --target_file="/etc/mongod.conf"
|
ynh_replace --match="#replication:" --replace="replication:\n replSetName: rs0" --file="/etc/mongod.conf"
|
||||||
|
|
||||||
ynh_exec_warn_less systemctl enable mongod --quiet
|
ynh_hide_warnings systemctl enable mongod --quiet
|
||||||
ynh_systemd_action --service_name=mongod --action=restart --log_path=/var/log/mongodb/mongod.log --line_match="Waiting for connections"
|
ynh_systemctl --service=mongod --action=restart --log_path=/var/log/mongodb/mongod.log --wait_until="Waiting for connections"
|
||||||
|
|
||||||
if ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.status())" | grep -q "no replset config has been received"; then
|
if ynh_hide_warnings ynh_mongo_exec --command="printjson(rs.status())" | grep -q "no replset config has been received"; then
|
||||||
ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.initiate())" --eval
|
ynh_hide_warnings ynh_mongo_exec --command="printjson(rs.initiate())"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..."
|
ynh_script_progression "Setting up source files..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$install_dir/build"
|
ynh_setup_source --dest_dir="$install_dir/build"
|
||||||
|
@ -70,24 +62,23 @@ ynh_setup_source --dest_dir="$install_dir/build"
|
||||||
mkdir -p $install_dir/tmp
|
mkdir -p $install_dir/tmp
|
||||||
mkdir -p $install_dir/tmp/{projectHistories,dumpFolder,uploads}
|
mkdir -p $install_dir/tmp/{projectHistories,dumpFolder,uploads}
|
||||||
|
|
||||||
chmod 750 "$install_dir"
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir"
|
||||||
chmod -R o-rwx "$install_dir"
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
|
||||||
chown -R $app:www-data "$install_dir"
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring NGINX web server..."
|
ynh_script_progression "Configuring NGINX web server..."
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_config_add_nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DATA DIRECTORY
|
# CREATE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating a data directory..."
|
ynh_script_progression "Creating a data directory..."
|
||||||
|
|
||||||
chmod 750 "$data_dir"
|
chmod 750 "$data_dir"
|
||||||
chmod -R o-rwx "$data_dir"
|
chmod -R o-rwx "$data_dir"
|
||||||
|
@ -96,20 +87,20 @@ chown -R $app:www-data "$data_dir"
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..."
|
ynh_script_progression "Adding $app's configuration..."
|
||||||
|
|
||||||
ynh_add_config --template="../conf/variables.env" --destination="$install_dir/variables.env"
|
ynh_config_add --template="variables.env" --destination="$install_dir/variables.env"
|
||||||
chmod 400 "$install_dir/variables.env"
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/variables.env"
|
||||||
chown $app:$app "$install_dir/variables.env"
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/variables.env"
|
||||||
|
|
||||||
ynh_add_config --template="../conf/settings.js" --destination="$install_dir/settings.js"
|
ynh_config_add --template="settings.js" --destination="$install_dir/settings.js"
|
||||||
chmod 400 "$install_dir/settings.js"
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/settings.js"
|
||||||
chown $app:$app "$install_dir/settings.js"
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/settings.js"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BUILDING APP
|
# BUILDING APP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Preparing app..."
|
ynh_script_progression "Preparing app..."
|
||||||
|
|
||||||
mkdir -p "$install_dir/live"
|
mkdir -p "$install_dir/live"
|
||||||
cp "$install_dir/build/server-ce/genScript.js" "$install_dir/live/genScript.js"
|
cp "$install_dir/build/server-ce/genScript.js" "$install_dir/live/genScript.js"
|
||||||
|
@ -120,30 +111,30 @@ cp -r "$install_dir/build/libraries/" "$install_dir/live/libraries/"
|
||||||
cp -r "$install_dir/build/services/" "$install_dir/live/services/"
|
cp -r "$install_dir/build/services/" "$install_dir/live/services/"
|
||||||
cp -r "$install_dir/build/patches/" "$install_dir/live/patches/"
|
cp -r "$install_dir/build/patches/" "$install_dir/live/patches/"
|
||||||
cp -r "$install_dir/build/server-ce/config" "$install_dir/config/"
|
cp -r "$install_dir/build/server-ce/config" "$install_dir/config/"
|
||||||
ynh_secure_remove --file="$install_dir/config/settings.js"
|
ynh_safe_rm "$install_dir/config/settings.js"
|
||||||
ynh_secure_remove --file="$install_dir/config/production.json"
|
ynh_safe_rm "$install_dir/config/production.json"
|
||||||
|
|
||||||
ynh_add_config --template="../conf/production.json" --destination="$install_dir/config/production.json"
|
ynh_config_add --template="production.json" --destination="$install_dir/config/production.json"
|
||||||
ynh_add_config --template="../conf/production.json" --destination="$install_dir/live/services/history-v1/config/production.json"
|
ynh_config_add --template="production.json" --destination="$install_dir/live/services/history-v1/config/production.json"
|
||||||
cp "$install_dir/build/server-ce/config/custom-environment-variables.json" "$install_dir/live/services/history-v1/config/"
|
cp "$install_dir/build/server-ce/config/custom-environment-variables.json" "$install_dir/live/services/history-v1/config/"
|
||||||
|
|
||||||
ynh_secure_remove --file="$install_dir/build"
|
ynh_safe_rm "$install_dir/build"
|
||||||
|
|
||||||
ynh_script_progression --message="Building app... This may take a LOT of time depending of your CPU" --weight=25
|
ynh_script_progression "Building app... This may take a LOT of time depending of your CPU"
|
||||||
pushd "$install_dir/live"
|
pushd "$install_dir/live"
|
||||||
ynh_use_nodejs
|
|
||||||
ynh_exec_warn_less npm cache clean --force
|
ynh_hide_warnings npm cache clean --force
|
||||||
ynh_exec_warn_less npm install
|
ynh_hide_warnings npm install
|
||||||
ynh_exec_warn_less npm ci
|
ynh_hide_warnings npm ci
|
||||||
popd
|
popd
|
||||||
|
|
||||||
pushd "$install_dir/live/services/web"
|
pushd "$install_dir/live/services/web"
|
||||||
ynh_exec_warn_less npm run webpack:production
|
ynh_hide_warnings npm run webpack:production
|
||||||
ynh_secure_remove --file="$install_dir/live/services/web/node_modules/.cache"
|
ynh_safe_rm "$install_dir/live/services/web/node_modules/.cache"
|
||||||
popd
|
popd
|
||||||
|
|
||||||
# remove build dir
|
# remove build dir
|
||||||
ynh_secure_remove "$install_dir/build"
|
ynh_safe_rm "$install_dir/build"
|
||||||
|
|
||||||
chmod 750 "$install_dir/live"
|
chmod 750 "$install_dir/live"
|
||||||
chmod -R o-rwx "$install_dir/live"
|
chmod -R o-rwx "$install_dir/live"
|
||||||
|
@ -158,38 +149,36 @@ chown -R $app:www-data "$install_dir/tmp"
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring a systemd service..."
|
ynh_script_progression "Configuring $app's systemd service..."
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config --service="$app-chat" --template="overleaf-chat.service"
|
ynh_config_add_systemd --service="$app-chat" --template="overleaf-chat.service"
|
||||||
ynh_add_systemd_config --service="$app-clsi" --template="overleaf-clsi.service"
|
ynh_config_add_systemd --service="$app-clsi" --template="overleaf-clsi.service"
|
||||||
ynh_add_systemd_config --service="$app-contacts" --template="overleaf-contacts.service"
|
ynh_config_add_systemd --service="$app-contacts" --template="overleaf-contacts.service"
|
||||||
ynh_add_systemd_config --service="$app-docstore" --template="overleaf-docstore.service"
|
ynh_config_add_systemd --service="$app-docstore" --template="overleaf-docstore.service"
|
||||||
ynh_add_systemd_config --service="$app-document-updater" --template="overleaf-document-updater.service"
|
ynh_config_add_systemd --service="$app-document-updater" --template="overleaf-document-updater.service"
|
||||||
ynh_add_systemd_config --service="$app-filestore" --template="overleaf-filestore.service"
|
ynh_config_add_systemd --service="$app-filestore" --template="overleaf-filestore.service"
|
||||||
ynh_add_systemd_config --service="$app-history-v1" --template="overleaf-history-v1.service"
|
ynh_config_add_systemd --service="$app-history-v1" --template="overleaf-history-v1.service"
|
||||||
ynh_add_systemd_config --service="$app-notifications" --template="overleaf-notifications.service"
|
ynh_config_add_systemd --service="$app-notifications" --template="overleaf-notifications.service"
|
||||||
ynh_add_systemd_config --service="$app-project-history" --template="overleaf-project-history.service"
|
ynh_config_add_systemd --service="$app-project-history" --template="overleaf-project-history.service"
|
||||||
ynh_add_systemd_config --service="$app-real-time" --template="overleaf-real-time.service"
|
ynh_config_add_systemd --service="$app-real-time" --template="overleaf-real-time.service"
|
||||||
ynh_add_systemd_config --service="$app-spelling" --template="overleaf-spelling.service"
|
ynh_config_add_systemd --service="$app-spelling" --template="overleaf-spelling.service"
|
||||||
ynh_add_systemd_config --service="$app-web" --template="overleaf-web.service"
|
ynh_config_add_systemd --service="$app-web" --template="overleaf-web.service"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring log rotation..."
|
ynh_script_progression "Configuring log rotation..."
|
||||||
|
|
||||||
mkdir -p "/var/log/$app"
|
mkdir -p "/var/log/$app"
|
||||||
chown -R $app:$app "/var/log/$app"
|
#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:$app "/var/log/$app"
|
||||||
# Use logrotate to manage application logfile(s)
|
# Use logrotate to manage application logfile(s)
|
||||||
ynh_use_logrotate
|
ynh_config_add_logrotate
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression "Integrating service in YunoHost..."
|
||||||
|
|
||||||
yunohost service add "$app-chat" --log="/var/log/$app/chat.log"
|
yunohost service add "$app-chat" --log="/var/log/$app/chat.log"
|
||||||
yunohost service add "$app-clsi" --log="/var/log/$app/clsi.log"
|
yunohost service add "$app-clsi" --log="/var/log/$app/clsi.log"
|
||||||
|
@ -207,23 +196,24 @@ yunohost service add "$app-web" --log="/var/log/$app/web.log"
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app-chat" --action="start" --log_path="/var/log/$app/chat.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-chat" --action="start" --log_path="/var/log/$app/chat.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-clsi" --action="start" --log_path="/var/log/$app/clsi.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-clsi" --action="start" --log_path="/var/log/$app/clsi.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-contacts" --action="start" --log_path="/var/log/$app/contacts.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-contacts" --action="start" --log_path="/var/log/$app/contacts.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-docstore" --action="start" --log_path="/var/log/$app/docstore.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-docstore" --action="start" --log_path="/var/log/$app/docstore.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-document-updater" --action="start" --log_path="/var/log/$app/document-updater.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-document-updater" --action="start" --log_path="/var/log/$app/document-updater.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-filestore" --action="start" --log_path="/var/log/$app/filestore.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-filestore" --action="start" --log_path="/var/log/$app/filestore.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-history-v1" --action="start" --log_path="/var/log/$app/history-v1.log" --line_match="Loading backend"
|
ynh_systemctl --service="$app-history-v1" --action="start" --log_path="/var/log/$app/history-v1.log" --wait_until="Loading backend"
|
||||||
ynh_systemd_action --service_name="$app-notifications" --action="start" --log_path="/var/log/$app/notifications.log" --line_match="Using settings from"
|
|
||||||
ynh_systemd_action --service_name="$app-project-history" --action="start" --log_path="/var/log/$app/project-history.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-notifications" --action="start" --log_path="/var/log/$app/notifications.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-real-time" --action="start" --log_path="/var/log/$app/real-time.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-project-history" --action="start" --log_path="/var/log/$app/project-history.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-spelling" --action="start" --log_path="/var/log/$app/spelling.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-real-time" --action="start" --log_path="/var/log/$app/real-time.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-web" --action="start" --log_path="/var/log/$app/web.log" --line_match="listening on" --line_match="Using settings from"
|
ynh_systemctl --service="$app-spelling" --action="start" --log_path="/var/log/$app/spelling.log" --wait_until="Using settings from"
|
||||||
|
ynh_systemctl --service="$app-web" --action="start" --log_path="/var/log/$app/web.log" --wait_until="listening on" --wait_until="Using settings from"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installation of $app completed"
|
ynh_script_progression "Installation of $app completed"
|
||||||
|
|
100
scripts/remove
100
scripts/remove
|
@ -1,11 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -14,67 +8,67 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping and removing the systemd service..."
|
ynh_script_progression "Stopping and removing the systemd service..."
|
||||||
|
|
||||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||||
if ynh_exec_warn_less yunohost service status "$app-chat" >/dev/null
|
if ynh_hide_warnings yunohost service status "$app-chat" >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app-chat service integration..."
|
ynh_script_progression "Removing $app-chat service integration..."
|
||||||
yunohost service remove "$app-chat"
|
yunohost service remove "$app-chat"
|
||||||
fi
|
fi
|
||||||
if ynh_exec_warn_less yunohost service status "$app-clsi" >/dev/null
|
if ynh_hide_warnings yunohost service status "$app-clsi" >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app-clsi service integration..."
|
ynh_script_progression "Removing $app-clsi service integration..."
|
||||||
yunohost service remove "$app-clsi"
|
yunohost service remove "$app-clsi"
|
||||||
fi
|
fi
|
||||||
if ynh_exec_warn_less yunohost service status "$app-contacts" >/dev/null
|
if ynh_hide_warnings yunohost service status "$app-contacts" >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app-contacts service integration..."
|
ynh_script_progression "Removing $app-contacts service integration..."
|
||||||
yunohost service remove "$app-contacts"
|
yunohost service remove "$app-contacts"
|
||||||
fi
|
fi
|
||||||
if ynh_exec_warn_less yunohost service status "$app-docstore" >/dev/null
|
if ynh_hide_warnings yunohost service status "$app-docstore" >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app-docstore service integration..."
|
ynh_script_progression "Removing $app-docstore service integration..."
|
||||||
yunohost service remove "$app-docstore"
|
yunohost service remove "$app-docstore"
|
||||||
fi
|
fi
|
||||||
if ynh_exec_warn_less yunohost service status "$app-document-updater" >/dev/null
|
if ynh_hide_warnings yunohost service status "$app-document-updater" >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app-document-updater service integration..."
|
ynh_script_progression "Removing $app-document-updater service integration..."
|
||||||
yunohost service remove "$app-document-updater"
|
yunohost service remove "$app-document-updater"
|
||||||
fi
|
fi
|
||||||
if ynh_exec_warn_less yunohost service status "$app-filestore" >/dev/null
|
if ynh_hide_warnings yunohost service status "$app-filestore" >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app-filestore service integration..."
|
ynh_script_progression "Removing $app-filestore service integration..."
|
||||||
yunohost service remove "$app-filestore"
|
yunohost service remove "$app-filestore"
|
||||||
fi
|
fi
|
||||||
if ynh_exec_warn_less yunohost service status "$app-history-v1" >/dev/null
|
if ynh_hide_warnings yunohost service status "$app-history-v1" >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app-history-v1 service integration..."
|
ynh_script_progression "Removing $app-history-v1 service integration..."
|
||||||
yunohost service remove "$app-history-v1"
|
yunohost service remove "$app-history-v1"
|
||||||
fi
|
fi
|
||||||
if ynh_exec_warn_less yunohost service status "$app-notifications" >/dev/null
|
if ynh_hide_warnings yunohost service status "$app-notifications" >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app-notifications service integration..."
|
ynh_script_progression "Removing $app-notifications service integration..."
|
||||||
yunohost service remove "$app-notifications"
|
yunohost service remove "$app-notifications"
|
||||||
fi
|
fi
|
||||||
if ynh_exec_warn_less yunohost service status "$app-project-history" >/dev/null
|
if ynh_hide_warnings yunohost service status "$app-project-history" >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app-project-history service integration..."
|
ynh_script_progression "Removing $app-project-history service integration..."
|
||||||
yunohost service remove "$app-project-history"
|
yunohost service remove "$app-project-history"
|
||||||
fi
|
fi
|
||||||
if ynh_exec_warn_less yunohost service status "$app-real-time" >/dev/null
|
if ynh_hide_warnings yunohost service status "$app-real-time" >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app-real-time service integration..."
|
ynh_script_progression "Removing $app-real-time service integration..."
|
||||||
yunohost service remove "$app-real-time"
|
yunohost service remove "$app-real-time"
|
||||||
fi
|
fi
|
||||||
if ynh_exec_warn_less yunohost service status "$app-spelling" >/dev/null
|
if ynh_hide_warnings yunohost service status "$app-spelling" >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app-spelling service integration..."
|
ynh_script_progression "Removing $app-spelling service integration..."
|
||||||
yunohost service remove "$app-spelling"
|
yunohost service remove "$app-spelling"
|
||||||
fi
|
fi
|
||||||
if ynh_exec_warn_less yunohost service status "$app-web" >/dev/null
|
if ynh_hide_warnings yunohost service status "$app-web" >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app-web service integration..."
|
ynh_script_progression "Removing $app-web service integration..."
|
||||||
yunohost service remove "$app-web"
|
yunohost service remove "$app-web"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -82,57 +76,57 @@ fi
|
||||||
# STOP AND REMOVE SERVICE
|
# STOP AND REMOVE SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
# Remove the dedicated systemd config
|
# Remove the dedicated systemd config
|
||||||
ynh_remove_systemd_config --service="$app-chat"
|
ynh_config_remove_systemd"$app-chat"
|
||||||
ynh_remove_systemd_config --service="$app-clsi"
|
ynh_config_remove_systemd"$app-clsi"
|
||||||
ynh_remove_systemd_config --service="$app-contacts"
|
ynh_config_remove_systemd"$app-contacts"
|
||||||
ynh_remove_systemd_config --service="$app-docstore"
|
ynh_config_remove_systemd"$app-docstore"
|
||||||
ynh_remove_systemd_config --service="$app-document-updater"
|
ynh_config_remove_systemd"$app-document-updater"
|
||||||
ynh_remove_systemd_config --service="$app-filestore"
|
ynh_config_remove_systemd"$app-filestore"
|
||||||
ynh_remove_systemd_config --service="$app-history-v1"
|
ynh_config_remove_systemd"$app-history-v1"
|
||||||
ynh_remove_systemd_config --service="$app-notifications"
|
ynh_config_remove_systemd"$app-notifications"
|
||||||
ynh_remove_systemd_config --service="$app-project-history"
|
ynh_config_remove_systemd"$app-project-history"
|
||||||
ynh_remove_systemd_config --service="$app-real-time"
|
ynh_config_remove_systemd"$app-real-time"
|
||||||
ynh_remove_systemd_config --service="$app-spelling"
|
ynh_config_remove_systemd"$app-spelling"
|
||||||
ynh_remove_systemd_config --service="$app-web"
|
ynh_config_remove_systemd"$app-web"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE LOGROTATE CONFIGURATION
|
# REMOVE LOGROTATE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing logrotate configuration..."
|
ynh_script_progression "Removing logrotate configuration..."
|
||||||
|
|
||||||
# Remove the app-specific logrotate config
|
# Remove the app-specific logrotate config
|
||||||
ynh_remove_logrotate
|
ynh_config_remove_logrotate
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE MONGODB DATABASE
|
# REMOVE THE MONGODB DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing the MongoDB database..."
|
ynh_script_progression "Removing the MongoDB database..."
|
||||||
|
|
||||||
# Remove a database if it exists, along with the associated user
|
# Remove a database if it exists, along with the associated user
|
||||||
ynh_mongo_remove_db --db_user=$db_user --db_name=$db_name
|
ynh_mongo_remove_db --db_user=$db_user --db_name=$db_name
|
||||||
|
|
||||||
ynh_replace_string --match_string="replication:" --replace_string="#replication:" --target_file="/etc/mongod.conf"
|
ynh_replace --match="replication:" --replace="#replication:" --file="/etc/mongod.conf"
|
||||||
ynh_replace_string --match_string=" replSetName: rs0" --replace_string="" --target_file="/etc/mongod.conf"
|
ynh_replace --match=" replSetName: rs0" --replace="" --file="/etc/mongod.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE NGINX CONFIGURATION
|
# REMOVE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing NGINX web server configuration..."
|
ynh_script_progression "Removing NGINX web server configuration..."
|
||||||
|
|
||||||
# Remove the dedicated NGINX config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_nginx_config
|
ynh_config_remove_nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing dependencies..."
|
ynh_script_progression "Removing dependencies..."
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_mongo
|
ynh_remove_mongo
|
||||||
ynh_remove_nodejs
|
ynh_nodejs_remove
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Removal of $app completed"
|
ynh_script_progression "Removal of $app completed"
|
||||||
|
|
117
scripts/restore
117
scripts/restore
|
@ -1,11 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
@ -14,17 +8,17 @@ source /usr/share/yunohost/helpers
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
ynh_nodejs_install
|
||||||
ynh_install_mongo
|
ynh_install_mongo
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE A MONGODB DATABASE
|
# CREATE A MONGODB DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating a MongoDB database..."
|
ynh_script_progression "Creating a MongoDB database..."
|
||||||
|
|
||||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
ynh_app_setting_set --key=db_name --value=$db_name
|
||||||
ynh_mongo_setup_db --db_user=$db_user --db_name=$db_name
|
ynh_mongo_setup_db --db_user=$db_user --db_name=$db_name
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -32,15 +26,15 @@ ynh_mongo_setup_db --db_user=$db_user --db_name=$db_name
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE MONGOD
|
# CONFIGURE MONGOD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring MongoDB..." --weight=10
|
ynh_script_progression "Configuring MongoDB..."
|
||||||
|
|
||||||
ynh_replace_string --match_string="#replication:" --replace_string="replication:\n replSetName: rs0" --target_file="/etc/mongod.conf"
|
ynh_replace --match="#replication:" --replace="replication:\n replSetName: rs0" --file="/etc/mongod.conf"
|
||||||
|
|
||||||
ynh_exec_warn_less systemctl enable mongod --quiet
|
ynh_hide_warnings systemctl enable mongod --quiet
|
||||||
ynh_systemd_action --service_name=mongod --action=restart --log_path=/var/log/mongodb/mongod.log --line_match="Waiting for connections"
|
ynh_systemctl --service=mongod --action=restart --log_path=/var/log/mongodb/mongod.log --wait_until="Waiting for connections"
|
||||||
|
|
||||||
if ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.status())" | grep -q "no replset config has been received"; then
|
if ynh_hide_warnings ynh_mongo_exec --command="printjson(rs.status())" | grep -q "no replset config has been received"; then
|
||||||
ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.initiate())" --eval
|
ynh_hide_warnings ynh_mongo_exec --command="printjson(rs.initiate())"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -48,27 +42,26 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
ynh_script_progression "Restoring the NGINX web server configuration..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the app main directory..."
|
ynh_script_progression "Restoring the app main directory..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$install_dir"
|
ynh_restore "$install_dir"
|
||||||
|
|
||||||
chmod 750 "$install_dir"
|
|
||||||
chmod -R o-rwx "$install_dir"
|
|
||||||
chown -R $app:www-data "$install_dir"
|
|
||||||
|
|
||||||
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir"
|
||||||
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
|
||||||
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE DATA DIRECTORY
|
# RESTORE THE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the data directory..."
|
ynh_script_progression "Restoring the data directory..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
ynh_restore "$data_dir"
|
||||||
|
|
||||||
chmod 750 "$data_dir"
|
chmod 750 "$data_dir"
|
||||||
chmod -R o-rwx "$data_dir"
|
chmod -R o-rwx "$data_dir"
|
||||||
|
@ -77,55 +70,55 @@ chown -R $app:www-data "$data_dir"
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE MONGODB DATABASE
|
# RESTORE THE MONGODB DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the MongoDB database..."
|
ynh_script_progression "Restoring the MongoDB database..."
|
||||||
|
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
db_pwd=$(ynh_app_setting_get --key=db_pwd)
|
||||||
ynh_mongo_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
ynh_mongo_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||||
ynh_mongo_restore_db --database="$db_name" < ./dump.bson
|
ynh_mongo_restore_db < ./dump.bson
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEMD
|
# RESTORE SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the systemd configuration..."
|
ynh_script_progression "Restoring $app's systemd service..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-chat.service"
|
ynh_restore "/etc/systemd/system/$app-chat.service"
|
||||||
systemctl enable $app-chat.service --quiet
|
systemctl enable $app-chat.service --quiet
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-clsi.service"
|
ynh_restore "/etc/systemd/system/$app-clsi.service"
|
||||||
systemctl enable $app-clsi.service --quiet
|
systemctl enable $app-clsi.service --quiet
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-contacts.service"
|
ynh_restore "/etc/systemd/system/$app-contacts.service"
|
||||||
systemctl enable $app-contacts.service --quiet
|
systemctl enable $app-contacts.service --quiet
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-docstore.service"
|
ynh_restore "/etc/systemd/system/$app-docstore.service"
|
||||||
systemctl enable $app-docstore.service --quiet
|
systemctl enable $app-docstore.service --quiet
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-document-updater.service"
|
ynh_restore "/etc/systemd/system/$app-document-updater.service"
|
||||||
systemctl enable $app-document-updater.service --quiet
|
systemctl enable $app-document-updater.service --quiet
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-filestore.service"
|
ynh_restore "/etc/systemd/system/$app-filestore.service"
|
||||||
systemctl enable $app-filestore.service --quiet
|
systemctl enable $app-filestore.service --quiet
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-history-v1.service"
|
ynh_restore "/etc/systemd/system/$app-history-v1.service"
|
||||||
systemctl enable $app-history-v1.service --quiet
|
systemctl enable $app-history-v1.service --quiet
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-notifications.service"
|
ynh_restore "/etc/systemd/system/$app-notifications.service"
|
||||||
systemctl enable $app-notifications.service --quiet
|
systemctl enable $app-notifications.service --quiet
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-project-history.service"
|
ynh_restore "/etc/systemd/system/$app-project-history.service"
|
||||||
systemctl enable $app-project-history.service --quiet
|
systemctl enable $app-project-history.service --quiet
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-real-time.service"
|
ynh_restore "/etc/systemd/system/$app-real-time.service"
|
||||||
systemctl enable $app-real-time.service --quiet
|
systemctl enable $app-real-time.service --quiet
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-spelling.service"
|
ynh_restore "/etc/systemd/system/$app-spelling.service"
|
||||||
systemctl enable $app-spelling.service --quiet
|
systemctl enable $app-spelling.service --quiet
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app-web.service"
|
ynh_restore "/etc/systemd/system/$app-web.service"
|
||||||
systemctl enable $app-web.service --quiet
|
systemctl enable $app-web.service --quiet
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE LOGROTATE CONFIGURATION
|
# RESTORE THE LOGROTATE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the logrotate configuration..."
|
ynh_script_progression "Restoring the logrotate configuration..."
|
||||||
|
|
||||||
mkdir -p "/var/log/$app"
|
mkdir -p "/var/log/$app"
|
||||||
chown -R $app:$app "/var/log/$app"
|
#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:$app "/var/log/$app"
|
||||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
ynh_restore "/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression "Integrating service in YunoHost..."
|
||||||
|
|
||||||
yunohost service add "$app-chat" --log="/var/log/$app/chat.log"
|
yunohost service add "$app-chat" --log="/var/log/$app/chat.log"
|
||||||
yunohost service add "$app-clsi" --log="/var/log/$app/clsi.log"
|
yunohost service add "$app-clsi" --log="/var/log/$app/clsi.log"
|
||||||
|
@ -143,32 +136,30 @@ yunohost service add "$app-web" --log="/var/log/$app/web.log"
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app-chat" --action="start" --log_path="/var/log/$app/chat.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-chat" --action="start" --log_path="/var/log/$app/chat.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-clsi" --action="start" --log_path="/var/log/$app/clsi.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-clsi" --action="start" --log_path="/var/log/$app/clsi.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-contacts" --action="start" --log_path="/var/log/$app/contacts.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-contacts" --action="start" --log_path="/var/log/$app/contacts.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-docstore" --action="start" --log_path="/var/log/$app/docstore.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-docstore" --action="start" --log_path="/var/log/$app/docstore.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-document-updater" --action="start" --log_path="/var/log/$app/document-updater.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-document-updater" --action="start" --log_path="/var/log/$app/document-updater.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-filestore" --action="start" --log_path="/var/log/$app/filestore.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-filestore" --action="start" --log_path="/var/log/$app/filestore.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-history-v1" --action="start" --log_path="/var/log/$app/history-v1.log" --line_match="Loading backend"
|
ynh_systemctl --service="$app-history-v1" --action="start" --log_path="/var/log/$app/history-v1.log" --wait_until="Loading backend"
|
||||||
ynh_systemd_action --service_name="$app-notifications" --action="start" --log_path="/var/log/$app/notifications.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-notifications" --action="start" --log_path="/var/log/$app/notifications.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-project-history" --action="start" --log_path="/var/log/$app/project-history.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-project-history" --action="start" --log_path="/var/log/$app/project-history.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-real-time" --action="start" --log_path="/var/log/$app/real-time.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-real-time" --action="start" --log_path="/var/log/$app/real-time.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-spelling" --action="start" --log_path="/var/log/$app/spelling.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-spelling" --action="start" --log_path="/var/log/$app/spelling.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-web" --action="start" --log_path="/var/log/$app/web.log" --line_match="listening on" --line_match="Using settings from"
|
ynh_systemctl --service="$app-web" --action="start" --log_path="/var/log/$app/web.log" --wait_until="listening on" --wait_until="Using settings from"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server..."
|
ynh_script_progression "Reloading NGINX web server..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemctl --service=nginx --action=reload
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Restoration completed for $app"
|
ynh_script_progression "Restoration completed for $app"
|
||||||
|
|
205
scripts/upgrade
205
scripts/upgrade
|
@ -1,20 +1,9 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
ynh_script_progression "Checking version..."
|
||||||
# CHECK VERSION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Checking version..."
|
|
||||||
|
|
||||||
upgrade_type=$(ynh_check_app_version_changed)
|
|
||||||
|
|
||||||
# Retrieve YunoHost main domain for mails to work
|
# Retrieve YunoHost main domain for mails to work
|
||||||
main_domain=$(cat /etc/yunohost/current_host)
|
main_domain=$(cat /etc/yunohost/current_host)
|
||||||
|
@ -23,112 +12,120 @@ main_domain=$(cat /etc/yunohost/current_host)
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# FIXMEhelpers2.1: maybe replace with: ynh_app_setting_set_default --key=jwt_key --value=$(ynh_string_random --length=45 | base64)
|
||||||
if [ -z "${jwt_key:-}" ]; then
|
if [ -z "${jwt_key:-}" ]; then
|
||||||
jwt_key=$(ynh_string_random --length=45 | base64)
|
jwt_key=$(ynh_string_random --length=45 | base64)
|
||||||
ynh_app_setting_set --app=$app --key=jwt_key --value=$jwt_key
|
ynh_app_setting_set --key=jwt_key --value=$jwt_key
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD UPGRADE STEPS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP SYSTEMD SERVICE
|
# STOP SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..."
|
ynh_script_progression "Stopping $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app-chat" --action="stop" --log_path="/var/log/$app/$app.log"
|
ynh_systemctl --service="$app-chat" --action="stop"
|
||||||
ynh_systemd_action --service_name="$app-clsi" --action="stop" --log_path="/var/log/$app/$app.log"
|
|
||||||
ynh_systemd_action --service_name="$app-contacts" --action="stop" --log_path="/var/log/$app/$app.log"
|
|
||||||
ynh_systemd_action --service_name="$app-docstore" --action="stop" --log_path="/var/log/$app/$app.log"
|
|
||||||
ynh_systemd_action --service_name="$app-document-updater" --action="stop" --log_path="/var/log/$app/$app.log"
|
|
||||||
ynh_systemd_action --service_name="$app-filestore" --action="stop" --log_path="/var/log/$app/$app.log"
|
|
||||||
ynh_systemd_action --service_name="$app-history-v1" --action="stop" --log_path="/var/log/$app/$app.log"
|
|
||||||
ynh_systemd_action --service_name="$app-notifications" --action="stop" --log_path="/var/log/$app/$app.log"
|
|
||||||
ynh_systemd_action --service_name="$app-project-history" --action="stop" --log_path="/var/log/$app/$app.log"
|
|
||||||
ynh_systemd_action --service_name="$app-real-time" --action="stop" --log_path="/var/log/$app/$app.log"
|
|
||||||
ynh_systemd_action --service_name="$app-spelling" --action="stop" --log_path="/var/log/$app/$app.log"
|
|
||||||
ynh_systemd_action --service_name="$app-web" --action="stop" --log_path="/var/log/$app/$app.log"
|
|
||||||
|
|
||||||
if ynh_exec_warn_less yunohost service status "$app-track-changes" >/dev/null
|
ynh_systemctl --service="$app-clsi" --action="stop"
|
||||||
|
|
||||||
|
ynh_systemctl --service="$app-contacts" --action="stop"
|
||||||
|
|
||||||
|
ynh_systemctl --service="$app-docstore" --action="stop"
|
||||||
|
|
||||||
|
ynh_systemctl --service="$app-document-updater" --action="stop"
|
||||||
|
|
||||||
|
ynh_systemctl --service="$app-filestore" --action="stop"
|
||||||
|
|
||||||
|
ynh_systemctl --service="$app-history-v1" --action="stop"
|
||||||
|
|
||||||
|
ynh_systemctl --service="$app-notifications" --action="stop"
|
||||||
|
|
||||||
|
ynh_systemctl --service="$app-project-history" --action="stop"
|
||||||
|
|
||||||
|
ynh_systemctl --service="$app-real-time" --action="stop"
|
||||||
|
|
||||||
|
ynh_systemctl --service="$app-spelling" --action="stop"
|
||||||
|
|
||||||
|
ynh_systemctl --service="$app-web" --action="stop"
|
||||||
|
|
||||||
|
if ynh_hide_warnings yunohost service status "$app-track-changes" >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app-track-changes service integration..."
|
ynh_script_progression "Removing $app-track-changes service integration..."
|
||||||
yunohost service remove "$app-track-changes"
|
yunohost service remove "$app-track-changes"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
ynh_script_progression "Ensuring downward compatibility..."
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE MONGOD
|
# CONFIGURE MONGOD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring MongoDB..." --weight=10
|
ynh_script_progression "Configuring MongoDB..."
|
||||||
|
|
||||||
ynh_replace_string --match_string="#replication:" --replace_string="replication:\n replSetName: rs0" --target_file="/etc/mongod.conf"
|
ynh_replace --match="#replication:" --replace="replication:\n replSetName: rs0" --file="/etc/mongod.conf"
|
||||||
|
|
||||||
ynh_exec_warn_less systemctl enable mongod --quiet
|
ynh_hide_warnings systemctl enable mongod --quiet
|
||||||
ynh_systemd_action --service_name=mongod --action=restart --log_path=/var/log/mongodb/mongod.log --line_match="Waiting for connections"
|
ynh_systemctl --service=mongod --action=restart --log_path=/var/log/mongodb/mongod.log --wait_until="Waiting for connections"
|
||||||
|
|
||||||
if ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.status())" | grep -q "no replset config has been received"; then
|
if ynh_hide_warnings ynh_mongo_exec --command="printjson(rs.status())" | grep -q "no replset config has been received"; then
|
||||||
ynh_exec_warn_less ynh_mongo_exec --command="printjson(rs.initiate())" --eval
|
ynh_hide_warnings ynh_mongo_exec --command="printjson(rs.initiate())"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed
|
||||||
|
if ynh_app_upstream_version_changed
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Upgrading source files..."
|
ynh_script_progression "Upgrading source files..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source --dest_dir="$install_dir/build" --full_replace=1
|
ynh_setup_source --dest_dir="$install_dir/build" --full_replace
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# full replace on live dir
|
# full replace on live dir
|
||||||
ynh_secure_remove "$install_dir/live"
|
ynh_safe_rm "$install_dir/live"
|
||||||
|
|
||||||
chmod 750 "$install_dir"
|
|
||||||
chmod -R o-rwx "$install_dir"
|
|
||||||
chown -R $app:www-data "$install_dir"
|
|
||||||
|
|
||||||
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 750 "$install_dir"
|
||||||
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir"
|
||||||
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data "$install_dir"
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
ynh_script_progression "Upgrading NGINX web server configuration..."
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_config_add_nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPGRADE DEPENDENCIES
|
# UPGRADE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading dependencies..."
|
ynh_script_progression "Upgrading dependencies..."
|
||||||
|
|
||||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
ynh_nodejs_install
|
||||||
ynh_install_mongo
|
ynh_install_mongo
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC UPGRADE
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE A CONFIG FILE
|
# UPDATE A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating a configuration file..."
|
ynh_script_progression "Updating configuration..."
|
||||||
|
|
||||||
ynh_add_config --template="../conf/variables.env" --destination="$install_dir/variables.env"
|
ynh_config_add --template="variables.env" --destination="$install_dir/variables.env"
|
||||||
chmod 400 "$install_dir/variables.env"
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/variables.env"
|
||||||
chown $app:$app "$install_dir/variables.env"
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/variables.env"
|
||||||
|
|
||||||
ynh_add_config --template="../conf/settings.js" --destination="$install_dir/settings.js"
|
ynh_config_add --template="settings.js" --destination="$install_dir/settings.js"
|
||||||
chmod 400 "$install_dir/settings.js"
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/settings.js"
|
||||||
chown $app:$app "$install_dir/settings.js"
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown $app:$app "$install_dir/settings.js"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BUILDING APP
|
# BUILDING APP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Preparing app..."
|
ynh_script_progression "Preparing app..."
|
||||||
|
|
||||||
mkdir -p "$install_dir/live"
|
mkdir -p "$install_dir/live"
|
||||||
cp "$install_dir/build/server-ce/genScript.js" "$install_dir/live/genScript.js"
|
cp "$install_dir/build/server-ce/genScript.js" "$install_dir/live/genScript.js"
|
||||||
|
@ -139,29 +136,29 @@ cp -r "$install_dir/build/libraries/" "$install_dir/live/libraries/"
|
||||||
cp -r "$install_dir/build/services/" "$install_dir/live/services/"
|
cp -r "$install_dir/build/services/" "$install_dir/live/services/"
|
||||||
cp -r "$install_dir/build/patches/" "$install_dir/live/patches/"
|
cp -r "$install_dir/build/patches/" "$install_dir/live/patches/"
|
||||||
cp -r "$install_dir/build/server-ce/config" "$install_dir/config/"
|
cp -r "$install_dir/build/server-ce/config" "$install_dir/config/"
|
||||||
ynh_secure_remove --file="$install_dir/config/settings.js"
|
ynh_safe_rm "$install_dir/config/settings.js"
|
||||||
ynh_secure_remove --file="$install_dir/config/production.json"
|
ynh_safe_rm "$install_dir/config/production.json"
|
||||||
ynh_secure_remove --file="$install_dir/live/services/history-v1/config/production.json"
|
ynh_safe_rm "$install_dir/live/services/history-v1/config/production.json"
|
||||||
|
|
||||||
ynh_add_config --template="../conf/production.json" --destination="$install_dir/config/production.json"
|
ynh_config_add --template="production.json" --destination="$install_dir/config/production.json"
|
||||||
ynh_add_config --template="../conf/production.json" --destination="$install_dir/live/services/history-v1/config/production.json"
|
ynh_config_add --template="production.json" --destination="$install_dir/live/services/history-v1/config/production.json"
|
||||||
cp "$install_dir/build/server-ce/config/custom-environment-variables.json" "$install_dir/live/services/history-v1/config/"
|
cp "$install_dir/build/server-ce/config/custom-environment-variables.json" "$install_dir/live/services/history-v1/config/"
|
||||||
|
|
||||||
ynh_script_progression --message="Building app... This may take a LOT of time depending of your CPU" --weight=25
|
ynh_script_progression "Building app... This may take a LOT of time depending of your CPU"
|
||||||
pushd "$install_dir/live"
|
pushd "$install_dir/live"
|
||||||
ynh_use_nodejs
|
|
||||||
ynh_exec_warn_less npm cache clean --force
|
ynh_hide_warnings npm cache clean --force
|
||||||
ynh_exec_warn_less npm install
|
ynh_hide_warnings npm install
|
||||||
ynh_exec_warn_less npm ci
|
ynh_hide_warnings npm ci
|
||||||
popd
|
popd
|
||||||
|
|
||||||
pushd "$install_dir/live/services/web"
|
pushd "$install_dir/live/services/web"
|
||||||
ynh_exec_warn_less npm run webpack:production
|
ynh_hide_warnings npm run webpack:production
|
||||||
ynh_secure_remove --file="$install_dir/live/services/web/node_modules/.cache"
|
ynh_safe_rm "$install_dir/live/services/web/node_modules/.cache"
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#remove build dir
|
#remove build dir
|
||||||
ynh_secure_remove "$install_dir/build"
|
ynh_safe_rm "$install_dir/build"
|
||||||
|
|
||||||
chmod 750 "$install_dir/live"
|
chmod 750 "$install_dir/live"
|
||||||
chmod -R o-rwx "$install_dir/live"
|
chmod -R o-rwx "$install_dir/live"
|
||||||
|
@ -176,38 +173,36 @@ chown -R $app:www-data "$install_dir/tmp"
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading systemd configuration..."
|
ynh_script_progression "Upgrading systemd configuration..."
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
# Create a dedicated systemd config
|
||||||
ynh_add_systemd_config --service="$app-chat" --template="overleaf-chat.service"
|
ynh_config_add_systemd --service="$app-chat" --template="overleaf-chat.service"
|
||||||
ynh_add_systemd_config --service="$app-clsi" --template="overleaf-clsi.service"
|
ynh_config_add_systemd --service="$app-clsi" --template="overleaf-clsi.service"
|
||||||
ynh_add_systemd_config --service="$app-contacts" --template="overleaf-contacts.service"
|
ynh_config_add_systemd --service="$app-contacts" --template="overleaf-contacts.service"
|
||||||
ynh_add_systemd_config --service="$app-docstore" --template="overleaf-docstore.service"
|
ynh_config_add_systemd --service="$app-docstore" --template="overleaf-docstore.service"
|
||||||
ynh_add_systemd_config --service="$app-document-updater" --template="overleaf-document-updater.service"
|
ynh_config_add_systemd --service="$app-document-updater" --template="overleaf-document-updater.service"
|
||||||
ynh_add_systemd_config --service="$app-filestore" --template="overleaf-filestore.service"
|
ynh_config_add_systemd --service="$app-filestore" --template="overleaf-filestore.service"
|
||||||
ynh_add_systemd_config --service="$app-history-v1" --template="overleaf-history-v1.service"
|
ynh_config_add_systemd --service="$app-history-v1" --template="overleaf-history-v1.service"
|
||||||
ynh_add_systemd_config --service="$app-notifications" --template="overleaf-notifications.service"
|
ynh_config_add_systemd --service="$app-notifications" --template="overleaf-notifications.service"
|
||||||
ynh_add_systemd_config --service="$app-project-history" --template="overleaf-project-history.service"
|
ynh_config_add_systemd --service="$app-project-history" --template="overleaf-project-history.service"
|
||||||
ynh_add_systemd_config --service="$app-real-time" --template="overleaf-real-time.service"
|
ynh_config_add_systemd --service="$app-real-time" --template="overleaf-real-time.service"
|
||||||
ynh_add_systemd_config --service="$app-spelling" --template="overleaf-spelling.service"
|
ynh_config_add_systemd --service="$app-spelling" --template="overleaf-spelling.service"
|
||||||
ynh_add_systemd_config --service="$app-web" --template="overleaf-web.service"
|
ynh_config_add_systemd --service="$app-web" --template="overleaf-web.service"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading logrotate configuration..."
|
ynh_script_progression "Upgrading logrotate configuration..."
|
||||||
|
|
||||||
mkdir -p "/var/log/$app"
|
mkdir -p "/var/log/$app"
|
||||||
chown -R $app:$app "/var/log/$app"
|
#REMOVEME? Assuming ynh_config_add_logrotate is called, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:$app "/var/log/$app"
|
||||||
# Use logrotate to manage app-specific logfile(s)
|
# Use logrotate to manage app-specific logfile(s)
|
||||||
ynh_use_logrotate --non-append
|
ynh_config_add_logrotate
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
ynh_script_progression "Integrating service in YunoHost..."
|
||||||
|
|
||||||
yunohost service add "$app-chat" --log="/var/log/$app/chat.log"
|
yunohost service add "$app-chat" --log="/var/log/$app/chat.log"
|
||||||
yunohost service add "$app-clsi" --log="/var/log/$app/clsi.log"
|
yunohost service add "$app-clsi" --log="/var/log/$app/clsi.log"
|
||||||
|
@ -225,23 +220,23 @@ yunohost service add "$app-web" --log="/var/log/$app/web.log"
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..."
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app-chat" --action="start" --log_path="/var/log/$app/chat.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-chat" --action="start" --log_path="/var/log/$app/chat.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-clsi" --action="start" --log_path="/var/log/$app/clsi.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-clsi" --action="start" --log_path="/var/log/$app/clsi.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-contacts" --action="start" --log_path="/var/log/$app/contacts.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-contacts" --action="start" --log_path="/var/log/$app/contacts.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-docstore" --action="start" --log_path="/var/log/$app/docstore.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-docstore" --action="start" --log_path="/var/log/$app/docstore.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-document-updater" --action="start" --log_path="/var/log/$app/document-updater.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-document-updater" --action="start" --log_path="/var/log/$app/document-updater.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-filestore" --action="start" --log_path="/var/log/$app/filestore.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-filestore" --action="start" --log_path="/var/log/$app/filestore.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-history-v1" --action="start" --log_path="/var/log/$app/history-v1.log" --line_match="Loading backend"
|
ynh_systemctl --service="$app-history-v1" --action="start" --log_path="/var/log/$app/history-v1.log" --wait_until="Loading backend"
|
||||||
ynh_systemd_action --service_name="$app-notifications" --action="start" --log_path="/var/log/$app/notifications.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-notifications" --action="start" --log_path="/var/log/$app/notifications.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-project-history" --action="start" --log_path="/var/log/$app/project-history.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-project-history" --action="start" --log_path="/var/log/$app/project-history.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-real-time" --action="start" --log_path="/var/log/$app/real-time.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-real-time" --action="start" --log_path="/var/log/$app/real-time.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-spelling" --action="start" --log_path="/var/log/$app/spelling.log" --line_match="Using settings from"
|
ynh_systemctl --service="$app-spelling" --action="start" --log_path="/var/log/$app/spelling.log" --wait_until="Using settings from"
|
||||||
ynh_systemd_action --service_name="$app-web" --action="start" --log_path="/var/log/$app/web.log" --line_match="listening on" --line_match="Using settings from"
|
ynh_systemctl --service="$app-web" --action="start" --log_path="/var/log/$app/web.log" --wait_until="listening on" --wait_until="Using settings from"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Upgrade of $app completed"
|
ynh_script_progression "Upgrade of $app completed"
|
||||||
|
|
Loading…
Reference in a new issue