standardnotes / syncing-server-js

The Standard Notes server. For self-hosting, use https://github.com/standardnotes/standalone
GNU Affero General Public License v3.0
73 stars 14 forks source link

No ability to change the database (db) container- / hostname #95

Open mhellmeier opened 3 years ago

mhellmeier commented 3 years ago

The default docker-compose.yml file creates a db container for the database. Currently it isn't possible to change the container- / hostname of this db container.

If I change the name from db to foo everywhere (in the docker-compose.yml and the .env file), the syncing-server-js doesn't start and loops the following error log:

[Error] PoolCluster : Error: getaddrinfo ENOTFOUND db
[Error] PoolCluster : Error: getaddrinfo ENOTFOUND db
[Error] PoolCluster : Error: getaddrinfo ENOTFOUND db
[Error] PoolCluster : Error: getaddrinfo ENOTFOUND db
[Error] PoolCluster : Error: getaddrinfo ENOTFOUND db
[Error] PoolCluster : Error: getaddrinfo ENOTFOUND db
[Error] PoolCluster : Error: getaddrinfo ENOTFOUND db
[Error] PoolCluster : Error: getaddrinfo ENOTFOUND db
[Error] PoolCluster : Error: getaddrinfo ENOTFOUND db
[Error] PoolCluster : Error: getaddrinfo ENOTFOUND db
/var/www/node_modules/mysql2/lib/pool_cluster.js:36
      return cb(new Error('Pool does Not exists.'));
                ^

Error: Pool does Not exists.
    at PoolNamespace.getConnection (/var/www/node_modules/mysql2/lib/pool_cluster.js:36:17)
    at /var/www/node_modules/mysql2/lib/pool_cluster.js:43:21
    at /var/www/node_modules/mysql2/lib/pool_cluster.js:210:18
    at /var/www/node_modules/mysql2/lib/pool.js:60:18
    at PoolConnection.<anonymous> (/var/www/node_modules/mysql2/lib/connection.js:739:13)
    at Object.onceWrapper (node:events:485:26)
    at PoolConnection.emit (node:events:390:22)
    at PoolConnection.EventEmitter.emit (node:domain:470:12)
    at PoolConnection._notifyError (/var/www/node_modules/mysql2/lib/connection.js:225:12)
    at PoolConnection._handleFatalError (/var/www/node_modules/mysql2/lib/connection.js:156:10)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
karolsojko commented 3 years ago

Hi @mhellmeier ,

did you try to kill the existing containers and rebuild them? Maybe docker-compose kill && docker-compose build will help before starting the container again. Judging by the logs seems like the container has the old value still.

Also it's worth mentioning that this repository is for development purposes only. If you'd like to self host our infrastructure please refer to: https://github.com/standardnotes/standalone and respective documentation: https://docs.standardnotes.com/self-hosting/getting-started

mhellmeier commented 3 years ago

Thanks a lot for your quick feedback, @karolsojko .

After some debugging, I found another place where I missed replacing the value of the container. Aftward I was able to successfully change the name.

Nevertheless, it would be great to see a piece of meaningful information in the logs like "Couldn't find or connect to the database DB-NAME" instead of a looping exception.