Projekt

Allgemein

Profil

Aktionen

Aufgabe #1161

offen

bei NixOS soll (testweise zur Vorbereitung) bei der Anwendung Nextcloud die Datenbank vom Typ SQLite zum Typ PostgreSQL überführt werden

Von PaulRiegel vor mehr als 2 Jahren hinzugefügt. Vor mehr als 2 Jahren aktualisiert.

Status:
Gelöst
Priorität:
Hoch
Kategorie:
Instanz Nextcloud
Beginn:
27.03.2022
Abgabedatum:
% erledigt:

80%

Geschätzter Aufwand:
(Gesamtzahl: 0:00 h)

Beschreibung

nextcloud-occ maintenance:mode --on

systemctl stop phpfpm-nextcloud.service

systemctl stop nginx.service

$EDITOR /etc/nixos/configuration.nix

  services.postgresql.enable = true;
  services.postgresql.ensureDatabases = [ "database4nextcloud2postgresql" ];
  services.postgresql.ensureUsers = [
    {
      name = "nextcloud";
      ensurePermissions."DATABASE database4nextcloud2postgresql" = "ALL PRIVILEGES";
    }
  ];

nixos-rebuild switch

Hinweis: Nach dem rebuild switch muss ggf. die services erneut gestopt werden

systemctl stop phpfpm-nextcloud.service

systemctl stop nginx.service

nextcloud-occ db:convert-type pgsql database4nextcloud2postgresql /run/postgresql database4nextcloud2postgresql

What is the database password?                                                                                                                                                                                                                

Creating schema in new database                                                                                                                                                                                                               
 - files                                                                                                                                                                                                                                      
 - accessibility                                                                                                                                                                                                                              
 - activity                                                                                                                                                                                                                                   
 - circles                                                                                                                                                                                                                                    
 - cloud_federation_api                                                                                                                                                                                                                       
 - comments                                                                                                                                                                                                                                   
 - contactsinteraction                                                                                                                                                                                                                        
 - dashboard                                                                                                                                                                                                                                  
 - dav                                                                                                                                                                                                                                        
 - federatedfilesharing                                                                                                                                                                                                                       
 - federation                                                                                                                                                                                                                                 
 - files_pdfviewer                                                                                                                                                                                                                            
 - files_rightclick                                                                                                                                                                                                                           
 - files_sharing                                                                                                                                                                                                                              
 - files_trashbin                                                                                                                                                                                                                             
 - files_versions                                                                                                                                                                                                                             
 - files_videoplayer                                                                                                                                                                                                                          
 - firstrunwizard                                                                                                                                                                                                                             
 - logreader                                                                                                                                                                                                                                  
 - lookup_server_connector                                                                                                                                                                                                                    
 - nextcloud_announcements                                                                                                                                                                                                                    
 - notifications                                                                                                                                                                                                                              
 - oauth2                                                                                                                                                                                                                                     
 - password_policy                                                                                                                                                                                                                            
 - photos                                                                                                                                                                                                                                     
 - privacy                                                                                                                                                                                                                                    
 - provisioning_api                                                                                                                                                                                                                           
 - recommendations                                                                                                                                                                                                                            
 - serverinfo                                                                                                                                                                                                                                 
 - settings                                                                                                                                                                                                                                   
 - sharebymail                                                                                                                                                                                                                                
 - support                                                                                                                                                                                                                                    
 - survey_client                                                                                                                                                                                                                              
 - systemtags                                                                                                                                                                                                                                 
 - text                                                                                                                                                                                                                                       
 - theming                                                                                                                                                                                                                                    
 - twofactor_backupcodes                                                                                                                                                                                                                      
 - updatenotification                                                                                                                                                                                                                         
 - user_status                                                                                                                                                                                                                                
 - viewer                                                                                                                                                                                                                                     
 - weather_status                                                                                                                                                                                                                             
 - workflowengine                                                                                                                                                                                                                             
 - oc_migrations                                                                                                                                                                                                                              
