|
| 1 | +***The following howto assumes that you are running Debian 7 (wheezy)*** |
| 2 | + |
| 3 | +# Stop Gitlab |
| 4 | + |
| 5 | +```bash |
| 6 | +service gitlab stop |
| 7 | +``` |
| 8 | + |
| 9 | +# Install postgresql |
| 10 | + |
| 11 | +```bash |
| 12 | +sudo apt-get install -y postgresql-9.1 postgresql-client libpq-dev |
| 13 | +``` |
| 14 | + |
| 15 | +# Initial Setup |
| 16 | + |
| 17 | +The following initial setup was taken from installation.md from the main installtion doc |
| 18 | + |
| 19 | +```bash |
| 20 | +# Login to PostgreSQL |
| 21 | +sudo -u postgres psql -d template1 |
| 22 | + |
| 23 | +# Create a user for GitLab. |
| 24 | +template1=# CREATE USER git; |
| 25 | + |
| 26 | +# Create the GitLab production database & grant all privileges on database |
| 27 | +template1=# CREATE DATABASE gitlabhq_production OWNER git; |
| 28 | + |
| 29 | +# Quit the database session |
| 30 | +template1=# \q |
| 31 | + |
| 32 | +# Try connecting to the new database with the new user |
| 33 | +sudo -u git -H psql -d gitlabhq_production |
| 34 | +``` |
| 35 | + |
| 36 | +# Install postgres gem |
| 37 | + |
| 38 | +```bash |
| 39 | +cd ~git/gitlab |
| 40 | +sudo -u git -H bundle install --deployment --without development test mysql aws |
| 41 | +``` |
| 42 | + |
| 43 | +# Dump the mysql database |
| 44 | + |
| 45 | +Make sure you do this as root, and therefore you will also need the root password for mysql as well |
| 46 | + |
| 47 | +```bash |
| 48 | +mysqldump --compatible=postgresql --default-character-set=utf8 -r /tmp/gitlabhq_production.mysql -u root -p gitlabhq_production |
| 49 | +``` |
| 50 | + |
| 51 | +# Convert the mysql to postgres import |
| 52 | + |
| 53 | +```bash |
| 54 | +wget https://raw.github.com/lanyrd/mysql-postgresql-converter/master/db_converter.py -O /tmp/db_converter.py |
| 55 | +python /tmp/db_converter.py /tmp/gitlab_production.mysql /tmp/gitlab_production.psql |
| 56 | +``` |
| 57 | + |
| 58 | +***Note:*** This was tested using debian 7, with python 2.7.3 |
| 59 | + |
| 60 | +# Import the database |
| 61 | + |
| 62 | +```bash |
| 63 | +sudo -u git -H psql -d gitlabhq_production -f /tmp/gitlab_production.psql |
| 64 | +``` |
| 65 | + |
| 66 | +# Update database config |
| 67 | + |
| 68 | +```bash |
| 69 | +cd ~git/gitlab/config |
| 70 | +sudo -u git -H cp database.yml database.yml.backup |
| 71 | +sudo -u git -H cp database.yml.postgresql database.yml |
| 72 | +``` |
| 73 | + |
| 74 | +The defaults from the database.yml should work if you have not made any modifications to the postgres authentication. You may need to change database.yml to suite your config. |
| 75 | + |
| 76 | +# Start Gitlab service |
| 77 | + |
| 78 | +```bash |
| 79 | +service gitlab start |
| 80 | +service nginx restart |
| 81 | +``` |
| 82 | + |
| 83 | +# Check application Status |
| 84 | + |
| 85 | +Check if GitLab and its environment are configured correctly: |
| 86 | + |
| 87 | +```bash |
| 88 | +cd ~git/gitlab |
| 89 | +sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production |
| 90 | +``` |
| 91 | + |
| 92 | +To make sure you didn't miss anything run a more thorough check with: |
| 93 | + |
| 94 | +```bash |
| 95 | +cd ~git/gitlab |
| 96 | +sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production |
| 97 | +``` |
| 98 | + |
0 commit comments