Skip to content

Instantly share code, notes, and snippets.

/colab_paste Secret

Created March 6, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/543259dfb4a05dc4ef17 to your computer and use it in GitHub Desktop.
Save anonymous/543259dfb4a05dc4ef17 to your computer and use it in GitHub Desktop.
Gist created from Colab DPaste
Backup Colab DB
---------------
/usr/pgsql-9.3/bin/pg_dump colab > colab.dump
Backup Gitlab
-------------
cd /usr/lib/gitlab
sudo gitlab-rake gitlab:backup:create
Restore Colab
-------------
* On the DB host drop and recreate colab db (using postgres user):
```
dropdb colab
createdb colab
```
* restore the backup:
``psql colab < colab.dump``
* restore gitlab user permissions:
``echo 'GRANT ALL ON SCHEMA public TO "colab";' | psql colab``
On the integration host:
* run colab migrations using the colab user:
``colab-admin migrate``
* Restart the colab process:
``sudo systemctl restart colab``
Restore Gitlab
---------------
* untar the backup file
* On the DB host drop and recreate gitlab db (using postgres user):
```
dropdb gitlab
createdb gitlab
```
* restore the backup:
``psql gitlab < backup/db/database.sql``
* restore gitlab user permissions:
``echo 'GRANT ALL ON SCHEMA public TO "gitlab";' | psql gitlab``
* On the integration host:
```
sudo chgrp git /usr/lib/gitlab/db/schema.rb
sudo chmod g+w /usr/lib/gitlab/db/schema.rb
```
* Run migrations:
```
cd /usr/lib/gitlab
sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
```
* Copy the repositories:
```
sudo cp -a /vagrant/backup/repositories/* /var/lib/gitlab/repositories
sudo chown -fR git:git /var/lib/gitlab/repositories
```
* Unbundle repositories:
```
cd /var/lib/gitlab/repositories
for ORG in `ls -1`
do
for FILE in `ls -1 $ORG/*.bundle`
do
repo="${FILE%.*}"
sudo -u git git clone --mirror $FILE $repo.git
done
done
```
* Create satellites:
```
cd /usr/lib/gitlab
sudo -u git -H bundle exec rake gitlab:satellites:create RAILS_ENV=production
```
* Restart the Colab host:
```
sudo systemctl restart gitlab
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment