mirror of
https://github.com/YunoHost-Apps/dato_ynh.git
synced 2024-09-03 18:16:33 +02:00
commit
30b5e5c0f9
12 changed files with 51 additions and 104 deletions
|
@ -59,6 +59,15 @@ If you want a user to have administration rights (= to have the power to add/rem
|
|||
Also, if you need, you can make use of the password reset feature to allow users to modify their passwords, you will just need to send them the generated password reset link.
|
||||
|
||||
|
||||
## A note about dato
|
||||
|
||||
Please be aware that dato is a Progressive Web App. In a nutshell, this means that browsers cache the whole app, so it doesn't have to be requested to the server every time a user is visiting it.
|
||||
This lowers solicitation of the server, and also allow users to use dato offline.
|
||||
|
||||
When the app is upgraded, the user's browser will automatically detect that there is a new version, and propose to reload the page to update. However, sometimes it seems a bit random how browsers notice the new version, so if you want to make sure you're using the latest version, click on the "?" button (top-right in the web interface), and choose "credits" to verify the version you're using.
|
||||
You can also force reloading the app from the server opening "about:serviceworkers" in your browser and unregistering the worker for the domain in which you installed dato.
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
* Official documentation: https://squeak.eauchat.org/dato/
|
||||
|
|
|
@ -46,6 +46,15 @@ Si vous voulez donner le droit à un utilisateur d'administrer (= d'ajouter/supp
|
|||
Si besoin, vous pouvez créer des liens pour permettre à un utilisateur de modifier son mot de passe. Il suffira alors d'envoyer ce lien manuellement à l'utilisateur.
|
||||
|
||||
|
||||
## Note sur dato
|
||||
|
||||
Dato est une application web progressive (PWA). En deux mots, cela veut dire que les navigateurs gardent en cache l'applcation entière, afin de ne pas avoir à la demander au serveur à chaque visite.
|
||||
Cela permet de moins soliciter le serveur, et d'utiliser l'application en l'absence de connexion internet.
|
||||
|
||||
Quand l'application est mises à jour, le navigateur des utilisateurs détecte automatiquement la nouvelle version et propose de recharcher la page pour mettre à jour l'application. Cependant, certains navigateurs ne semblent pas toujours se rendre compte qu'une nouvelle version est disponible instantanément. Pour vérifier la version que vous utilisez, vous pouvez cliquer sur "?" (en haut à droite dans l'interface de dato), et choisir crédit pour y trouver le numéro de version actuellement installé.
|
||||
Vous pouvez aussi forcer une mise à jour de l'application depuis le serveur en ouvrant la page "about:serviceworker" dans votre navigateur, et en cliquant sur le bouton "unregister" du service du domaine sur lequel vous avez installé dato.
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
* Documentation officielle : https://squeak.eauchat.org/dato/
|
||||
|
|
|
@ -6,4 +6,4 @@ enable_cors = true
|
|||
credentials = true
|
||||
headers = accept, authorization, content-type, origin, referer
|
||||
methods = GET, PUT, POST, HEAD, DELETE
|
||||
origins = https://{{{domain}}}
|
||||
origins = https://__DOMAIN__
|
||||
|
|
|
@ -6,18 +6,18 @@ module.exports = {
|
|||
debug: false,
|
||||
refreshServiceWorkerScriptAtEachRequest: false,
|
||||
|
||||
port: "{{{port}}}",
|
||||
port: "__PORT__",
|
||||
|
||||
authentication: {
|
||||
couchUrl: "{{{couch_url}}}",
|
||||
couchUrl: "__COUCH_URL__",
|
||||
},
|
||||
couchAdminAuthentication: {
|
||||
// couch admin user:
|
||||
username: "{{{couch_admin_name}}}",
|
||||
username: "__COUCH_ADMIN_NAME__",
|
||||
// couch admin user's password:
|
||||
password: "{{{couch_admin_password}}}",
|
||||
password: "__COUCH_ADMIN_PASSWORD__",
|
||||
// the url where your couchdb server is accessible from the internet:
|
||||
customCouchUrl: "{{{couch_url}}}",
|
||||
customCouchUrl: "__COUCH_URL__",
|
||||
},
|
||||
|
||||
};
|
||||
|
|
|
@ -6,6 +6,6 @@ module.exports = {
|
|||
debug: false,
|
||||
refreshServiceWorkerScriptAtEachRequest: false,
|
||||
|
||||
port: "{{{port}}}",
|
||||
port: "__PORT__",
|
||||
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
module.exports = {
|
||||
|
||||
adminEmail: "{{{admin_email}}}",
|
||||
adminEmail: "__ADMIN_EMAIL__",
|
||||
|
||||
otherOptionsThanLogin: [
|
||||
"If you have no dato account, you should request one to the administrator of this server.",
|
||||
|
|
|
@ -121,12 +121,12 @@
|
|||
"name": "admin_email",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "If you want the dato administrator email to be displayed in login page, so that users can contact you to create accounts... you can set your email here. Otherwise leave this to 'none'. (only if autosynchronization is enabled)",
|
||||
"fr": "Si tu souhaites que l'email de l'administrateur de dato soit visible sur la page de login, afin que les utilisateurs puissent le contacter pour des demandes de compte... tu peux le spécifier ici. Sinon, choisis 'none'. (nécessaire uniquement si l'autosynchronisation a été activée)"
|
||||
"en": "If you want the dato administrator email to be displayed in login page, so that users can contact you to create accounts... you can set your email here. Otherwise leave this empty. (only useful if autosynchronization is enabled)",
|
||||
"fr": "Si tu souhaites que l'email de l'administrateur de dato soit visible sur la page de login, afin que les utilisateurs puissent le contacter pour des demandes de compte... tu peux le spécifier ici. Sinon, laisser ce champ vide. (utile uniquement si l'autosynchronisation a été activée)"
|
||||
},
|
||||
"example": "datoadmin((at))domain.tld",
|
||||
"optional": true,
|
||||
"default" : "none"
|
||||
"default" : ""
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@ nodejs_version=12
|
|||
|
||||
dato_setup_config_files() {
|
||||
|
||||
# create config directory
|
||||
mkdir "$final_path/config/"
|
||||
# create config directory (if it doesn't exist yet)
|
||||
[ -d "$final_path/config/" ] || mkdir "$final_path/config/"
|
||||
|
||||
# setup public dato config
|
||||
ynh_add_config --template="../conf/public.js" --destination="$final_path/config/public.js"
|
||||
|
@ -25,22 +25,9 @@ dato_setup_config_files() {
|
|||
# setup private dato config
|
||||
if [[ $autosynchronize == true ]]; then
|
||||
ynh_add_config --template="../conf/private-autosync.js" --destination="$final_path/config/private.js"
|
||||
# setup couch url, admin name and password
|
||||
ynh_replace_string --match_string="{{{couch_url}}}" --replace_string="$couch_url" --target_file="$final_path/config/private.js"
|
||||
ynh_replace_string --match_string="{{{couch_admin_name}}}" --replace_string="$couch_admin_name" --target_file="$final_path/config/private.js"
|
||||
ynh_replace_string --match_string="{{{couch_admin_password}}}" --replace_string="$couch_admin_password" --target_file="$final_path/config/private.js"
|
||||
else
|
||||
ynh_add_config --template="../conf/private.js" --destination="$final_path/config/private.js"
|
||||
fi
|
||||
# setup port to use
|
||||
ynh_replace_string --match_string="{{{port}}}" --replace_string="$port" --target_file="$final_path/config/private.js"
|
||||
|
||||
# add admin email to public config if it was set
|
||||
if [[ $admin_email != "none" ]]; then
|
||||
ynh_replace_string --match_string="{{{admin_email}}}" --replace_string="$admin_email" --target_file="$final_path/config/public.js"
|
||||
else
|
||||
ynh_replace_string --match_string="{{{admin_email}}}" --replace_string="" --target_file="$final_path/config/public.js"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -111,9 +111,9 @@ fi
|
|||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=40
|
||||
ynh_script_progression --message="Starting dato app service and building pages..." --weight=60
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="electrode server listening on port"
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="electrode server listening on port" --timeout=600
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
|
|
|
@ -159,15 +159,6 @@ ynh_script_progression --message="Generating dato config files..." --weight=3
|
|||
|
||||
dato_setup_config_files
|
||||
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILES CHECKSUM
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing config files checksums..." --weight=2
|
||||
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum --file="$final_path/config/public.js"
|
||||
ynh_store_file_checksum --file="$final_path/config/private.js"
|
||||
|
||||
#=================================================
|
||||
# CUSTOMIZE SETUP FOR AUTOSYNCHRONIZATION
|
||||
#=================================================
|
||||
|
@ -181,9 +172,6 @@ if [[ $autosynchronize == true ]]; then
|
|||
|
||||
# make sure that couchdb has CORS enabled and that it accepts requests from dato domain
|
||||
ynh_add_config --template="../conf/couch.ini" --destination="/opt/couchdb/etc/local.d/$app.ini"
|
||||
ynh_replace_string --match_string="{{{domain}}}" --replace_string="$domain" --target_file="/opt/couchdb/etc/local.d/$app.ini"
|
||||
|
||||
ynh_store_file_checksum --file="/opt/couchdb/etc/local.d/$app.ini"
|
||||
|
||||
#=================================================
|
||||
# SETUP A COUCHDB DATO ADMIN USER
|
||||
|
@ -202,6 +190,8 @@ if [[ $autosynchronize == true ]]; then
|
|||
# display error message if there was an error creating dato admin user in couch
|
||||
if [[ $curlResult != '{"ok":true,'* ]]; then
|
||||
ynh_print_err --message="There was an error creating the dato admin user for in couch. You will probably have to do it manually (check the last section of this page for instructions: https://squeak.eauchat.org/apps/dato/?setups)."
|
||||
ynh_print_err --message="Here is the error message from couchdb:"
|
||||
ynh_print_err --message="$curlResult"
|
||||
ynh_print_err --message="Please make sure that your couchdb instance is accessible from the url you provided, with a proper SSL certificate (not a self-signed one), otherwise you will not be able to login to dato!"
|
||||
ynh_print_err --message="$curlResult"
|
||||
fi
|
||||
|
@ -239,10 +229,10 @@ yunohost service add $app --description="Data storage with a convenient and flex
|
|||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=60
|
||||
ynh_script_progression --message="Starting dato app service and building pages..." --weight=60
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="electrode server listening on port"
|
||||
# Start a systemd service (increased timeout, because on some systems the pages could take quite some time to build?)
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="electrode server listening on port" --timeout=600
|
||||
|
||||
#=================================================
|
||||
# SETUP FAIL2BAN
|
||||
|
|
|
@ -118,9 +118,9 @@ yunohost service add $app --description="Data storage with a convenient and flex
|
|||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=60
|
||||
ynh_script_progression --message="Starting dato app service and building pages..." --weight=60
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="electrode server listening on port"
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="electrode server listening on port" --timeout=600
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
|
|
|
@ -38,31 +38,6 @@ admin_email=$(ynh_app_setting_get --app=$app --key=admin_email)
|
|||
### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do.
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=2
|
||||
|
||||
### If nobody installed your app before 4.1,
|
||||
### then you may safely remove these lines
|
||||
|
||||
# Cleaning legacy permissions
|
||||
if ynh_legacy_permissions_exists; then
|
||||
ynh_legacy_permissions_delete_all
|
||||
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
if ! ynh_permission_exists --permission="admin"; then
|
||||
# Create the required permissions
|
||||
ynh_permission_create --permission="admin" --url="/admin" --allowed=$admin
|
||||
fi
|
||||
|
||||
# Create a permission if needed
|
||||
if ! ynh_permission_exists --permission="api"; then
|
||||
ynh_permission_create --permission="api" --url "/api" --allowed="visitors" --show_tile="false" --protected="true"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
|
@ -92,10 +67,14 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
|
|||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=3
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=3
|
||||
ynh_setup_source --dest_dir="$final_path"
|
||||
|
||||
# Regenerate config files removed in upgrade
|
||||
ynh_script_progression --message="Regenerating dato config files..." --weight=3
|
||||
dato_setup_config_files
|
||||
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
|
@ -118,7 +97,6 @@ ynh_install_app_dependencies $pkg_dependencies
|
|||
#=================================================
|
||||
ynh_script_progression --message="Installing NodeJS..." --weight=15
|
||||
|
||||
# Install Nodejs
|
||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
||||
#=================================================
|
||||
|
@ -136,46 +114,20 @@ ynh_system_user_create --username=$app
|
|||
#=================================================
|
||||
ynh_script_progression --message="Building node dependencies..." --weight=90
|
||||
|
||||
chown -R "$app":"$app" $final_path
|
||||
|
||||
pushd "$final_path"
|
||||
ynh_use_nodejs
|
||||
sudo -u $app env $ynh_node_load_PATH npm install --loglevel warn
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# GENERATE CONFIG FILES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Generating dato config files..." --weight=3
|
||||
|
||||
dato_setup_config_files
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# VERIFY CONFIG FILES CHECKSUMS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Verifying config files checksums..." --weight=2
|
||||
|
||||
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
|
||||
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
|
||||
ynh_backup_if_checksum_is_different --file="$final_path/config/public.js"
|
||||
ynh_backup_if_checksum_is_different --file="$final_path/config/private.js"
|
||||
|
||||
# ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$final_path/CONFIG_FILE"
|
||||
|
||||
# Recalculate and store the checksum of the config files for the next upgrade.
|
||||
ynh_store_file_checksum --file="$final_path/config/public.js"
|
||||
ynh_store_file_checksum --file="$final_path/config/private.js"
|
||||
|
||||
if [[ $autosynchronize == true ]]; then
|
||||
ynh_backup_if_checksum_is_different --file="/opt/couchdb/etc/local.d/$app.ini"
|
||||
ynh_store_file_checksum --file="/opt/couchdb/etc/local.d/$app.ini"
|
||||
fi
|
||||
ynh_add_systemd_config --others_var="ynh_node_load_PATH"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -204,9 +156,9 @@ yunohost service add $app --description="Data storage with a convenient and flex
|
|||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=60
|
||||
ynh_script_progression --message="Starting dato app service and building pages..." --weight=60
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="electrode server listening on port"
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="electrode server listening on port" --timeout=600
|
||||
|
||||
# #=================================================
|
||||
# # UPGRADE FAIL2BAN
|
||||
|
|
Loading…
Reference in a new issue