Skipping migrations table because it was already filled by running the migrations 
 - oc_filecache_extended                                                                                                                                                                                                                      
    0 [>---------------------------] < 1 sec                                                                                                                                                                                                  
 - oc_appconfig                                                                                                                                                                                                                               
 142/142 [============================] 100% 10 secs/10 secs                                                                                                                                                                                  
 - oc_storages                                                                                                                                                                                                                                
 2/2 [============================] 100% < 1 sec/< 1 sec                                                                                                                                                                                      
 - oc_direct_edit                                                                                                                                                                                                                             
    0 [>---------------------------] < 1 sec                                                                                                                                                                                                  
 - oc_webauthn                                                                                                                                                                                                                                
    0 [>---------------------------] < 1 sec                                                                                                                                                                                                  
 - oc_mimetypes
 9/9 [============================] 100%  1 sec/1 sec 
 - oc_filecache
 78/78 [============================] 100% 4 secs/4 secs
 - oc_group_user
 1/1 [============================] 100% < 1 sec/< 1 sec
 - oc_group_admin
    0 [>---------------------------] < 1 sec
 - oc_preferences
 9/9 [============================] 100%  1 sec/1 sec 
 - oc_groups
 1/1 [============================] 100% < 1 sec/< 1 sec
 - oc_storages_credentials
    0 [>---------------------------] < 1 sec
 - oc_accounts_data
 11/11 [============================] 100% < 1 sec/< 1 sec
 - oc_properties
    0 [>---------------------------] < 1 sec
 - oc_known_users
    0 [>---------------------------] < 1 sec
 - oc_users
 1/1 [============================] 100% < 1 sec/< 1 sec
 - oc_authorized_groups
    0 [>---------------------------] < 1 sec
 - oc_ratelimit_entries
    0 [>---------------------------] < 1 sec
 - oc_profile_config
 1/1 [============================] 100% < 1 sec/< 1 sec
 - oc_user_transfer_owner
    0 [>---------------------------] < 1 sec
 - oc_activity
 2/2 [============================] 100%  1 sec/1 sec 
 - oc_activity_mq
    0 [>---------------------------] < 1 sec
 - oc_circles_circle
 4/4 [============================] 100% < 1 sec/< 1 sec
 - oc_comments_read_markers
    0 [>---------------------------] < 1 sec
 - oc_circles_member
 5/5 [============================] 100% < 1 sec/< 1 sec
 - oc_accounts
 1/1 [============================] 100% < 1 sec/< 1 sec
 - oc_circles_remote
    0 [>---------------------------] < 1 sec
 - oc_mounts
 1/1 [============================] 100% < 1 sec/< 1 sec
 - oc_circles_event
 1/1 [============================] 100% < 1 sec/< 1 sec
 - oc_circles_membership
 4/4 [============================] 100%  1 sec/1 sec 
 - oc_circles_token
    0 [>---------------------------] < 1 sec
 - oc_circles_mount
    0 [>---------------------------] < 1 sec
 - oc_circles_mountpoint
    0 [>---------------------------] < 1 sec
 - oc_circles_share_lock
    0 [>---------------------------] < 1 sec
 - oc_recent_contact
    0 [>---------------------------] < 1 sec
 - oc_share
    0 [>---------------------------] < 1 sec
 - oc_addressbooks
 1/1 [============================] 100% < 1 sec/< 1 sec
 - oc_jobs
 32/32 [============================] 100% 2 secs/2 secs
 - oc_cards
    0 [>---------------------------] < 1 sec
 - oc_addressbookchanges
    0 [>---------------------------] < 1 sec
 - oc_bruteforce_attempts
    0 [>---------------------------] < 1 sec
 - oc_calendarobjects
    0 [>---------------------------] < 1 sec
 - oc_vcategory
    0 [>---------------------------] < 1 sec
 - oc_authtoken
 1/1 [============================] 100% < 1 sec/< 1 sec
 - oc_calendars
 1/1 [============================] 100% < 1 sec/< 1 sec
 - oc_calendarchanges
    0 [>---------------------------] < 1 sec
 - oc_vcategory_to_object
    0 [>---------------------------] < 1 sec
 - oc_systemtag
    0 [>---------------------------] < 1 sec
 - oc_calendarsubscriptions
    0 [>---------------------------] < 1 sec
 - oc_systemtag_object_mapping
    0 [>---------------------------] < 1 sec
 - oc_systemtag_group
    0 [>---------------------------] < 1 sec
 - oc_schedulingobjects
    0 [>---------------------------] < 1 sec
 - oc_file_locks
    0 [>---------------------------] < 1 sec
 - oc_calendar_resources_md
