2012-10-25 10:13:11 +02:00
|
|
|
# Databases:
|
|
|
|
|
2012-11-27 21:36:09 +01:00
|
|
|
GitLab use MySQL as default database but you are free to use PostgreSQL.
|
2012-10-25 10:13:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
## MySQL
|
|
|
|
|
|
|
|
sudo apt-get install -y mysql-server mysql-client libmysqlclient-dev
|
|
|
|
|
|
|
|
# Login to MySQL
|
|
|
|
$ mysql -u root -p
|
|
|
|
|
|
|
|
# Create the GitLab production database
|
|
|
|
mysql> CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET `utf8` COLLATE `utf8_unicode_ci`;
|
|
|
|
|
|
|
|
# Create the MySQL User change $password to a real password
|
|
|
|
mysql> CREATE USER 'gitlab'@'localhost' IDENTIFIED BY '$password';
|
|
|
|
|
|
|
|
# Grant proper permissions to the MySQL User
|
|
|
|
mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON `gitlabhq_production`.* TO 'gitlab'@'localhost';
|
|
|
|
|
|
|
|
|
|
|
|
## PostgreSQL
|
|
|
|
|
2012-10-30 12:58:10 +01:00
|
|
|
sudo apt-get install -y postgresql-9.1 postgresql-server-dev-9.1
|
2012-10-25 10:13:11 +02:00
|
|
|
|
|
|
|
# Connect to database server
|
|
|
|
sudo -u postgres psql -d template1
|
|
|
|
|
|
|
|
# Add a user called gitlab. Change $password to a real password
|
|
|
|
template1=# CREATE USER gitlab WITH PASSWORD '$password';
|
|
|
|
|
2012-10-30 12:58:10 +01:00
|
|
|
# Create the GitLab production database & grant all privileges on database
|
|
|
|
template1=# CREATE DATABASE gitlabhq_production OWNER gitlab;
|
2012-10-25 10:13:11 +02:00
|
|
|
|
|
|
|
# Quit from PostgreSQL server
|
|
|
|
template1=# \q
|
|
|
|
|
|
|
|
# Try connect to new database
|
2012-10-30 12:58:10 +01:00
|
|
|
sudo -u gitlab psql -d gitlabhq_production
|
2012-10-25 10:13:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#### Select the database you want to use
|
|
|
|
|
|
|
|
# Mysql
|
|
|
|
sudo -u gitlab cp config/database.yml.mysql config/database.yml
|
|
|
|
|
|
|
|
# PostgreSQL
|
2012-10-26 23:05:20 +02:00
|
|
|
sudo -u gitlab cp config/database.yml.postgresql config/database.yml
|
2012-10-25 10:13:11 +02:00
|
|
|
|
|
|
|
# make sure to update username/password in config/database.yml
|
|
|
|
|
|
|
|
#### Install gems
|
|
|
|
|
|
|
|
# mysql
|
2012-11-27 21:36:09 +01:00
|
|
|
sudo -u gitlab -H bundle install --without development test postgres --deployment
|
2012-10-25 10:13:11 +02:00
|
|
|
|
|
|
|
# or postgres
|
2012-11-27 21:36:09 +01:00
|
|
|
sudo -u gitlab -H bundle install --without development test mysql --deployment
|