How to switch database in production environment?

Hi,
I want to switch database name “discourse” into “discourse_20190720” in production environment, I created database name: ‘discourse_20190720’, and it can be used postgresql GUI Postico software connect successful.

Running Discourse with a separate PostgreSQL server
I’m following this tutorial, but it was happened some error, it looks like rails db:migrate failed or it cannot connect databas cause timeout. I don’t have any idea, maybe my app.yml config was wrong or other trouble.

I modify app.yml , this is my code:
app.yml

templates:
  #- "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
## Uncomment these two lines if you wish to add Lets Encrypt (https)
  - "templates/web.ssl.template.yml"
  - "templates/web.letsencrypt.ssl.template.yml"
expose:
  - "80:80"   # http
  - "443:443" # https
  - "5432:5432"
env:
  DISCOURSE_DB_HOST: mydomain.com
  DISCOURSE_DB_NAME: discourse_20190720
  DISCOURSE_DB_USERNAME: admin
  DISCOURSE_DB_PASSWORD: password
  DISCOURSE_HOSTNAME: mydomain.com

after ./launcher rebulid app, I got some error message:

PG::ConnectionBad: timeout expired

How to fix it? What can I do ? have somebody can help me? thanks.

1 Like

Looks like the container cannot connect to the database. It’s a networking or firewall issue, most likely.

4 Likes