Welcome to mirror list, hosted at ThFree Co, Russian Federation.

databases.md « install « doc - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 92011647f11e992fe15f8f685ee0fcab1c0980ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Setup Database

GitLab supports the following databases:

* MySQL (preferred)
* PostgreSQL


## MySQL

    # Install the database packages
    sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev

    # Install only the necessary gems
    sudo -u gitlab -H bundle install --deployment --without development test postgres 

    # Login to MySQL
    $ mysql -u root -p

    # Create a user for GitLab. (change $password to a real password)
    mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password';

    # Create the GitLab production database
    mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;

    # Grant the GitLab user necessary permissopns on the table.
    mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';

    # Quit the database session
    mysql> \q

    # Try connecting to the new database with the new user
    sudo -u gitlab -H mysql -u gitlab -p -D gitlabhq_production

## PostgreSQL

    # Install the database packages
    sudo apt-get install -y postgresql-9.1 libpq-dev

    # Install only the necessary gems
    sudo -u gitlab -H bundle install --deployment --without development test mysql

    # Login to PostgreSQL
    sudo -u postgres psql -d template1

    # Create a user for GitLab. (change $password to a real password)
    template1=# CREATE USER gitlab WITH PASSWORD '$password';

    # Create the GitLab production database & grant all privileges on database
    template1=# CREATE DATABASE gitlabhq_production OWNER gitlab;

    # Quit the database session
    template1=# \q

    # Try connecting to the new database with the new user
    sudo -u gitlab -H psql -d gitlabhq_production



# Configure GitLab

    # Mysql
    sudo -u gitlab cp config/database.yml.mysql config/database.yml

    # PostgreSQL
    sudo -u gitlab cp config/database.yml.postgresql config/database.yml

Make sure to update username/password in config/database.yml.