[GH-ISSUE #327] When using an "external" pre-exisiting database server (Postgres) the database is not created #167

Closed
opened 2026-02-26 10:30:30 +03:00 by kerem · 3 comments
Owner

Originally created by @jeffrson on GitHub (Jan 15, 2021).
Original GitHub issue: https://github.com/ONLYOFFICE/Docker-DocumentServer/issues/327

Do you want to request a feature or report a bug?

Bug

What is the current behavior?

OnlyOffice Document-Server fails because database does not exist.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

Start onlyoffice/documentserver connecting to existing Postgres database server using environment variable for DB_TYPE, DB_HOST, DB_NAME, DB_USER, DB_PWD
As soon as I create the database, the log contains messages about missing tables - the container needs to be restarted.

Edit: As a workaround (for "clean" installation of NextCloud) I create the database with psql prior to starting the OnlyOffice container.

What is the expected behavior?

Should create database and tables after connecting to database server if database does not exist.

Did this work in previous versions of DocumentServer?

Don't know.

DocumentServer Docker tag:

latest (6.2.0 I believe)

Host Operating System:

Linux, Docker 20.10.1

Originally created by @jeffrson on GitHub (Jan 15, 2021). Original GitHub issue: https://github.com/ONLYOFFICE/Docker-DocumentServer/issues/327 **Do you want to request a *feature* or report a *bug*?** Bug **What is the current behavior?** OnlyOffice Document-Server fails because database does not exist. **If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.** Start onlyoffice/documentserver connecting to existing Postgres database server using environment variable for DB_TYPE, DB_HOST, DB_NAME, DB_USER, DB_PWD As soon as I create the database, the log contains messages about missing tables - the container needs to be restarted. Edit: As a workaround (for "clean" installation of NextCloud) I create the database with psql prior to starting the OnlyOffice container. **What is the expected behavior?** Should create database and tables after connecting to database server if database does not exist. **Did this work in previous versions of DocumentServer?** Don't know. **DocumentServer Docker tag:** latest (6.2.0 I believe) **Host Operating System:** Linux, Docker 20.10.1
kerem 2026-02-26 10:30:30 +03:00
Author
Owner

@AFaust commented on GitHub (Jan 17, 2021):

I am using onlyoffice/documentserver:6.1.0 today to test an integration with Alfresco for a customer, and I am running into the similar sounding errors. Specifically, my Docker logs for the documentserver show:

onlyoffice-documentserver_1  | [2021-01-17T17:29:30.809] [ERROR] nodeJS - Error convert: docId = conv_01172021172930_docx
onlyoffice-documentserver_1  | error: relation "task_result" does not exist
onlyoffice-documentserver_1  |     at Connection.parseE (/snapshot/server/build/server/DocService/node_modules/pg/lib/connection.js:614:13)
onlyoffice-documentserver_1  |     at Connection.parseMessage (/snapshot/server/build/server/DocService/node_modules/pg/lib/connection.js:413:19)
onlyoffice-documentserver_1  |     at Socket.<anonymous> (/snapshot/server/build/server/DocService/node_modules/pg/lib/connection.js:129:22)
onlyoffice-documentserver_1  |     at Socket.emit (events.js:198:13)
onlyoffice-documentserver_1  |     at addChunk (_stream_readable.js:287:12)
onlyoffice-documentserver_1  |     at readableAddChunk (_stream_readable.js:268:11)
onlyoffice-documentserver_1  |     at Socket.Readable.push (_stream_readable.js:223:10)
onlyoffice-documentserver_1  |     at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)

After checking my PostgreSQL server, I realised that the bootstrap that DocumentServer performs appears to always create the tables in the public schema, whereas in my PostgreSQL server, each database has a custom schema set via search_path and should never use public. After manually changing the search_path to include public, it worked for me. IMHO, DocumentServer bootstrap should respect the database configuration and only create tables in the first / current schema according to search_path.

<!-- gh-comment-id:761852085 --> @AFaust commented on GitHub (Jan 17, 2021): I am using onlyoffice/documentserver:6.1.0 today to test an integration with Alfresco for a customer, and I am running into the similar sounding errors. Specifically, my Docker logs for the documentserver show: ``` onlyoffice-documentserver_1 | [2021-01-17T17:29:30.809] [ERROR] nodeJS - Error convert: docId = conv_01172021172930_docx onlyoffice-documentserver_1 | error: relation "task_result" does not exist onlyoffice-documentserver_1 | at Connection.parseE (/snapshot/server/build/server/DocService/node_modules/pg/lib/connection.js:614:13) onlyoffice-documentserver_1 | at Connection.parseMessage (/snapshot/server/build/server/DocService/node_modules/pg/lib/connection.js:413:19) onlyoffice-documentserver_1 | at Socket.<anonymous> (/snapshot/server/build/server/DocService/node_modules/pg/lib/connection.js:129:22) onlyoffice-documentserver_1 | at Socket.emit (events.js:198:13) onlyoffice-documentserver_1 | at addChunk (_stream_readable.js:287:12) onlyoffice-documentserver_1 | at readableAddChunk (_stream_readable.js:268:11) onlyoffice-documentserver_1 | at Socket.Readable.push (_stream_readable.js:223:10) onlyoffice-documentserver_1 | at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17) ``` After checking my PostgreSQL server, I realised that the bootstrap that DocumentServer performs appears to always create the tables in the `public` schema, whereas in my PostgreSQL server, each database has a custom schema set via `search_path` and should never use `public`. After manually changing the `search_path` to include `public`, it worked for me. IMHO, DocumentServer bootstrap should respect the database configuration and only create tables in the first / current schema according to `search_path`.
Author
Owner

@ShockwaveNN commented on GitHub (Apr 29, 2021):

@jeffrson Sorry for late response, we analyze our problem and found a problem

Our scripts need that DB_NAME should be already existing table on DB side, we create new tables, but we do not create base itself

I saw that our documentation has an incorret info and changed it in https://github.com/ONLYOFFICE/Docker-DocumentServer/pull/355

@AFaust I think your problem is little bit more complex, than the original author, could you create a new issue and personally I'm not very familral with public schema mechanic so if you provide some kind of pre-init script for database or even better docker-compose.yml file with incorrect result - I will be gratefull

<!-- gh-comment-id:829082357 --> @ShockwaveNN commented on GitHub (Apr 29, 2021): @jeffrson Sorry for late response, we analyze our problem and found a problem Our scripts need that `DB_NAME` should be already existing table on DB side, we create new tables, but we do not create base itself I saw that our documentation has an incorret info and changed it in https://github.com/ONLYOFFICE/Docker-DocumentServer/pull/355 @AFaust I think your problem is little bit more complex, than the original author, could you create a new issue and personally I'm not very familral with `public` schema mechanic so if you provide some kind of `pre-init` script for database or even better `docker-compose.yml` file with incorrect result - I will be gratefull
Author
Owner

@ShockwaveNN commented on GitHub (Jan 18, 2022):

I'll close this issue since original problem seems to be resolved in documentation

<!-- gh-comment-id:1015364706 --> @ShockwaveNN commented on GitHub (Jan 18, 2022): I'll close this issue since original problem seems to be resolved in documentation
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Docker-DocumentServer-ONLYOFFICE#167
No description provided.