0

I want to use botpress with PostgreSQL.

Found on https://hub.docker.com/r/botpress/server

example

docker run --detach \
           --name=botpress \
           --publish 3000:8080 \
           --volume botpress_data:/botpress/data \
           --env  PORT=8080 \ # Don't forget to adjust "--publish" then
           --env  BP_HOST=0.0.0.0 \ # all zeroes means listen to all interfaces
           --env  NODE_ENV=production \
           --env  PG_HOST=192.168.0.11 \
           --env  PG_PORT=5432 \
           --env  PG_USER=bp_user \
           --env  PG_PASSWORD=<********> \
           --env  PG_SSL=false \
           botpress/server:latest

In my local env I run in Docker PostgreSQL

0d530862c5c3        postgres                      "docker-entrypoint.s…"   6 weeks ago         Up 38 minutes              0.0.0.0:54320->5432/tcp             postgresql_inclouds

In this DB I create user botpress and DB botpress and granted all privelegies to botpress user.

enter image description here

after I start in docker botpress

docker run --detach \
--name=botpres \
--net=inclouds_network \
--publish 3000:3000 \
--volume /opt/docker/botpress:/botpress/data \
--env BP_HOST=0.0.0.0 \
--env NODE_ENV=production \
--env PG_HOST=postgresql_inclouds \
--env PG_PORT=5432 \
--env PG_USER=botpress \
--env PG_PASSWORD=b0tpress \
--env PG_SSL=false \
botpress/server:v12_10_7

docker container with botpress started

webGUI is working

enter image description here

But botpress working with SQLite.

How to make it work with PostgreSQL DB?

Nikolay Baranenko
  • 1,582
  • 6
  • 35
  • 60

1 Answers1

0

Most of these variables can be set in the configuration file data/global/botpress.config.json. Infrastructure configuration (like the database, cluster mode, etc) isn't available in the configuration file, since it is required before the config is loaded.

Botpress supports .env files.

You have to set the Environment Variables in the ".env" file and restart the Botpress service with the new variables.

DATABASE=postgres

DATABASE_URL=postgres://login:password@host:port/database

Example:

DATABASE=postgres
DATABASE_URL=postgres://johnlogin:Password987@127.0.0.1:5432/botpressdb

The ".env" file has to be located in the same directory with the "bp" executable file.

I started the botpress service as a node.js by pm2 utility without Docker.

And I used the command:

pm2 reload 0 --update-env

You can try to add the same environment variables in the docker run command.

After all, you can check the correct settings in the Botpress menu "Production checklist"

rizerphe
  • 1,340
  • 1
  • 14
  • 24
Flash
  • 1
  • 2
  • Please format your code properly, [click here to learn how](https://stackoverflow.com/help/formatting). – rizerphe Dec 02 '20 at 09:15