Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
bbe652cd
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
bbe652cd
编写于
12月 08, 2015
作者:
A
Achilleas Pipinellis
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
More postgres CI service example cleanup
上级
0c22635a
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
35 addition
and
20 deletion
+35
-20
doc/ci/services/postgres.md
doc/ci/services/postgres.md
+35
-20
未找到文件。
doc/ci/services/postgres.md
浏览文件 @
bbe652cd
...
...
@@ -13,11 +13,11 @@ First, in your `.gitlab-ci.yml` add:
```
yaml
services
:
-
postgres
-
postgres
:latest
variables
:
POSTGRES_DB
:
nice_marmot
POSTGRES_USER
:
gitlab_
runner
POSTGRES_USER
:
runner
POSTGRES_PASSWORD
:
"
"
```
...
...
@@ -25,7 +25,7 @@ And then configure your application to use the database, for example:
```
yaml
Host
:
localhost
User
:
gitlab_
runner
User
:
runner
Password
:
Database
:
nice_marmot
```
...
...
@@ -47,39 +47,54 @@ First install the PostgreSQL server:
sudo
apt-get
install
-y
postgresql postgresql-client libpq-dev
```
The
n create a user
:
The
next step is to create a user, so login to PostgreSQL
:
```
bash
# Login to PostgreSQL
sudo
-u
postgres psql
-d
template1
```
# Create a user for GitLab Runner that can create databases
# Do not type the 'template1=#', this is part of the prompt
template1
=
# CREATE USER gitlab_runner CREATEDB;
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.
# Create the database & grant all privileges on database
template1
=
# CREATE DATABASE nice_marmot OWNER gitlab_runner;
*__Note:__ Do not type `template1=#`, this is part of the PostgreSQL prompt.*
# Quit the database session
template1
=
#
\q
```
bash
template1
=
#
CREATE USER runner WITH PASSWORD '$password' CREATEDB;
```
Try to connect to database:
*
__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.
*
Create the database and grant all privileges on it for the user
`runner`
:
```
bash
# Try connecting to the new database with the new user
sudo
-u
gitlab_runner
-H
psql
-d
nice_marmot
template1
=
# CREATE DATABASE nice_marmot OWNER runner;
```
If all went well you can now quit the database session:
# Quit the database session
nice_marmot>
\q
```
bash
template1
=
#
\q
```
Finally, configure your application to use the database:
Now, try to connect to the newly created database with the user
`runner`
to
check that everything is in place.
```
bash
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.
*
Finally, configure your application to use the database, for example:
```
yaml
Host
:
localhost
User:
gitlab_
runner
Password:
User
:
runner
Password
:
$password
Database
:
nice_marmot
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录