Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
e4224523
Commit
e4224523
authored
May 15, 2018
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Grant privileges after database is created
Never drop the database when granting privileges
parent
0a1b4db6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
17 deletions
+13
-17
.gitlab-ci.yml
.gitlab-ci.yml
+0
-3
scripts/create_mysql_user.sh
scripts/create_mysql_user.sh
+0
-1
scripts/create_postgres_user.sh
scripts/create_postgres_user.sh
+1
-3
scripts/prepare_build.sh
scripts/prepare_build.sh
+2
-10
scripts/utils.sh
scripts/utils.sh
+10
-0
No files found.
.gitlab-ci.yml
View file @
e4224523
...
...
@@ -278,7 +278,6 @@ stages:
<<
:
*use-pg
variables
:
SETUP_DB
:
"
false"
CREATE_DB_USER
:
"
true"
script
:
# Manually clone gitlab-test and only seed this project in
# db/fixtures/development/04_project.rb thanks to SIZE=1 below
...
...
@@ -322,7 +321,6 @@ stages:
.migration-paths
:
&migration-paths
<<
:
*dedicated-no-docs-and-no-qa-pull-cache-job
variables
:
CREATE_DB_USER
:
"
true"
SETUP_DB
:
"
false"
script
:
-
git fetch https://gitlab.com/gitlab-org/gitlab-ee.git v9.3.0-ee
...
...
@@ -342,7 +340,6 @@ stages:
.migration-paths-upgrade-ce-to-ee
:
&migration-paths-upgrade-ce-to-ee
<<
:
*dedicated-no-docs-and-no-qa-pull-cache-job
variables
:
CREATE_DB_USER
:
"
true"
SETUP_DB
:
"
false"
script
:
-
CE_HEAD=$(ruby -r./scripts/ee_specific_check/ee_specific_check -e'puts EESpecificCheck.fetch_remote_ce_branch')
...
...
scripts/create_mysql_user.sh
View file @
e4224523
#!/bin/bash
mysql
--user
=
root
--host
=
mysql
<<
EOF
CREATE DATABASE IF NOT EXISTS gitlabhq_test DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER IF NOT EXISTS 'gitlab'@'%';
GRANT ALL PRIVILEGES ON gitlabhq_test.* TO 'gitlab'@'%';
FLUSH PRIVILEGES;
...
...
scripts/create_postgres_user.sh
View file @
e4224523
#!/bin/bash
psql
-h
postgres
-U
postgres postgres
<<
EOF
DROP DATABASE IF EXISTS gitlabhq_test;
CREATE DATABASE gitlabhq_test;
CREATE USER gitlab;
GRANT ALL PRIVILEGES ON
DATABASE gitlabhq_test
TO gitlab;
GRANT ALL PRIVILEGES ON
ALL TABLES IN SCHEMA public
TO gitlab;
EOF
scripts/prepare_build.sh
View file @
e4224523
...
...
@@ -58,16 +58,8 @@ sed -i 's/localhost/redis/g' config/redis.queues.yml
cp
config/redis.shared_state.yml.example config/redis.shared_state.yml
sed
-i
's/localhost/redis/g'
config/redis.shared_state.yml
# Some tasks (e.g. db:seed_fu) need to have a properly-configured database
# user but not necessarily a full schema loaded
if
[
"
$CREATE_DB_USER
"
!=
"false"
]
;
then
if
[
"
$GITLAB_DATABASE
"
=
'postgresql'
]
;
then
.
scripts/create_postgres_user.sh
else
.
scripts/create_mysql_user.sh
fi
fi
if
[
"
$SETUP_DB
"
!=
"false"
]
;
then
setup_db
elif
getent hosts postgres
||
getent hosts mysql
;
then
setup_db_user_only
fi
scripts/utils.sh
View file @
e4224523
...
...
@@ -13,7 +13,17 @@ retry() {
return
1
}
setup_db_user_only
()
{
if
[
"
$GITLAB_DATABASE
"
=
"postgresql"
]
;
then
.
scripts/create_postgres_user.sh
else
.
scripts/create_mysql_user.sh
fi
}
setup_db
()
{
setup_db_user_only
bundle
exec
rake db:drop db:create db:schema:load db:migrate
if
[
"
$GITLAB_DATABASE
"
=
"mysql"
]
;
then
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment