<@U04SE163WC8> I want to use an external postgres ...
# replication-ask-ai
w
@kapa.ai I want to use an external postgres database via CloudSQL. Which changes do I need to apply to the .env file as well as to the docker-compose.yaml
k
To use an external Postgres database via CloudSQL with Airbyte, you need to make changes to the
.env
file. Here are the steps: 1. Run a new instance of Postgres in its own docker container with the command below. If you already have Postgres running elsewhere, you can skip this step and use the credentials for that in future steps.
Copy code
bash docker run --rm --name airbyte-postgres -e POSTGRES_PASSWORD=password -p 3000:5432 -d postgres
2. Configure Airbyte services with this new database by editing the following environment variables declared in the
.env
file:
Copy code
bash DATABASE_USER=postgres   DATABASE_PASSWORD=password   DATABASE_HOST=host.docker.internal # refers to localhost of host   DATABASE_PORT=3000   DATABASE_DB=postgres
3. If you want to separate the Config Database from the Job Database, specify separate parameters. For example:
Copy code
bash CONFIG_DATABASE_USER=airbyte_config_db_user   CONFIG_DATABASE_PASSWORD=password
4. Redefine the JDBC URL constructed in the environment variable
DATABASE_URL
to include the correct host, port, and database. If you need to provide extra arguments to the JDBC driver (for example, to handle SSL) you should add it here as well:
Copy code
bash DATABASE_URL=jdbc:<postgresql://host.docker.internal:3000/postgres?ssl=true&sslmode=require>
5. If the config database is separate from the job database, do the same for the `CONFIG_DATABASE_URL`:
Copy code
bash CONFIG_DATABASE_URL=jdbc:postgresql://<host>:<port>/<database>?<extra-parameters>
(Source: [Configuring the Airbyte Database](https://docs.airbyte.com/operator-guides/configuring-airbyte-db)) As for the
docker-compose.yml
file, the extracts provided do not contain specific instructions on what changes need to be made to this file when using an external Postgres database via CloudSQL. However, it is mentioned that if you're using a dedicated custom Postgres instance, the
airbyte/db
service can be removed or deactivated from the
docker-compose.yml
file. Please refer to the official Airbyte documentation or support for more detailed instructions.
w
I did the required edits in the .env file. For this, the documentation is clear. However, I could not determine yet all necessary changes in the docker-compose.yaml. Can you help me?