diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-06 00:09:01 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-06 00:09:01 +0000 |
commit | 671755053668642cf00d225825b11cd8abd49126 (patch) | |
tree | 1124606597528ef710db4847644d8f1ee1c88dfa /doc/ci/services/postgres.md | |
parent | 3ef453aa1cf8cc5f90a728fa3ebc166090ff2e3e (diff) | |
download | gitlab-ce-671755053668642cf00d225825b11cd8abd49126.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/ci/services/postgres.md')
-rw-r--r-- | doc/ci/services/postgres.md | 45 |
1 files changed, 23 insertions, 22 deletions
diff --git a/doc/ci/services/postgres.md b/doc/ci/services/postgres.md index aadbce5a50a..96552ab1245 100644 --- a/doc/ci/services/postgres.md +++ b/doc/ci/services/postgres.md @@ -13,7 +13,7 @@ do this with the Docker and Shell executors of GitLab Runner. ## Use PostgreSQL with the Docker executor -If you are using [GitLab Runner](../runners/README.md) with the Docker executor +If you're using [GitLab Runner](../runners/README.md) with the Docker executor, you basically have everything set up already. First, in your `.gitlab-ci.yml` add: @@ -29,12 +29,11 @@ variables: POSTGRES_HOST_AUTH_METHOD: trust ``` -NOTE: **Note:** -The `POSTGRES_DB`, `POSTGRES_USER`, `POSTGRES_PASSWORD` and `POSTGRES_HOST_AUTH_METHOD` -variables can't be set in the GitLab UI. To set them, assign them to a variable -[in the UI](../variables/README.md#create-a-custom-variable-in-the-ui), and then assign that -variable to the `POSTGRES_DB`, `POSTGRES_USER`, `POSTGRES_PASSWORD` and `POSTGRES_HOST_AUTH_METHOD` -variables in your `.gitlab-ci.yml`. +To set values for the `POSTGRES_DB`, `POSTGRES_USER`, +`POSTGRES_PASSWORD` and `POSTGRES_HOST_AUTH_METHOD`, +[assign them to a variable in the user interface](../variables/README.md#create-a-custom-variable-in-the-ui), +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: @@ -45,14 +44,14 @@ Password: '' Database: nice_marmot ``` -If you are wondering why we used `postgres` for the `Host`, read more at +If you're wondering why we used `postgres` for the `Host`, read more at [How services are linked to the job](../docker/using_docker_images.md#how-services-are-linked-to-the-job). You can also use any other Docker image available on [Docker Hub](https://hub.docker.com/_/postgres). -For example, to use PostgreSQL 9.3 the service becomes `postgres:9.3`. +For example, to use PostgreSQL 9.3, the service becomes `postgres:9.3`. -The `postgres` image can accept some environment variables. For more details -check the documentation on [Docker Hub](https://hub.docker.com/_/postgres). +The `postgres` image can accept some environment variables. For more details, +see the documentation on [Docker Hub](https://hub.docker.com/_/postgres). ## Use PostgreSQL with the Shell executor @@ -65,7 +64,7 @@ First install the PostgreSQL server: sudo apt-get install -y postgresql postgresql-client libpq-dev ``` -The next step is to create a user, so login to PostgreSQL: +The next step is to create a user, so sign in to PostgreSQL: ```shell sudo -u postgres psql -d template1 @@ -74,24 +73,26 @@ sudo -u postgres psql -d template1 Then create a user (in our case `runner`) which will be used by your application. Change `$password` in the command below to a real strong password. -*__Note:__ Do not type `template1=#`, this is part of the PostgreSQL prompt.* +NOTE: **Note:** +Be sure to not enter `template1=#` in the following commands, as that's part of +the PostgreSQL prompt. ```shell template1=# CREATE USER runner WITH PASSWORD '$password' CREATEDB; ``` -*__Note:__ Notice that we created the user with the privilege to be able to -create databases (`CREATEDB`). In the following steps we will create a database -explicitly for that user but having that privilege can be useful if in your -testing framework you have tools that drop and create databases.* +The created user has the privilege to create databases (`CREATEDB`). The +following steps describe how to create a database explicitly for that user, but +having that privilege can be useful if in your testing framework you have tools +that drop and create databases. -Create the database and grant all privileges on it for the user `runner`: +Create the database and grant all privileges to it for the user `runner`: ```shell template1=# CREATE DATABASE nice_marmot OWNER runner; ``` -If all went well you can now quit the database session: +If all went well, you can now quit the database session: ```shell template1=# \q @@ -104,8 +105,8 @@ check that everything is in place. psql -U runner -h localhost -d nice_marmot -W ``` -*__Note:__ We are explicitly telling `psql` to connect to localhost in order -to use the md5 authentication. If you omit this step you will be denied access.* +This command explicitly directs `psql` to connect to localhost to use the md5 +authentication. If you omit this step, you'll be denied access. Finally, configure your application to use the database, for example: @@ -122,5 +123,5 @@ We have set up an [Example PostgreSQL Project](https://gitlab.com/gitlab-example convenience that runs on [GitLab.com](https://gitlab.com) using our publicly available [shared runners](../runners/README.md). -Want to hack on it? Simply fork it, commit and push your changes. Within a few +Want to hack on it? Fork it, commit, and push your changes. Within a few moments the changes will be picked by a public runner and the job will begin. |