summaryrefslogtreecommitdiff
path: root/doc/ci/services/postgres.md
diff options
context:
space:
mode:
Diffstat (limited to 'doc/ci/services/postgres.md')
-rw-r--r--doc/ci/services/postgres.md24
1 files changed, 11 insertions, 13 deletions
diff --git a/doc/ci/services/postgres.md b/doc/ci/services/postgres.md
index 8d14e4795d2..62838e04969 100644
--- a/doc/ci/services/postgres.md
+++ b/doc/ci/services/postgres.md
@@ -5,7 +5,7 @@ info: To determine the technical writer assigned to the Stage/Group associated w
type: reference
---
-# Using PostgreSQL
+# Using PostgreSQL **(FREE)**
As many applications depend on PostgreSQL as their database, you
eventually need it in order for your tests to run. Below you are guided how to
@@ -16,6 +16,10 @@ do this with the Docker and Shell executors of GitLab Runner.
If you're using [GitLab Runner](../runners/index.md) with the Docker executor,
you basically have everything set up already.
+NOTE:
+Variables set in the GitLab UI are not passed down to the service containers.
+[Learn more](../variables/index.md).
+
First, in your `.gitlab-ci.yml` add:
```yaml
@@ -23,25 +27,19 @@ services:
- postgres:12.2-alpine
variables:
- POSTGRES_DB: nice_marmot
- POSTGRES_USER: runner
- POSTGRES_PASSWORD: ""
+ POSTGRES_DB: $POSTGRES_DB
+ POSTGRES_USER: $POSTGRES_USER
+ POSTGRES_PASSWORD: $POSTGRES_PASSWORD
POSTGRES_HOST_AUTH_METHOD: trust
```
-To set values for the `POSTGRES_DB`, `POSTGRES_USER`,
-`POSTGRES_PASSWORD` and `POSTGRES_HOST_AUTH_METHOD`,
-[assign them to a CI/CD variable in the user interface](../variables/index.md#custom-cicd-variables),
-then assign that variable to the corresponding variable in your
-`.gitlab-ci.yml` file.
-
And then configure your application to use the database, for example:
```yaml
Host: postgres
-User: runner
-Password: ''
-Database: nice_marmot
+User: $PG_USER
+Password: $PG_PASSWORD
+Database: $PG_DB
```
If you're wondering why we used `postgres` for the `Host`, read more at