To use an external Postgres database via CloudSQL ...
# replication-ask-ai
k
To use an external Postgres database via CloudSQL with Airbyte, you need to modify the environment variables in the
.env
file. Here are the variables you need to change:
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
These variables are used by the docker-compose command afterward. The
DATABASE_USER
and
DATABASE_PASSWORD
should be the credentials of your Postgres instance.
DATABASE_HOST
should be the hostname of your Postgres instance.
DATABASE_PORT
should be the port number your Postgres instance is listening on.
DATABASE_DB
should be the name of your database. If you want to separate the Config Database and the Job Database, you can specify separate parameters like this:
Copy code
bash CONFIG_DATABASE_USER=airbyte_config_db_user   CONFIG_DATABASE_PASSWORD=password
You also need to redefine the JDBC URL in the
DATABASE_URL
environment variable 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>
If the config database is separate from the job database, you should also redefine the `CONFIG_DATABASE_URL`:
Copy code
bash CONFIG_DATABASE_URL=jdbc:postgresql://<host>:<port>/<database>?<extra-parameters>
Please note that the information provided in the extracts does not include changes to the
docker-compose.yaml
file. For more detailed instructions, you can refer to the [Airbyte documentation](https://docs.airbyte.com/operator-guides/configuring-airbyte-db).