0 [>---------------------------] < 1 sec
 - oc_cards_properties
    0 [>---------------------------] < 1 sec
 - oc_calendarobjects_props
    0 [>---------------------------] < 1 sec
 - oc_dav_shares
    0 [>---------------------------] < 1 sec
 - oc_directlink
    0 [>---------------------------] < 1 sec
 - oc_comments
    0 [>---------------------------] < 1 sec
 - oc_calendar_resources
    0 [>---------------------------] < 1 sec
 - oc_collres_accesscache
    0 [>---------------------------] < 1 sec
 - oc_twofactor_providers
 1/1 [============================] 100% < 1 sec/< 1 sec
 - oc_whats_new
 1/1 [============================] 100% < 1 sec/< 1 sec
 - oc_collres_collections
    0 [>---------------------------] < 1 sec
 - oc_collres_resources
    0 [>---------------------------] < 1 sec
 - oc_login_flow_v2
    0 [>---------------------------] < 1 sec
 - oc_calendar_rooms
    0 [>---------------------------] < 1 sec
 - oc_calendar_invitations
    0 [>---------------------------] < 1 sec
 - oc_calendar_rooms_md
    0 [>---------------------------] < 1 sec
 - oc_dav_cal_proxy
    0 [>---------------------------] < 1 sec
 - oc_calendar_reminders
    0 [>---------------------------] < 1 sec
 - oc_federated_reshares
    0 [>---------------------------] < 1 sec
 - oc_trusted_servers
    0 [>---------------------------] < 1 sec
 - oc_share_external
    0 [>---------------------------] < 1 sec
 - oc_files_trash
    0 [>---------------------------] < 1 sec
 - oc_notifications
 6/6 [============================] 100% < 1 sec/< 1 sec
 - oc_notifications_pushhash
    0 [>---------------------------] < 1 sec
 - oc_notifications_settings
    0 [>---------------------------] < 1 sec
 - oc_oauth2_clients
    0 [>---------------------------] < 1 sec
 - oc_oauth2_access_tokens
    0 [>---------------------------] < 1 sec
 - oc_privacy_admins
    0 [>---------------------------] < 1 sec
 - oc_text_documents
    0 [>---------------------------] < 1 sec
 - oc_text_sessions
    0 [>---------------------------] < 1 sec
 - oc_text_steps
    0 [>---------------------------] < 1 sec
 - oc_twofactor_backupcodes
    0 [>---------------------------] < 1 sec
 - oc_user_status
 1/1 [============================] 100% < 1 sec/< 1 sec
 - oc_flow_checks
    0 [>---------------------------] < 1 sec
 - oc_flow_operations
    0 [>---------------------------] < 1 sec
 - oc_flow_operations_scope
    0 [>---------------------------] < 1 sec

$EDITOR /etc/nixos/configuration.nix

  systemd.services."nextcloud-setup".requires = ["postgresql.service"];
  systemd.services."nextcloud-setup".after = ["postgresql.service"];

  services.nextcloud.config.dbtype = "pgsql";
  services.nextcloud.config.dbname = "database4nextcloud2postgresql";
  services.nextcloud.config.dbhost = "/run/postgresql";
  services.nextcloud.config.dbuser = "database4nextcloud2postgresql";

nixos-rebuild switch

nextcloud-occ maintenance:mode --off


Untergeordnete Tickets 1 (1 offen0 geschlossen)

Aufgabe #1167: bei der Anwendung Nextcloud die Datenbank vom Typ SQLite zum Typ PostgreSQL überführenGelöstGoeranHeinemann27.03.2022

Aktionen
Aktionen #1

Von MichaelLeopold vor mehr als 2 Jahren aktualisiert

Aktionen #2

Von MichaelLeopold vor mehr als 2 Jahren aktualisiert

su postgres

psql

postgres=# \l

                                  List of databases
   Name    |   Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+-----------+----------+-------------+-------------+-----------------------
 nextcloud | nextcloud | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 postgres  | postgres  | UTF8     | en_US.UTF-8 | en_US.UTF-8 | 
 template0 | postgres  | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |           |          |             |             | postgres=CTc/postgres
 template1 | postgres  | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |           |          |             |             | postgres=CTc/postgres
(4 rows)

drop database nextcloud
create database nextcloud;
alter database nextcloud owner to nextcloud;

sqlite3 /var/lib/nextcloud/data/nextcloud.db
drop table oc_jobs;
.exit

Danach hat folgender Befehl ohne Probleme funktioniert:
nextcloud-occ db:convert-type --all-apps pgsql nextcloud /run/postgresql nextcloud

Aktionen

Auch abrufbar als: Atom PDF