Open link in a new tab

Content

Expand project menu

DB move from Cloud to local instance in Docker on Win11 PC

I wonder if you could help me? I have trialled OP online and want to move the project on to a local instance of OP running in a Docker Container on a Win11 PC.

I understand that this is not officially supported but I wonder if anyone could offer advice?

Firstly I installed Docker Desktop (along with associated VM BIOS changes etc.) then downloaded OpenProject as an image through Docker. It now runs nicely with the demo project. I was trying to follow the official documentation to migrate the data but as I'm not running on a Linux machine the process fails. I've requested the backup token and downloaded the openproject.sql file to my local machine. I couldn't find anything specific online so asked Perplexity and it generated a couple of guides for supposedly achieving the database migration and schema renaming but none has been successful. I wonder if you have any advice about how to go about this properly or existing guides online?

Many thanks, James

Message actions

This is the Answer I've been working through. I'm not sure it's corect but I have managed to get to stage 4. Error details below

Answer

To import an openproject.sql database backup from cloud-based storage into a local OpenProject instance running in a Docker container on a Windows PC, follow these steps:

1. Retrieve the Backup

  • Download the openproject.sql file from your cloud storage to a local directory, e.g., C:\OpenProjectBackup.

2. Locate the PostgreSQL Container

  • Identify the PostgreSQL container used by OpenProject:


  • bash: docker ps 

    Look for the container running PostgreSQL (it may be part of the OpenProject setup).

3. Copy the Backup File into the Container

  • Use the docker cp command to copy the SQL file into the PostgreSQL container:


  • bash: docker cp C:\OpenProjectBackup\openproject.sql <postgres-container-id>:/tmp/

4. Restore the Database

  • Access the PostgreSQL container:


  • bash: docker exec -it <postgres-container-id> bash 

  • Switch to the PostgreSQL user and restore the database:


    • bash: psql -U postgres -d openproject -f /tmp/openproject.sql

      Replace openproject with your database name if it differs.

5. Restart OpenProject

  • Restart the OpenProject container to apply changes:


  • bash: docker restart <openproject-container-id> 

This process restores your database backup and ensures it is operational in your Docker-based OpenProject instance.


I can get to 4 but when I run root@8d8192ac553a:/app# psql -U postgres -d openproject -f /tmp/openproject.sql

I get the error_: psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL:  Peer authentication failed for user "postgres"_

Any further guidance gratefully received.

Message actions

I found something that said that the postgres username and password were both openproject so I tried that as a username but with no success, even forcing the password prompt. 

I then tried with username root but the error said there is no role called root. 

I think I'll have to give up and remake the whole project from scratch.

Message actions

I managed to get the command to run by switching to the postgres superuser first

root@8d8192ac553a:/app# su - postgres

I was then able to run postgres@8d8192ac553a:~$ psql -U postgres -d openproject -f /tmp/openproject.sql

Unfortunately I'm now struggling with the Schema rename ] https://www.openproject.org/docs/installation-and-operations/operation/restoring/#changing-the-database-schema-from-cloud-to-on-premises