convert nextcloud db from mysql to postgres

This commit is contained in:
Noah Masur 2024-02-25 22:31:02 +00:00
parent a5ec39cd2a
commit 8babcf342b
2 changed files with 19 additions and 1 deletions

View File

@ -63,3 +63,20 @@ Use this mysqldump command:
sudo -u nextcloud mysqldump -S /run/mysqld/mysqld.sock --default-character-set=utf8mb4 nextcloud > backup.sql sudo -u nextcloud mysqldump -S /run/mysqld/mysqld.sock --default-character-set=utf8mb4 nextcloud > backup.sql
``` ```
## Converting to Postgres
Same as MySQL, but run this command instead:
```
sudo -u nextcloud nextcloud-occ db:convert-type pgsql nextcloud /run/postgresql/ nextcloud
```
Then set the `dbtype` to `pgsql`.
## Backing Up Postgres Database
Use this pg_dump command:
```
sudo -u nextcloud pg_dump nextcloud > backup.sql
```

View File

@ -12,13 +12,14 @@
maxUploadSize = "50G"; maxUploadSize = "50G";
config = { config = {
adminpassFile = config.secrets.nextcloud.dest; adminpassFile = config.secrets.nextcloud.dest;
dbtype = "mysql"; dbtype = "pgsql";
}; };
settings = { settings = {
default_phone_region = "US"; default_phone_region = "US";
# Allow access when hitting either of these hosts or IPs # Allow access when hitting either of these hosts or IPs
trusted_domains = [ config.hostnames.content ]; trusted_domains = [ config.hostnames.content ];
trusted_proxies = [ "127.0.0.1" ]; trusted_proxies = [ "127.0.0.1" ];
maintenance_window_start = 4; # Run jobs at 4am UTC
}; };
extraAppsEnable = true; extraAppsEnable = true;
extraApps = with config.services.nextcloud.package.packages.apps; { extraApps = with config.services.nextcloud.package.packages.apps; {