Rasa-x and postgres container keeps on restarting when used docker-compose deployment

Hi All,

I have followed the steps mentioned here: Installation Guide. But there are some warnings. I do not know why some of the containers like rasa-x, postgres, logger are keeps on restarting.

docker ps -a

I have used docker-compose up -d to spin the containers.

docker-compose logs nginx

nginx_1 | you have not agreed to the terms and conditions, Rasa X cannot start. To accept the terms and conditions run echo “${USER} $(date)” > /opt/bitnami/nginx/conf/bitnami/terms/agree.txt on the host machine. You can find the terms at https://storage.googleapis.com/rasa-x-releases/rasa_x_ce_license_agreement.pdf

**docker-compose logs db **

db_1 | Welcome to the Bitnami postgresql container

db_1 | Subscribe to project updates by watching GitHub - bitnami/bitnami-docker-postgresql: Bitnami Docker Image for PostgreSQL

db_1 | Submit issues and feature requests at Issues · bitnami/bitnami-docker-postgresql · GitHub

db_1 | Send us your feedback at containers@bitnami.com

db_1 |

db_1 | INFO ==> ** Starting PostgreSQL setup **

db_1 | INFO ==> Validating settings in POSTGRESQL_* env vars…

db_1 | INFO ==> Initializing PostgreSQL database…

db_1 | INFO ==> postgresql.conf file not detected. Generating it…

db_1 | INFO ==> pg_hba.conf file not detected. Generating it…

db_1 | mkdir: cannot create directory ‘/bitnami/postgresql’: Permission denied

db_1 | INFO ==> Stopping PostgreSQL…

docker-compose logs rasa-x

rasa-x_1 | /usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:526: FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / ‘(1,)type’.

rasa-x_1 | _np_qint8 = np.dtype([(“qint8”, np.int8, 1)])

rasa-x_1 | /usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:527: FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / ‘(1,)type’.

rasa-x_1 | _np_quint8 = np.dtype([(“quint8”, np.uint8, 1)])

rasa-x_1 | /usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:528: FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / ‘(1,)type’.

rasa-x_1 | _np_qint16 = np.dtype([(“qint16”, np.int16, 1)])

rasa-x_1 | /usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:529: FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / ‘(1,)type’.

rasa-x_1 | _np_quint16 = np.dtype([(“quint16”, np.uint16, 1)])

rasa-x_1 | /usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:530: FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / ‘(1,)type’.

rasa-x_1 | _np_qint32 = np.dtype([(“qint32”, np.int32, 1)])

rasa-x_1 | /usr/local/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:535: FutureWarning: Passing (type, 1) or ‘1type’ as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / ‘(1,)type’.

rasa-x_1 | np_resource = np.dtype([(“resource”, np.ubyte, 1)])

rasa-x_1 | Traceback (most recent call last):

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py”, line 2262, in _wrap_pool_connect

rasa-x_1 | return fn()

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py”, line 303, in unique_connection

rasa-x_1 | return _ConnectionFairy._checkout(self)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py”, line 760, in _checkout

rasa-x_1 | fairy = _ConnectionRecord.checkout(pool)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py”, line 492, in checkout

rasa-x_1 | rec = pool._do_get()

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/impl.py”, line 139, in _do_get

rasa-x_1 | self._dec_overflow()

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py”, line 68, in exit

rasa-x_1 | compat.reraise(exc_type, exc_value, exc_tb)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/util/compat.py”, line 129, in reraise

rasa-x_1 | raise value

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/impl.py”, line 136, in _do_get

rasa-x_1 | return self._create_connection()

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py”, line 308, in _create_connection

rasa-x_1 | return _ConnectionRecord(self)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py”, line 437, in init

rasa-x_1 | self.__connect(first_connect_check=True)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py”, line 639, in __connect

rasa-x_1 | connection = pool._invoke_creator(self)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py”, line 114, in connect

rasa-x_1 | return dialect.connect(*cargs, **cparams)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/default.py”, line 453, in connect

rasa-x_1 | return self.dbapi.connect(*cargs, **cparams)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/psycopg2/init.py”, line 126, in connect

rasa-x_1 | conn = _connect(dsn, connection_factory=connection_factory, **kwasync)

rasa-x_1 | psycopg2.OperationalError: could not translate host name “db” to address: Name or service not known

rasa-x_1 |

rasa-x_1 |

rasa-x_1 | The above exception was the direct cause of the following exception:

rasa-x_1 |

rasa-x_1 | Traceback (most recent call last):

rasa-x_1 | File “/usr/local/lib/python3.6/runpy.py”, line 193, in _run_module_as_main

rasa-x_1 | “main”, mod_spec)

rasa-x_1 | File “/usr/local/lib/python3.6/runpy.py”, line 85, in _run_code

