Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V2 postgre sql helpers 2.1 #730

Open
wants to merge 19 commits into
base: v2_PostgreSQL
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*~
*.sw[op]
.DS_Store
128 changes: 64 additions & 64 deletions conf/config.json
Original file line number Diff line number Diff line change
@@ -1,64 +1,64 @@
{
"system": {
"updatechecker": false,
"memcache.local": "\\OC\\Memcache\\APCu",
"integrity.check.disabled": true,
"filelocking.enabled": true,
"memcache.locking": "\\OC\\Memcache\\Redis",
"redis": {
"host": "localhost",
"port": "6379",
"timeout": "0.0",
"password": ""
},
"hashing_default_password": true,
"localstorage.allowsymlinks": true,
"simpleSignUpLink.shown": false,
"default_phone_region": "",
"maintenance_window_start": 1,
"mail_smtpmode": "smtp",
"mail_smtpport": "25",
"mail_smtpauth": 1,
"mail_smtpname": "__APP__",
"mail_smtppassword": "__MAIL_PWD__",
"mail_sendmailmode": "smtp",
"mail_from_address": "__APP__",
"mail_domain": "__DOMAIN__",
"mail_smtphost": "localhost",
"mail_smtpstreamoptions": {
"ssl": {
"allow_self_signed": true,
"verify_peer": false,
"verify_peer_name": false
}
},
"trusted_proxies": [ "127.0.0.1", "::1" ]
},
"apps": {
"user_ldap": {
"ldap_base": "dc=yunohost,dc=org",
"ldap_base_groups": "ou=groups,dc=yunohost,dc=org",
"ldap_base_users": "ou=users,dc=yunohost,dc=org",
"ldap_cache_ttl": "600",
"ldap_configuration_active": "1",
"ldap_display_name": "displayname",
"ldap_email_attr": "mail",
"ldap_expert_username_attr": "uid",
"ldap_group_display_name": "cn",
"ldap_group_filter": "(&(objectclass=top)(memberUid=*))",
"ldap_group_filter_mode": "0",
"ldap_groupfilter_objectclass": "posixGroup",
"ldap_group_member_assoc_attribute": "memberUid",
"ldap_host": "localhost",
"ldap_login_filter": "(&(|(objectclass=posixAccount))(uid=%uid)(permission=cn=__APP__.main,ou=permission,dc=yunohost,dc=org))",
"ldap_login_filter_mode": "0",
"ldap_port": "389",
"ldap_quota_attr": "userquota",
"ldap_tls": "0",
"ldap_user_display_name": "cn",
"ldap_user_filter_mode": "0",
"ldap_userfilter_objectclass": "posixAccount",
"ldap_userlist_filter": "objectclass=posixAccount"
}
}
}
{
"system": {
"updatechecker": false,
"memcache.local": "\\OC\\Memcache\\APCu",
"integrity.check.disabled": true,
"filelocking.enabled": true,
"memcache.locking": "\\OC\\Memcache\\Redis",
"redis": {
"host": "localhost",
"port": "6379",
"timeout": "0.0",
"password": ""
},
"hashing_default_password": true,
"localstorage.allowsymlinks": true,
"simpleSignUpLink.shown": false,
"default_phone_region": "",
"maintenance_window_start": 1,
"mail_smtpmode": "smtp",
"mail_smtpport": "25",
"mail_smtpauth": 1,
"mail_smtpname": "__APP__",
"mail_smtppassword": "__MAIL_PWD__",
"mail_sendmailmode": "smtp",
"mail_from_address": "__APP__",
"mail_domain": "__DOMAIN__",
"mail_smtphost": "localhost",
"mail_smtpstreamoptions": {
"ssl": {
"allow_self_signed": true,
"verify_peer": false,
"verify_peer_name": false
}
},
"trusted_proxies": [ "127.0.0.1", "::1" ]
},
"apps": {
"user_ldap": {
"ldap_base": "dc=yunohost,dc=org",
"ldap_base_groups": "ou=groups,dc=yunohost,dc=org",
"ldap_base_users": "ou=users,dc=yunohost,dc=org",
"ldap_cache_ttl": "600",
"ldap_configuration_active": "1",
"ldap_display_name": "displayname",
"ldap_email_attr": "mail",
"ldap_expert_username_attr": "uid",
"ldap_group_display_name": "cn",
"ldap_group_filter": "(&(objectclass=top)(memberUid=*))",
"ldap_group_filter_mode": "0",
"ldap_groupfilter_objectclass": "posixGroup",
"ldap_group_member_assoc_attribute": "memberUid",
"ldap_host": "localhost",
"ldap_login_filter": "(&(|(objectclass=posixAccount))(uid=%uid)(permission=cn=__APP__.main,ou=permission,dc=yunohost,dc=org))",
"ldap_login_filter_mode": "0",
"ldap_port": "389",
"ldap_quota_attr": "userquota",
"ldap_tls": "0",
"ldap_user_display_name": "cn",
"ldap_user_filter_mode": "0",
"ldap_userfilter_objectclass": "posixAccount",
"ldap_userlist_filter": "objectclass=posixAccount"
}
}
}
3 changes: 0 additions & 3 deletions conf/extra_php-fpm.conf
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@

