Commit 95ffe08674787b21172e38f9e1a4b47309c56418
1 parent
d1e31bfc
Exists in
master
and in
4 other branches
Update database setup instructions to be more consistent
Showing
2 changed files
with
31 additions
and
43 deletions
Show diff stats
doc/install/databases.md
1 | -# Databases: | |
1 | +# Setup Database | |
2 | 2 | |
3 | -GitLab use MySQL as default database but you are free to use PostgreSQL. | |
3 | +GitLab supports the following databases: | |
4 | + | |
5 | +* MySQL (preferred) | |
6 | +* PostgreSQL | |
4 | 7 | |
5 | 8 | |
6 | 9 | ## MySQL |
7 | 10 | |
11 | + # Install the database packages | |
8 | 12 | sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev |
9 | 13 | |
14 | + # Install only the necessary gems | |
15 | + sudo -u gitlab -H bundle install --deployment --without development test postgres | |
16 | + | |
10 | 17 | # Login to MySQL |
11 | 18 | $ mysql -u root -p |
12 | 19 | |
20 | + # Create a user for GitLab. (change $password to a real password) | |
21 | + mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password'; | |
22 | + | |
13 | 23 | # Create the GitLab production database |
14 | 24 | mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; |
15 | 25 | |
16 | - # Create the MySQL User change $password to a real password | |
17 | - mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password'; | |
18 | - | |
19 | - # Grant proper permissions to the MySQL User | |
26 | + # Grant the GitLab user necessary permissopns on the table. | |
20 | 27 | mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost'; |
21 | 28 | |
29 | + # Quit the database session | |
30 | + mysql> \q | |
31 | + | |
32 | + # Try connecting to the new database with the new user | |
33 | + sudo -u gitlab -H mysql -u gitlab -p -D gitlabhq_production | |
22 | 34 | |
23 | 35 | ## PostgreSQL |
24 | 36 | |
37 | + # Install the database packages | |
25 | 38 | sudo apt-get install -y postgresql-9.1 postgresql-server-dev-9.1 |
26 | 39 | |
27 | - # Connect to database server | |
40 | + # Install only the necessary gems | |
41 | + sudo -u gitlab -H bundle install --deployment --without development test mysql | |
42 | + | |
43 | + # Login to PostgreSQL | |
28 | 44 | sudo -u postgres psql -d template1 |
29 | 45 | |
30 | - # Add a user called gitlab. Change $password to a real password | |
46 | + # Create a user for GitLab. (change $password to a real password) | |
31 | 47 | template1=# CREATE USER gitlab WITH PASSWORD '$password'; |
32 | 48 | |
33 | 49 | # Create the GitLab production database & grant all privileges on database |
34 | 50 | template1=# CREATE DATABASE gitlabhq_production OWNER gitlab; |
35 | 51 | |
36 | - # Quit from PostgreSQL server | |
52 | + # Quit the database session | |
37 | 53 | template1=# \q |
38 | 54 | |
39 | - # Try connect to new database | |
40 | - sudo -u gitlab psql -d gitlabhq_production | |
55 | + # Try connecting to the new database with the new user | |
56 | + sudo -u gitlab -H psql -d gitlabhq_production | |
41 | 57 | |
42 | 58 | |
43 | 59 | |
44 | -#### Select the database you want to use | |
60 | +# Configure GitLab | |
45 | 61 | |
46 | 62 | # Mysql |
47 | 63 | sudo -u gitlab cp config/database.yml.mysql config/database.yml |
... | ... | @@ -49,12 +65,4 @@ GitLab use MySQL as default database but you are free to use PostgreSQL. |
49 | 65 | # PostgreSQL |
50 | 66 | sudo -u gitlab cp config/database.yml.postgresql config/database.yml |
51 | 67 | |
52 | - # make sure to update username/password in config/database.yml | |
53 | - | |
54 | -#### Install gems | |
55 | - | |
56 | - # mysql | |
57 | - sudo -u gitlab -H bundle install --without development test postgres --deployment | |
58 | - | |
59 | - # or postgres | |
60 | - sudo -u gitlab -H bundle install --without development test mysql --deployment | |
68 | +Make sure to update username/password in config/database.yml. | ... | ... |
doc/install/installation.md
... | ... | @@ -122,21 +122,9 @@ Check the [Trouble Shooting Guide](https://github.com/gitlabhq/gitlab-public-wik |
122 | 122 | and ensure you have followed all of the above steps carefully. |
123 | 123 | |
124 | 124 | |
125 | -# 5. Mysql database | |
125 | +# 5. Database | |
126 | 126 | |
127 | - sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev | |
128 | - | |
129 | - # Login to MySQL | |
130 | - $ mysql -u root -p | |
131 | - | |
132 | - # Create the GitLab production database | |
133 | - mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`; | |
134 | - | |
135 | - # Create the MySQL User change $password to a real password | |
136 | - mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password'; | |
137 | - | |
138 | - # Grant proper permissions to the MySQL User | |
139 | - mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost'; | |
127 | +See doc/install/databases.md | |
140 | 128 | |
141 | 129 | |
142 | 130 | # 6. GitLab |
... | ... | @@ -162,12 +150,6 @@ and ensure you have followed all of the above steps carefully. |
162 | 150 | # |
163 | 151 | sudo -u gitlab cp config/gitlab.yml.example config/gitlab.yml |
164 | 152 | |
165 | - # Copy mysql db config | |
166 | - # | |
167 | - # make sure to update username/password in config/database.yml | |
168 | - # | |
169 | - sudo -u gitlab cp config/database.yml.mysql config/database.yml | |
170 | - | |
171 | 153 | # Copy unicorn config |
172 | 154 | # |
173 | 155 | sudo -u gitlab cp config/unicorn.rb.example config/unicorn.rb |
... | ... | @@ -269,8 +251,6 @@ You can login via web using admin generated with setup: |
269 | 251 | |
270 | 252 | # Advanced setup tips: |
271 | 253 | |
272 | -_Checkout databases.md for PostgreSQL_ | |
273 | - | |
274 | 254 | ## Customizing Resque's Redis connection |
275 | 255 | |
276 | 256 | If you'd like Resque to connect to a Redis server on a non-standard port or on | ... | ... |