rasa-x_1 | exec(code, run_globals)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/rasax/community/server.py”, line 78, in

rasa-x_1 | main()

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/rasax/community/server.py”, line 27, in main

rasa-x_1 | sql_migrations.run_migrations(session)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/rasax/community/sql_migrations.py”, line 25, in run_migrations

rasa-x_1 | _run_schema_migrations(session)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/rasax/community/sql_migrations.py”, line 46, in _run_schema_migrations

rasa-x_1 | command.upgrade(alembic_config, “head”)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/alembic/command.py”, line 276, in upgrade

rasa-x_1 | script.run_env()

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/alembic/script/base.py”, line 475, in run_env

rasa-x_1 | util.load_python_file(self.dir, “env.py”)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/alembic/util/pyfiles.py”, line 90, in load_python_file

rasa-x_1 | module = load_module_py(module_id, path)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/alembic/util/compat.py”, line 156, in load_module_py

rasa-x_1 | spec.loader.exec_module(module)

rasa-x_1 | File “”, line 678, in exec_module

rasa-x_1 | File “”, line 219, in _call_with_frames_removed

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/rasax/community/database/schema_migrations/alembic/env.py”, line 85, in

rasa-x_1 | run_migrations_online()

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/rasax/community/database/schema_migrations/alembic/env.py”, line 67, in run_migrations_online

rasa-x_1 | with connectable.connect() as connection:

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py”, line 2193, in connect

rasa-x_1 | return self._connection_cls(self, **kwargs)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py”, line 103, in init

rasa-x_1 | else engine.raw_connection()

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py”, line 2293, in raw_connection

rasa-x_1 | self.pool.unique_connection, _connection

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py”, line 2266, in _wrap_pool_connect

rasa-x_1 | e, dialect, self

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py”, line 1536, in _handle_dbapi_exception_noconnection

rasa-x_1 | util.raise_from_cause(sqlalchemy_exception, exc_info)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/util/compat.py”, line 383, in raise_from_cause

rasa-x_1 | reraise(type(exception), exception, tb=exc_tb, cause=cause)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/util/compat.py”, line 128, in reraise

rasa-x_1 | raise value.with_traceback(tb)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/base.py”, line 2262, in _wrap_pool_connect

rasa-x_1 | return fn()

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py”, line 303, in unique_connection

rasa-x_1 | return _ConnectionFairy._checkout(self)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py”, line 760, in _checkout

rasa-x_1 | fairy = _ConnectionRecord.checkout(pool)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py”, line 492, in checkout

rasa-x_1 | rec = pool._do_get()

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/impl.py”, line 139, in _do_get

rasa-x_1 | self._dec_overflow()

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/util/langhelpers.py”, line 68, in exit

rasa-x_1 | compat.reraise(exc_type, exc_value, exc_tb)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/util/compat.py”, line 129, in reraise

rasa-x_1 | raise value

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/impl.py”, line 136, in _do_get

rasa-x_1 | return self._create_connection()

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py”, line 308, in _create_connection

rasa-x_1 | return _ConnectionRecord(self)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py”, line 437, in init

rasa-x_1 | self.__connect(first_connect_check=True)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/pool/base.py”, line 639, in __connect

rasa-x_1 | connection = pool._invoke_creator(self)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/strategies.py”, line 114, in connect

rasa-x_1 | return dialect.connect(*cargs, **cparams)

rasa-x_1 | File “/usr/local/lib/python3.6/site- packages/sqlalchemy/engine/default.py”, line 453, in connect

rasa-x_1 | return self.dbapi.connect(*cargs, **cparams)

rasa-x_1 | File “/usr/local/lib/python3.6/site-packages/psycopg2/init.py”, line 126, in connect

rasa-x_1 | conn = _connect(dsn, connection_factory=connection_factory, **kwasync)

rasa-x_1 | sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) could not translate host name “db” to address: Name or service not known

rasa-x_1 |

rasa-x_1 | (Background on this error at: Error Messages — SQLAlchemy 2.0 Documentation)

rabbit_1 | 2019-08-22 10:23:05.695 [info] <0.595.0> accepting AMQP connection <0.595.0> (192.168.48.6:37222 → 192.168.48.5:5672)

rabbit_1 | 2019-08-22 10:23:05.702 [info] <0.595.0> connection <0.595.0> (192.168.48.6:37222 → 192.168.48.5:5672): user ‘user’ authenticated and granted access to vhost ‘/’

rabbit_1 | 2019-08-22 10:23:05.719 [warning] <0.595.0> closing AMQP connection <0.595.0> (192.168.48.6:37222 → 192.168.48.5:5672, vhost: ‘/’, user: ‘user’):

rabbit_1 | client unexpectedly closed TCP connection

rasa-worker_1 | 2019-08-22 10:29:10 WARNING rasa.core.tracker_store - (psycopg2.OperationalError) could not translate host name “db” to address: Name or service not known

rasa-worker_1 |

rasa-worker_1 | (Background on this error at: Error Messages — SQLAlchemy 2.0 Documentation)

rasa-production_1 | 2019-08-22 10:29:10 WARNING rasa.core.tracker_store - (psycopg2.OperationalError) could not translate host name “db” to address: Name or service not known

rasa-production_1 |

rasa-production_1 | (Background on this error at: Error Messages — SQLAlchemy 2.0 Documentation)

It seems the volume mount for the database does not have the correct permissions. Please try changing the owner to 1001 and setting the permission to 750 as described in step 11 of Installation Guide

     | 

db_1 | Welcome to the Bitnami postgresql container

db_1 | Subscribe to project updates by watching GitHub - bitnami/bitnami-docker-postgresql: Bitnami Docker Image for PostgreSQL

db_1 | Submit issues and feature requests at Issues · bitnami/bitnami-docker-postgresql · GitHub

db_1 | Send us your feedback at containers@bitnami.com

db_1 |

db_1 | INFO ==> ** Starting PostgreSQL setup **

db_1 | INFO ==> Validating settings in POSTGRESQL_* env vars…

db_1 | INFO ==> Initializing PostgreSQL database…

db_1 | INFO ==> postgresql.conf file not detected. Generating it…

db_1 | INFO ==> pg_hba.conf file not detected. Generating it…

db_1 | INFO ==> Deploying PostgreSQL with persisted data…

db_1 | INFO ==> Configuring replication parameters

db_1 | INFO ==> Loading custom scripts…

db_1 | INFO ==> Enabling remote connections

db_1 | INFO ==> Stopping PostgreSQL…

db_1 | INFO ==> ** PostgreSQL setup finished! **

db_1 |

db_1 | INFO ==> ** Starting PostgreSQL **

db_1 | 2019-08-22 12:09:35.976 GMT [1] LOG: skipping missing configuration file “/bitnami/postgresql/data/postgresql.auto.conf”

db_1 | 2019-08-22 12:09:35.977 GMT [1] FATAL: “/bitnami/postgresql/data” is not a valid data directory

db_1 | 2019-08-22 12:09:35.977 GMT [1] DETAIL: File “/bitnami/postgresql/data/PG_VERSION” is missing.

I have given the correct permissions but still returns with the same error.

Can you do docker-compose down remove the folder, recreate it, and then the chown and chmod things please?

Tried recreation of folder gives the same output. No change in the logs.

Can you do a ls -al db and post the output here please?

I have switched to kubernetes deployment and it is working for now. Thanks for your time.

Guys, I still have this problem. I did docker-compose down and recreating. sudo chown -R 1001 /etc/rasa/db && sudo chmod -R 750 /etc/rasa/db

Centos

ls -al total 0 drwxr-x—. 2 1001 root 6 Feb 11 12:12 . drwxr-xr-x. 10 root root 242 Feb 11 12:12 …

Hi; is there any update on this issue? I’m having it on both Ubuntu 18.0.4’s Terminal Docker and Docker for Windows.

I solved change the permissions in docker-compose.yml:

  • db:
  • restart: always
    
  • image: "bitnami/postgresql:11.3.0"
    
  • user: root
    
  • command: chown -R 1001:1001 /bitnami
    
  • expose:
    
  •   - "5432"
    
  • environment:
    
  •   POSTGRESQL_USERNAME: "${DB_USER:-admin}"
    
  •   POSTGRESQL_PASSWORD: "${DB_PASSWORD}"
    
  •   POSTGRESQL_DATABASE: "${DB_DATABASE:-rasa}"
    
  • volumes:
    
  •   - ./db:/bitnami/postgresql

This solved the restarting and access rights issue in service db for me.

Maybe unrelated but calling setenforce 0 on my host os solved the weird permission denied errors when accessing the file system. Docker permission denied with volume - Stack Overflow

did not work for me too

chmod: cannot access ‘/etc/rasa/db’: No such file or directory

did not work for me, still it is getting restarted, it was showing the following errors in the logs

postgresql 14:18:11.48 INFO  ==> ** Starting PostgreSQL setup **
postgresql 14:18:11.50 INFO  ==> Validating settings in POSTGRESQL_* env vars..
postgresql 14:18:11.50 INFO  ==> Loading custom pre-init scripts...
postgresql 14:18:11.51 INFO  ==> Initializing PostgreSQL database...
mkdir: cannot create directory ‘/bitnami/postgresql/data’: Permission denied

after adding the

user: root
command: chown -R 1001:1001 /bitnami

there is no error in the logs but

postgresql 14:36:58.45 Welcome to the Bitnami postgresql container
postgresql 14:36:58.45 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-postgresql
postgresql 14:36:58.46 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-postgresql/issues