; Additional php.ini defines, specific to this pool of workers.
env[PATH] = $PATH
php_admin_value[memory_limit] = 512M
php_value[upload_max_filesize] = 10G
php_value[post_max_size] = 10G
php_value[default_charset] = UTF-8
; OPcache is already activated by default
; php_value[opcache.enable]=1
Expand Down
2 changes: 1 addition & 1 deletion conf/nextcloud.cron
Original file line number Diff line number Diff line change
@@ -1 +1 @@
*/5 * * * * __APP__ /usr/bin/php__PHPVERSION__ --define apc.enable_cli=1 -f __INSTALL_DIR__/cron.php
*/5 * * * * __APP__ /usr/bin/php__PHP_VERSION__ --define apc.enable_cli=1 -f __INSTALL_DIR__/cron.php
2 changes: 1 addition & 1 deletion conf/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ location ^~ __PATH__/ {
fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice
fastcgi_param front_controller_active true; # Enable pretty urls
fastcgi_param HTTP_ACCEPT_ENCODING ""; # Disable encoding of Nextcloud response to inject ynh scripts
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock;

fastcgi_intercept_errors on;
fastcgi_request_buffering off;
Expand Down
1 change: 1 addition & 0 deletions config_panel.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ name = "Nextcloud configuration"
ask.en = "Configure the High Performance Backend?"
ask.fr = "Configurer le Backend Hautes Performances ?"
type = "boolean"

help.en = "Also called 'notify push' and corresponds to a mechanism allowing more instantaneous notifications and reduce server load. (However, it is still a bit new and adds complexity to the setup)"
help.fr = "Aussi appelé 'notifications push' et corresponds à un mécanisme qui permet d'avoir des notifications plus rapides et de réduire la charge du serveur. (Cependant, cette fonctionnalité reste relativement nouvelle, et augmente la complexité de l'installation)"

Expand Down
8 changes: 5 additions & 3 deletions manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ code = "https:/nextcloud/server"
cpe = "cpe:2.3:a:nextcloud:nextcloud"

[integration]
yunohost = ">= 11.2.27"
yunohost = ">= 11.2.30"
helpers_version = "2.1"
architectures = ["amd64", "arm64", "armhf"]
multi_instance = true

Expand Down Expand Up @@ -77,8 +78,8 @@ ram.runtime = "512M"
sha256 = '18d7a80957bb53e94fb04492f6b5213434dda3e9da12d9f789997687c8564e60'

[resources.sources.29]
url = 'https://download.nextcloud.com/server/releases/nextcloud-29.0.7.tar.bz2'
sha256 = 'f532ffc31be5a8374b5e072b86fff8765ec19fda0c8509cee39873081db2c544'
url = 'https://download.nextcloud.com/server/releases/nextcloud-29.0.8.tar.bz2'
sha256 = '0ab54b517f76cd26f2bd38b6fe184b9fbaed32f734246c58c1acf83473c0a4b9'

[resources.sources.28]
url = 'https://download.nextcloud.com/server/releases/nextcloud-28.0.8.tar.bz2'
Expand Down Expand Up @@ -114,6 +115,7 @@ ram.runtime = "512M"
allow_email = true

[resources.install_dir]
group = "www-data:r-x"

[resources.data_dir]
subdirs = ["data"]
Expand Down
15 changes: 4 additions & 11 deletions scripts/_common.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
#!/bin/bash

#=================================================
# COMMON VARIABLES
#=================================================

#=================================================
# EXPERIMENTAL HELPERS
# COMMON VARIABLES AND CUSTOM HELPERS
#=================================================

wait_nginx_reload() {
# NGINX may take some time to support the new configuration,
# wait for the Nextcloud configuration file to disappear from NGINX before checking the CalDAV/CardDAV URL.
timeout=30
for i in $(seq 1 $timeout); do
if ! ynh_exec_warn_less nginx -T | grep --quiet "# configuration file /etc/nginx/conf.d/$domain.d/$app.conf:"; then
if ! ynh_hide_warnings nginx -T | grep --quiet "# configuration file /etc/nginx/conf.d/$domain.d/$app.conf:"; then
break
fi
sleep 1
done
# Wait untils NGINX has fully reloaded (avoid cURL fail with http2)
# Wait untils NGINX has fully reloaded (avoid cURL fail with http2)

sleep 2
}

Expand Down Expand Up @@ -53,7 +50,3 @@ is_url_handled() {
return 1
fi
}

#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================
37 changes: 17 additions & 20 deletions scripts/backup
Original file line number Diff line number Diff line change
Expand Up @@ -3,65 +3,62 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers

#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
ynh_print_info "Declaring files to be backed up..."

#=================================================
# BACKUP THE APP MAIN DIR
#=================================================

ynh_backup --src_path="$install_dir"
ynh_backup "$install_dir"

#=================================================
# BACKUP THE DATA DIRECTORY
#=================================================

ynh_backup --src_path="$data_dir" --is_big
ynh_backup "$data_dir"

#=================================================
# SYSTEM CONFIGURATION
#=================================================

ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.d"

ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.d"
ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf"

ynh_backup --src_path="/etc/logrotate.d/$app"
ynh_backup "/etc/logrotate.d/$app"

ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
ynh_backup "/etc/fail2ban/jail.d/$app.conf"
ynh_backup "/etc/fail2ban/filter.d/$app.conf"

#=================================================
# BACKUP VARIOUS FILES
#=================================================

ynh_backup --src_path="/etc/cron.d/$app"
ynh_backup "/etc/cron.d/$app"

ynh_backup --src_path="/var/log/$app"
ynh_backup "/var/log/$app"

#=================================================
# BACKUP THE POSTGRESQL DATABASE
#=================================================
ynh_print_info --message="Backing up the PostgreSQL database..."
ynh_print_info "Backing up the PostgreSQL database..."

ynh_psql_dump_db --database="$db_name" > db.sql
ynh_psql_dump_db > db.sql

#=================================================
# BACKUP THE NOTIFY_PUSH APP
#=================================================

if [ $enable_notify_push -eq 1 ]
then
ynh_backup --src_path="/etc/systemd/system/${app}-notify-push.service"
ynh_backup --src_path="/etc/systemd/system/${app}-notify-push-watcher.service"
ynh_backup --src_path="/etc/systemd/system/${app}-notify-push-watcher.path"
ynh_backup "/etc/systemd/system/${app}-notify-push.service"
ynh_backup "/etc/systemd/system/${app}-notify-push-watcher.service"
ynh_backup "/etc/systemd/system/${app}-notify-push-watcher.path"
fi

#=================================================
# 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)."
Loading