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 postgresql #597

Open
wants to merge 477 commits into
base: testing
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 100 commits
Commits
Show all changes
477 commits
Select commit Hold shift + click to select a range
a52df89
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Jul 30, 2024
e215d9c
find files before chown them
kay0u Jul 30, 2024
5dc5e8b
chown the root folder too
kay0u Jul 30, 2024
8d682cb
fix find condition
kay0u Jul 31, 2024
706d507
find ... chmod is not faster, at least avoid to chown -R the data_dir…
kay0u Jul 31, 2024
d240d55
add a button in the config panel to run chown/chmod on data_dir
kay0u Jul 31, 2024
30b2d81
we can avoid this chmod too i guess?
kay0u Jul 31, 2024
55b5c79
only nextcloud is allowed to read the config file
kay0u Jul 31, 2024
07f90a8
zblerg, the config file doesn't exist before install
kay0u Aug 1, 2024
5556fb6
wait until nginx has actually remove the nextcloud conf during upgrad…
kay0u Aug 1, 2024
d7f9b2c
create a function for that
kay0u Aug 1, 2024
49ec72b
fix change-url dav detection
kay0u Aug 1, 2024
73a3498
only if domain has changed...
kay0u Aug 1, 2024
fa5da4f
Update scripts/_common.sh
kay0u Aug 1, 2024
79c87b1
Merge pull request #712 from YunoHost-Apps/fix-dav-detection
kay0u Aug 1, 2024
4372e3d
Merge pull request #711 from YunoHost-Apps/speedup-chown
kay0u Aug 1, 2024
ad86334
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Aug 1, 2024
8a7f99d
moar sleep
kay0u Aug 1, 2024
5e498de
oups
kay0u Aug 1, 2024
8cfdb4f
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Aug 2, 2024
f985ed4
Update _common.sh
ericgaspar Aug 3, 2024
e83c680
minor typos
ericgaspar Aug 3, 2024
a86e321
Update backup
ericgaspar Aug 3, 2024
31fd6a5
minor typos
ericgaspar Aug 3, 2024
2f88a3e
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Aug 3, 2024
bf5ef59
Merge branch 'master' into testing
ericgaspar Aug 8, 2024
b6793f8
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Aug 8, 2024
1c8a1ba
Fix removing ACL permissions on uninstall
x3rAx Aug 13, 2024
aae9736
Fix: Add missing `file` argument to `setfacl`
x3rAx Aug 13, 2024
abfb04d
Fix: Use absolute path for removing ACL permissions
x3rAx Aug 13, 2024
d8737db
Update manifest.toml
ericgaspar Aug 20, 2024
a531164
Auto-update READMEs
yunohost-bot Aug 20, 2024
79ef249
Update manifest.toml
ericgaspar Aug 20, 2024
2794d04
Auto-update READMEs
yunohost-bot Aug 20, 2024
291157f
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Aug 22, 2024
d7d2403
Add notify push option (#417)
kay0u Aug 27, 2024
42a511f
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Aug 27, 2024
9da7de2
Merge pull request #717 from x3rAx/patch-1
kay0u Aug 27, 2024
047cfa3
Merge branch 'master' into testing
ericgaspar Aug 27, 2024
5f3de8b
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Aug 27, 2024
aca04bd
Remove ~duplicate pre-upgrade message (#723)
alexAubin Aug 30, 2024
19ae3b0
Fix notify_push after reboot/restart the service, create the folder /…
kay0u Sep 1, 2024
aa5842d
Update manifest.toml
ericgaspar Sep 3, 2024
6f7509a
Auto-update READMEs
yunohost-bot Sep 3, 2024
5164bc7
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Sep 3, 2024
46bffb0
Update backup
ericgaspar Sep 3, 2024
294298d
Update upgrade
ericgaspar Sep 3, 2024
4e0a635
Update upgrade
ericgaspar Sep 3, 2024
22e9fb5
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Sep 12, 2024
090070c
Auto-update READMEs
yunohost-bot Sep 12, 2024
af3a571
29.0.7
ericgaspar Sep 12, 2024
f43dc34
Auto-update READMEs
yunohost-bot Sep 12, 2024
3d6ee20
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Sep 12, 2024
fd7cfa6
30.0.0
ericgaspar Sep 14, 2024
9b0133f
Update manifest.toml
ericgaspar Sep 14, 2024
68d6833
Auto-update READMEs
yunohost-bot Sep 14, 2024
6c8718d
cleaning
ericgaspar Sep 15, 2024
63cf35d
Add comment about the cron check for high perf backend
alexAubin Sep 18, 2024
7a1274d
Add extended description of the notify push option
alexAubin Sep 18, 2024
82bd58f
Merge branch 'master' into testing
ericgaspar Sep 18, 2024
bb6200c
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Sep 18, 2024
e7c5a94
Fixed backup (#732)
orhtej2 Sep 25, 2024
77e3ed5
Auto-update READMEs
yunohost-bot Sep 25, 2024
ab2df75
Update backup
ericgaspar Sep 25, 2024
28ac86d
cleaning
ericgaspar Sep 25, 2024
ae9f506
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Sep 27, 2024
3c23d05
cleaning
ericgaspar Sep 27, 2024
d1d315c
Update ADMIN.md (#734)
tomdereub Sep 30, 2024
7701925
Merge branch 'master' into testing
ericgaspar Sep 30, 2024
a5c5b13
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Sep 30, 2024
616b11b
Update ADMIN.md (#734)
tomdereub Sep 30, 2024
978e71f
Add experimental curl tests
alexAubin Aug 24, 2024
27202f9
Merge remote-tracking branch 'origin/testing' into v2_PostgreSQL
ericgaspar Oct 1, 2024
f1cd393
Update tests.toml
ericgaspar Oct 1, 2024
5070326
Update tests.toml
ericgaspar Oct 1, 2024
cca6695
Update config
ericgaspar Oct 2, 2024
7a23074
29.0.8
ericgaspar Oct 10, 2024
fa49faa
Auto-update READMEs
yunohost-bot Oct 10, 2024
9cee1eb
fix linter
ericgaspar Oct 11, 2024
e317420
fix linter
ericgaspar Oct 11, 2024
d0804d6
Update manifest.toml
ericgaspar Oct 11, 2024
7d6591f
cleaning
ericgaspar Oct 11, 2024
12bca63
Update remove
ericgaspar Oct 11, 2024
b3ac029
Update tests.toml
ericgaspar Oct 14, 2024
219ede2
Update manifest.toml
ericgaspar Oct 17, 2024
eea5c59
Auto-update READMEs
yunohost-bot Oct 17, 2024
12737f2
Update install
ericgaspar Oct 25, 2024
1b9777c
Update install
ericgaspar Oct 25, 2024
53012e4
Update config_panel.toml
ericgaspar Oct 25, 2024
cc04eb6
Add fr translation
ericgaspar Oct 25, 2024
e8e04de
remove duplicate extension "js" (#742)
ericgaspar Oct 25, 2024
d1b1b97
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Oct 25, 2024
8f8a3af
Update config_panel.toml
ericgaspar Oct 25, 2024
83dd697
Update manifest.toml
ericgaspar Oct 31, 2024
31e8c7a
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Nov 3, 2024
960a061
fix translations
ericgaspar Nov 3, 2024
b420d09
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Nov 3, 2024
13f1a40
Update config_panel.toml
ericgaspar Nov 3, 2024
ccbdda1
Update config_panel.toml
ericgaspar Nov 3, 2024
fb76147
Update config_panel.toml
ericgaspar Nov 3, 2024
fc03006
Update config_panel.toml
ericgaspar Nov 3, 2024
c523500
Update config_panel.toml
ericgaspar Nov 3, 2024
b100f02
Update manifest.toml
ericgaspar Nov 3, 2024
801b5b1
Update manifest.toml
ericgaspar Nov 3, 2024
c738087
Update manifest.toml
ericgaspar Nov 3, 2024
bd68f75
Update manifest.toml
ericgaspar Nov 3, 2024
c9b8e60
Update manifest.toml
ericgaspar Nov 3, 2024
81958af
Update manifest.toml
ericgaspar Nov 3, 2024
e454580
Update install
ericgaspar Nov 3, 2024
1456e66
cleaning
ericgaspar Nov 3, 2024
3195268
cleaning
ericgaspar Nov 3, 2024
ba124ac
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Nov 3, 2024
62ed82c
cleaning
ericgaspar Nov 4, 2024
67ea5d8
cleaning
ericgaspar Nov 4, 2024
3fce63e
Auto-update READMEs
yunohost-bot Nov 4, 2024
2781404
add link to the help menu
ericgaspar Nov 4, 2024
6f868da
remove onlyoffice doc (#743)
ericgaspar Nov 4, 2024
96c0aaf
cleaning
ericgaspar Nov 4, 2024
2a296b7
Auto-update READMEs
yunohost-bot Nov 4, 2024
f235e0d
Update DESCRIPTION.md
ericgaspar Nov 4, 2024
9015178
Merge branch 'testing' of https://github.com/YunoHost-Apps/nextcloud_…
ericgaspar Nov 4, 2024
b48322e
Auto-update READMEs
yunohost-bot Nov 4, 2024
3f09926
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Nov 4, 2024
51b65ef
Auto-update READMEs
yunohost-bot Nov 4, 2024
5775213
cleaning
ericgaspar Nov 4, 2024
f713adf
Update install
ericgaspar Nov 4, 2024
6fdae34
cleaning options (#744)
ericgaspar Nov 4, 2024
4dcc964
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Nov 4, 2024
6adab0f
Update remove
ericgaspar Nov 4, 2024
f830038
Update tests.toml
ericgaspar Nov 5, 2024
0b374b1
Update tests.toml
ericgaspar Nov 6, 2024
159848e
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Nov 6, 2024
41ecf07
Update manifest.toml
ericgaspar Nov 7, 2024
ee48880
Auto-update READMEs
yunohost-bot Nov 7, 2024
47fe09a
29.0.9 (#747)
ericgaspar Nov 7, 2024
ccf915d
Merge branch 'master' into testing
ericgaspar Nov 7, 2024
8e9d4a1
Update restore
grenagit Nov 11, 2024
e095ec2
Merge pull request #751 from grenagit/master
orhtej2 Nov 11, 2024
186ee85
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Nov 11, 2024
be0378e
30.0.2 (#729)
ericgaspar Nov 17, 2024
4251386
Merge branch 'master' into testing
ericgaspar Nov 17, 2024
b01ace6
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Nov 17, 2024
2b41e99
[comit] Forward Email?
Thatoo Nov 17, 2024
383f3b7
Update config_panel.toml
Thatoo Nov 17, 2024
c7f7043
Update config_panel.toml
Thatoo Nov 17, 2024
16b5030
Update config_panel.toml
Thatoo Nov 17, 2024
e908223
Update config_panel.toml
Thatoo Nov 17, 2024
9790ea9
Update config_panel.toml
Thatoo Nov 17, 2024
866fb3c
Update tests.toml
ericgaspar Nov 27, 2024
cbc06de
add name nextcloud LDAP config to get__enable_forward_email
Thatoo Dec 1, 2024
9e5bcc1
Add quote in if [ $(cmd) = value ] because i'm paranoid about [ synta…
alexAubin Dec 3, 2024
eb0d815
Merge pull request #753 from Thatoo/testing
alexAubin Dec 3, 2024
b9354d0
Auto-update READMEs
yunohost-bot Dec 3, 2024
d5dc328
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Dec 3, 2024
f462401
Update manifest.toml: revert to 29.0.8 with prefetch = false to fix t…
alexAubin Dec 3, 2024
b7b5f34
Disable output buffering (#758)
tituspijean Dec 3, 2024
bbc4016
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Dec 3, 2024
aea6a8d
Update backup
ericgaspar Dec 3, 2024
bbe67c1
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Dec 3, 2024
4ec797a
Update manifest.toml
ericgaspar Dec 5, 2024
e4b820d
Auto-update READMEs
yunohost-bot Dec 5, 2024
9c62179
Update manifest.toml
ericgaspar Dec 5, 2024
bb2c68f
Auto-update READMEs
yunohost-bot Dec 5, 2024
f7b29ec
Update manifest.toml
ericgaspar Dec 5, 2024
86f7bcd
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Dec 5, 2024
503d43e
Merge branch 'master' into testing
ericgaspar Dec 5, 2024
a40c87d
Auto-update READMEs
yunohost-bot Dec 5, 2024
0963e9f
Update upgrade
ericgaspar Dec 5, 2024
c8bf2fa
Update tests.toml
ericgaspar Dec 6, 2024
53e1dac
Update upgrade
ericgaspar Dec 7, 2024
daae841
Update scripts/upgrade: gotta use -E for grep to recognize the + quan…
alexAubin Dec 10, 2024
a29f995
Helpers 2.1 (v30.0.3) (#746)
ericgaspar Dec 10, 2024
e3c200f
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Dec 10, 2024
e6ada49
fix
ericgaspar Dec 11, 2024
be5f0d3
fix
ericgaspar Dec 11, 2024
e13f8b0
Update install
ericgaspar Dec 11, 2024
befff2c
Update upgrade
ericgaspar Dec 11, 2024
099d3f5
Update upgrade
ericgaspar Dec 11, 2024
2d4c475
Update upgrade
ericgaspar Dec 11, 2024
079f46d
fix linter (#761)
ericgaspar Dec 11, 2024
738d340
Update upgrade
ericgaspar Dec 11, 2024
f1d20fa
Update upgrade
ericgaspar Dec 11, 2024
0819230
Update upgrade
ericgaspar Dec 11, 2024
d4a85b7
Update upgrade
ericgaspar Dec 11, 2024
ec20544
Update manifest.toml
ericgaspar Dec 11, 2024
765e53c
Update upgrade
ericgaspar Dec 11, 2024
393c62f
Update backup
ericgaspar Dec 11, 2024
3681366
Update install
ericgaspar Dec 11, 2024
b4a9834
cleaning
ericgaspar Dec 11, 2024
d70264b
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Dec 11, 2024
ddbd0d2
Fix linter
ericgaspar Dec 11, 2024
0065032
Update nginx.conf
ericgaspar Dec 11, 2024
7a3de93
Update nginx.conf
ericgaspar Dec 11, 2024
7bd9ff8
Update nginx.conf
ericgaspar Dec 11, 2024
22449fe
Update nginx.conf
ericgaspar Dec 11, 2024
6c9727c
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Dec 11, 2024
9de599d
Update nginx.conf
ericgaspar Dec 11, 2024
125789f
Update nginx.conf
ericgaspar Dec 11, 2024
3acdd4e
Update nginx.conf
ericgaspar Dec 11, 2024
f482f01
Update nginx.conf
ericgaspar Dec 11, 2024
cfa6ef0
Update nginx.conf
ericgaspar Dec 11, 2024
53ded55
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Dec 11, 2024
e0a2903
Update nginx.conf
ericgaspar Dec 11, 2024
6fa35e0
Update nginx.conf
ericgaspar Dec 11, 2024
9b21787
Update nginx.conf
ericgaspar Dec 11, 2024
43a05fe
Update nginx.conf
ericgaspar Dec 11, 2024
27a0f35
Update nginx.conf
ericgaspar Dec 11, 2024
3792e6a
Update nginx.conf
ericgaspar Dec 11, 2024
2405cc4
Update nginx.conf
ericgaspar Dec 11, 2024
284ce68
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Dec 11, 2024
0de16ba
Update nginx.conf
ericgaspar Dec 11, 2024
28bf9b0
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Dec 11, 2024
8bc0cff
Update manifest.toml
ericgaspar Dec 12, 2024
2e9a4c3
Auto-update READMEs
yunohost-bot Dec 12, 2024
c291b2e
Update manifest.toml
ericgaspar Dec 12, 2024
3aa9f9c
Update manifest.toml
ericgaspar Dec 12, 2024
807afd3
Auto-update READMEs
yunohost-bot Dec 12, 2024
31bbb25
fix
ericgaspar Dec 12, 2024
6912d19
Merge branch 'v2_PostgreSQL' of https://github.com/YunoHost-Apps/next…
ericgaspar Dec 12, 2024
893daef
fix
ericgaspar Dec 12, 2024
fc6f6d1
cleaning
ericgaspar Dec 12, 2024
e577054
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Dec 14, 2024
fb3b792
cleaning
ericgaspar Dec 16, 2024
c69a918
Merge branch 'master' into testing
ericgaspar Dec 16, 2024
d2da1e9
cleaning
ericgaspar Dec 16, 2024
01c4e95
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Dec 16, 2024
7638991
Update restore
ericgaspar Dec 16, 2024
21f3762
Update nginx.conf
ericgaspar Dec 17, 2024
ccb2852
Update nginx.conf
ericgaspar Dec 17, 2024
d7f97a7
Update nginx.conf
ericgaspar Dec 17, 2024
c159f38
Update nginx.conf
ericgaspar Dec 17, 2024
a0cd8e2
Update nginx.conf
ericgaspar Dec 17, 2024
8b0d660
Update nginx.conf
ericgaspar Dec 17, 2024
9f434e5
Update nginx.conf
ericgaspar Dec 17, 2024
6e5bf97
Update nginx.conf
ericgaspar Dec 17, 2024
e785d25
add headers (#763)
ericgaspar Dec 17, 2024
94316af
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Dec 17, 2024
2a8269b
Update manifest.toml
ericgaspar Dec 17, 2024
cc6a64f
Update manifest.toml
ericgaspar Dec 17, 2024
43aae5d
Update nginx.conf
ericgaspar Dec 17, 2024
f6be830
Update tests.toml
ericgaspar Dec 18, 2024
fd1be95
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Dec 19, 2024
bab7c6f
Merge branch 'master' into testing
ericgaspar Dec 19, 2024
0add99d
move function to common.sh (#764)
ericgaspar Dec 19, 2024
3ad7fa1
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Dec 19, 2024
1e41918
add default_phone_region
ericgaspar Dec 19, 2024
f7a653d
Update nginx.conf
ericgaspar Dec 19, 2024
c0ef5cc
Merge branch 'testing' into v2_PostgreSQL
ericgaspar Dec 19, 2024
46b5d9a
Update nginx.conf
ericgaspar Dec 19, 2024
fa73bf6
Update remove
ericgaspar Dec 19, 2024
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 conf/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"hashing_default_password": true,
"localstorage.allowsymlinks": true,
"simpleSignUpLink.shown": false,
"default_phone_region": "",
"mail_smtpmode": "smtp",
"mail_smtpport": "25",
"mail_smtpauth": 1,
Expand Down
2 changes: 1 addition & 1 deletion conf/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ location ^~ __PATH__/ {
# that file is correctly served; if it doesn't, then the request is passed to
# the front-end controller. This consistent behaviour means that we don't need
# to specify custom rules for certain paths (e.g. images and other assets,
# `/updater`, `/ocm-provider`, `/ocs-provider`), and thus
# `/updater`, `/ocs-provider`), and thus
# `try_files $uri $uri/ /nextcloud/index.php$request_uri`
# always provides the desired behaviour.
index index.php index.html __PATH__/index.php$request_uri;
Expand Down
8 changes: 4 additions & 4 deletions manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name = "Nextcloud"
description.en = "Online storage, file sharing platform and various other applications"
description.fr = "Stockage en ligne, plateforme de partage de fichiers et diverses autres applications"

version = "28.0.1~ynh1"
version = "28.0.1~ynh2"

maintainers = ["kay0u"]

Expand Down Expand Up @@ -73,8 +73,8 @@ ram.runtime = "512M"
api.allowed = ["visitors", "all_users"]

[resources.apt]
packages = "mariadb-server, imagemagick, libmagickcore-6.q16-6-extra, acl, tar, smbclient, at, php8.2-fpm, php8.2-bz2, php8.2-imap, php8.2-gmp, php8.2-gd, php8.2-intl, php8.2-curl, php8.2-apcu, php8.2-redis, php8.2-ldap, php8.2-imagick, php8.2-zip, php8.2-mbstring, php8.2-xml, php8.2-mysql, php8.2-igbinary, php8.2-bcmath"
packages = "postgresql, imagemagick, libmagickcore-6.q16-6-extra, acl, tar, smbclient, at, php8.2-pgsql, php8.2-fpm, php8.2-bz2, php8.2-imap, php8.2-gmp, php8.2-gd, php8.2-intl, php8.2-curl, php8.2-apcu, php8.2-redis, php8.2-ldap, php8.2-imagick, php8.2-zip, php8.2-mbstring, php8.2-xml, php8.2-igbinary, php8.2-bcmath"

[resources.database]
type = "mysql"

type = "postgresql"

36 changes: 0 additions & 36 deletions scripts/_ynh_mysql_connect_as.sh

This file was deleted.

37 changes: 0 additions & 37 deletions scripts/_ynh_mysql_dump_db.sh

This file was deleted.

7 changes: 3 additions & 4 deletions scripts/backup
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
source ../settings/scripts/_ynh_mysql_dump_db.sh

#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
Expand Down Expand Up @@ -61,11 +60,11 @@ ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
ynh_backup --src_path="/etc/cron.d/$app"

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

ynh_mysql_dump_db --database="$db_name" --default_character_set="utf8mb4" > db.sql
ynh_psql_dump_db --database="$db_name" > db.sql

#=================================================
# END OF SCRIPT
Expand Down
25 changes: 8 additions & 17 deletions scripts/install
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,11 @@

source _common.sh
source /usr/share/yunohost/helpers
source _ynh_mysql_connect_as.sh

phpflags="--define apc.enable_cli=1"

ynh_app_setting_set --app=$app --key=phpflags --value=$phpflags

#=================================================
# CREATE A MYSQL DATABASE
#=================================================
ynh_script_progression --message="Migrate MySQL database to utf8..." --weight=2

ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name \
<<< "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"

#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
Expand Down Expand Up @@ -85,7 +76,7 @@ admin_password="$(ynh_string_random --length=6)"

# Install Nextcloud using a temporary admin user
exec_occ maintenance:install \
--database "mysql" --database-name $db_name \
--database "pgsql" --database-name $db_name \
--database-user $db_user --database-pass "$db_pwd" \
--admin-user "admin" --admin-pass "$admin_password" \
--data-dir "$data_dir/data" \
Expand All @@ -96,9 +87,6 @@ exec_occ maintenance:install \
#=================================================
ynh_script_progression --message="Configuring $app..." --weight=8

# Set the mysql.utf8mb4 config to true in config.php
exec_occ config:system:set mysql.utf8mb4 --type boolean --value="true"

# Ensure that UpdateNotification app is disabled
exec_occ app:disable updatenotification

Expand All @@ -108,7 +96,7 @@ exec_occ ldap:create-empty-config

# Load the installation config file in Nextcloud
nc_conf="$install_dir/config_install.json"
ynh_add_config --template="../conf/config_install.json" --destination="$nc_conf"
ynh_add_config --template="config_install.json" --destination="$nc_conf"

exec_occ config:import "$nc_conf"

Expand All @@ -117,7 +105,7 @@ ynh_secure_remove --file="$nc_conf"

# Load the additional config file (used also for upgrade)
nc_conf="$install_dir/config.json"
ynh_add_config --template="../conf/config.json" --destination="$nc_conf"
ynh_add_config --template="config.json" --destination="$nc_conf"

exec_occ config:import "$nc_conf"

Expand Down Expand Up @@ -184,8 +172,9 @@ exec_occ config:system:set overwrite.cli.url --value="https://${domain}${path}"
#=================================================

# Set the user as admin
ynh_mysql_connect_as --user=$db_name --password="$db_pwd" --database=$db_name --default_character_set="utf8mb4" \
ynh_psql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name \
<<< "INSERT INTO oc_group_user VALUES ('admin','$admin');"

# And delete admin user
exec_occ user:delete admin

Expand All @@ -201,7 +190,7 @@ ynh_store_file_checksum --file="$install_dir/config/config.php"
#=================================================

cron_path="/etc/cron.d/$app"
ynh_add_config --template="../conf/nextcloud.cron" --destination="$cron_path"
ynh_add_config --template="nextcloud.cron" --destination="$cron_path"
chown root: "$cron_path"
chmod 644 "$cron_path"

Expand All @@ -222,10 +211,12 @@ ynh_script_progression --message="Adding multimedia directories..." --weight=6

# Build YunoHost multimedia directories
ynh_multimedia_build_main_dir

# Mount the user directory in Nextcloud
exec_occ app:enable files_external
create_external_storage "/home/yunohost.multimedia/\$user" "Multimedia"
create_external_storage "/home/yunohost.multimedia/share" "Shared multimedia"

# Allow nextcloud to write into these directories
ynh_multimedia_addaccess $app

Expand Down
11 changes: 5 additions & 6 deletions scripts/restore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
source ../settings/scripts/_ynh_mysql_connect_as.sh

#=================================================
# STANDARD RESTORATION STEPS
Expand All @@ -14,21 +13,21 @@ ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$install_dir"

#=================================================
# RESTORE THE MYSQL DATABASE
# RESTORE THE POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the MySQL database..." --weight=9
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=9

ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name --default_character_set="utf8mb4" < ./db.sql
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql

#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=50
ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=5

# Restore the file first, so it can have a backup if different
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"

# Recreate a dedicated php-fpm config
# Recreate a dedicated PHP-FPM config
ynh_add_fpm_config

#=================================================
Expand Down
67 changes: 44 additions & 23 deletions scripts/upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,34 @@ exec_occ() {
php$NEXTCLOUD_PHP_VERSION --define apc.enable_cli=1 occ --no-interaction --no-ansi "$@")
}

#=================================================
# HANDLE DATABASE MIGRATION FROM MYSL TO PSQL
#=================================================

mysql_db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)

if [ -n "$mysql_db_pwd" ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we can really rely on the mysqlpwd ... It's supposed to be automatically deleted and renamed to db_pwd during the v1->v2 transition (so before running this script), cf https://github.com/YunoHost/yunohost/blob/dev/src/utils/resources.py#L1366-L1372

Copy link
Member Author

@ericgaspar ericgaspar Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

then
ynh_script_progression --message="Migrating to PostgreSQL database..." --weight=3

#ynh_backup_if_checksum_is_different --file="$install_dir/config/config.php"

ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name #--db_pwd=$(ynh_string_random)
#ynh_app_setting_set --app=$app --key=psqlpwd --value=$db_pwd
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we are in packaging v2, the DB should already be provisioned before the upgrade happens so eeeeh


exec_occ db:convert-type --all-apps --clear-schema pgsql $db_name 127.0.0.1 $db_name --password=$db_pwd -n

ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
ynh_app_setting_delete --app=$app --key=mysqlpwd

#ynh_store_file_checksum --file="${install_dir}/config/config.php"
fi
ericgaspar marked this conversation as resolved.
Show resolved Hide resolved

#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================

# Define a function to add an external storage
# Create the external storage for the given folders and enable sharing
create_external_storage() {
Expand Down Expand Up @@ -90,15 +118,6 @@ then
# Print the current version number of Nextcloud
exec_occ -V

if [ "$(exec_occ config:system:get mysql.utf8mb4)" != "true" ]; then
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
# Change your databases character set and collation
ynh_mysql_connect_as --user=$db_user --password="$db_pwd" --database=$db_name \
<<< "ALTER DATABASE $db_name CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;"
# Set the mysql.utf8mb4 config to true in config.php
exec_occ config:system:set mysql.utf8mb4 --type boolean --value="true"
exec_occ maintenance:repair
fi

# Upgrade may fail if this app is enabled
# Take all apps enabled, and check if mail is one of them
Expand Down Expand Up @@ -202,13 +221,13 @@ EOF
#=================================================
# CONFIGURE NEXTCLOUD
#=================================================
ynh_script_progression --message="Reconfiguring Nextcloud..." --weight=9
ynh_script_progression --message="Reconfiguring $app..." --weight=9

# Verify the checksum and backup the file if it's different
ynh_backup_if_checksum_is_different --file="$install_dir/config/config.php"

nc_conf="${install_dir}/config.json"
ynh_add_config --template="../conf/config.json" --destination="$nc_conf"
ynh_add_config --template="config.json" --destination="$nc_conf"

# Reneable the mail app
if [ $mail_app_must_be_reactived -eq 1 ]; then
Expand Down Expand Up @@ -275,7 +294,7 @@ EOF
fi

#=================================================
# REGEN SYSTEM CONFIGURATIONS
# REGEN PERMISSIONS
#=================================================
ynh_script_progression --message="Reapplying file permissions..." --weight=2

Expand All @@ -295,15 +314,15 @@ chmod 750 $install_dir
#=================================================
ynh_script_progression --message="Regenerating system configurations for $app..." --weight=2

# -------
#-------------------------------------------------
# PHP-FPM
# -------
#-------------------------------------------------

ynh_add_fpm_config

# -------
#-------------------------------------------------
# NGINX
# -------
#-------------------------------------------------

# Delete current NGINX configuration to be able to check if .well-known is already served.
ynh_backup_if_checksum_is_different --file="/etc/nginx/conf.d/$domain.d/$app.conf"
Expand All @@ -325,27 +344,29 @@ fi
# Create a dedicated NGINX config
ynh_add_nginx_config

# -------
#-------------------------------------------------
# CRON JOB
# -------
#-------------------------------------------------

cron_path="/etc/cron.d/$app"
ynh_add_config --template="../conf/nextcloud.cron" --destination="$cron_path"
chown root: "$cron_path"
chmod 644 "$cron_path"

exec_occ background:cron

# -------
#-------------------------------------------------
# LOGROTATE
# -------
#-------------------------------------------------

ynh_use_logrotate --non-append

# -------
#-------------------------------------------------
# FAIL2BAN
# -------
#-------------------------------------------------

# Create a dedicated Fail2Ban config
ynh_add_fail2ban_config --logpath="/home/yunohost.app/$app/data/nextcloud.log" --failregex="^.*Login failed: '.*' \(Remote IP: '<HOST>'.*$" --max_retry=5
ynh_add_fail2ban_config --logpath="$data_dir/data/nextcloud.log" --failregex="^.*Login failed: '.*' \(Remote IP: '<HOST>'.*$" --max_retry=5

#=================================================
# END OF SCRIPT
Expand Down
Loading