Move from standalone container to separate web and data containers

I’m trying to implement the separate containers, but with a remote database. I’ve followed these instructions above and the howto for setting up a remote postgres DB. The setup works, but I’m wondering why there are two identical references (under web_only and data) to the same database. It makes me believe I’m doing something wrong and the web_only container is not even using the data container.

Am I doing this correctly?

Here is my setup.

Under the web_only.yml I added:

  DISCOURSE_DB_SOCKET: ''
  DISCOURSE_DB_USERNAME: REMOVE
  DISCOURSE_DB_PASSWORD: REMOVE
  DISCOURSE_DB_HOST: xxx.ondigitalocean.com
  DISCOURSE_DB_NAME: REMOVE
  DISCOURSE_DB_PORT: 25060
  DISCOURSE_DB_BACKUP_PORT: 25060
  DISCOURSE_REDIS_HOST: data

under data.yml

I removed postgres.template.yml

templates:
#  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"

I also added the following:

env:
  # ensure locale exists in container, you may need to install it
  LANG: en_US.UTF-8
  DISCOURSE_DB_USERNAME: REMOVE
  DISCOURSE_DB_PASSWORD: REMOVE
  DISCOURSE_DB_HOST: REMOVE.ondigitalocean.com
  DISCOURSE_DB_NAME: REMOVE
  DISCOURSE_DB_PORT: 25060
  DISCOURSE_DB_BACKUP_PORT: 25060