gitlab: moved repositories directory to /home/git/data/repositories

This commit is contained in:
Sameer Naik 2013-12-21 14:30:55 +05:30
parent 1650463d71
commit ffc4c21aff
3 changed files with 26 additions and 15 deletions

View File

@ -50,18 +50,18 @@ You should now have GitLab ready for testing. If you want to use GitLab for more
### Mounting volumes
GitLab is a code hosting software and as such you don't want to lose your code when the docker container is stopped/deleted. To avoid losing any data, you should mount volumes at.
* /home/git/repositories
* /home/git/data
* /home/git/gitlab-satellites
* /home/git/.ssh
Volumes can be mounted in docker by specifying the **'-v'** option in the docker run command.
```bash
mkdir /opt/gitlab/repositories
mkdir /opt/gitlab/data
mkdir /opt/gitlab/gitlab-satellites
mkdir /opt/gitlab/.ssh
docker run -d \
-v /opt/gitlab/repositories:/home/git/repositories \
-v /opt/gitlab/data:/home/git/data \
-v /opt/gitlab/gitlab-satellites:/home/git/gitlab-satellites \
-v /opt/gitlab/.ssh:/home/git/.ssh sameersbn/gitlab
```
@ -75,7 +75,7 @@ This docker image is configured to use a MySQL database backend. The database co
```bash
mkdir /opt/gitlab/mysql
docker run -d \
-v /opt/gitlab/repositories:/home/git/repositories \
-v /opt/gitlab/data:/home/git/data \
-v /opt/gitlab/gitlab-satellites:/home/git/gitlab-satellites \
-v /opt/gitlab/.ssh:/home/git/.ssh \
-v /opt/gitlab/mysql:/var/lib/mysql sameersbn/gitlab
@ -104,7 +104,7 @@ To make sure the database is initialized start the container with **app:db:initi
```bash
docker run -d \
-e "DB_HOST=192.168.1.100" -e "DB_NAME=gitlabhq_production" -e "DB_USER=gitlab" -e "DB_PASS=password" \
-v /opt/gitlab/repositories:/home/git/repositories \
-v /opt/gitlab/data:/home/git/data \
-v /opt/gitlab/gitlab-satellites:/home/git/gitlab-satellites \
-v /opt/gitlab/.ssh:/home/git/.ssh sameersbn/gitlab app:db:initialize
```
@ -114,7 +114,7 @@ This will initialize the gitlab database. Now that the database is initialized,
```bash
docker run -d \
-e "DB_HOST=192.168.1.100" -e "DB_NAME=gitlabhq_production" -e "DB_USER=gitlab" -e "DB_PASS=password" \
-v /opt/gitlab/repositories:/home/git/repositories \
-v /opt/gitlab/data:/home/git/data \
-v /opt/gitlab/gitlab-satellites:/home/git/gitlab-satellites \
-v /opt/gitlab/.ssh:/home/git/.ssh sameersbn/gitlab
```
@ -132,7 +132,7 @@ The following environment variables need to be specified to get mail support to
```bash
docker run -d \
-e "SMTP_USER=USER@gmail.com" -e "SMTP_PASS=PASSWORD" \
-v /opt/gitlab/repositories:/home/git/repositories \
-v /opt/gitlab/data:/home/git/data \
-v /opt/gitlab/gitlab-satellites:/home/git/gitlab-satellites \
-v /opt/gitlab/.ssh:/home/git/.ssh sameersbn/gitlab
```
@ -147,7 +147,7 @@ I have only tested standard gmail and google apps login. I expect that the curre
```bash
docker run -d -h git.local.host \
-v /opt/gitlab/repositories:/home/git/repositories \
-v /opt/gitlab/data:/home/git/data \
-v /opt/gitlab/gitlab-satellites:/home/git/gitlab-satellites \
-v /opt/gitlab/.ssh:/home/git/.ssh \
-v /opt/gitlab/mysql:/var/lib/mysql \
@ -160,7 +160,7 @@ If you are using an external mysql database
```bash
docker run -d -h git.local.host \
-v /opt/gitlab/repositories:/home/git/repositories \
-v /opt/gitlab/data:/home/git/data \
-v /opt/gitlab/gitlab-satellites:/home/git/gitlab-satellites \
-v /opt/gitlab/.ssh:/home/git/.ssh \
-e "DB_HOST=192.168.1.100" -e "DB_NAME=gitlabhq_production" -e "DB_USER=gitlab" -e "DB_PASS=password" \
@ -185,7 +185,7 @@ For backups we mount a volume at /home/git/gitlab/tmp/backups so the backups are
mkdir -p /opt/gitlab/backups
docker run -i -t -h git.local.host \
-v /opt/gitlab/backups:/home/git/gitlab/tmp/backups \
-v /opt/gitlab/repositories:/home/git/repositories \
-v /opt/gitlab/data:/home/git/data \
-v /opt/gitlab/gitlab-satellites:/home/git/gitlab-satellites \
-v /opt/gitlab/.ssh:/home/git/.ssh \
sameersbn/gitlab app:backup

View File

@ -149,11 +149,15 @@ sed 's/worker_processes 2/worker_processes '${UNICORN_WORKERS}'/' -i /home/git/g
# configure unicorn timeout
sed 's/timeout 30/timeout '${UNICORN_TIMEOUT}'/' -i /home/git/gitlab/config/unicorn.rb
# make sure /home/git/repositories/ has the right permissions in case it is mounted as a volume.
sudo chmod ug+rwX,o-rwx /home/git/repositories/
sudo chmod ug-s /home/git/repositories/
find /home/git/repositories/ -type d -print0 | sudo xargs -0 chmod g+s
chown git:git /home/git/repositories
# take ownership of /home/git/data
chown git:git /home/git/data
# create the repositories directory and make sure it has the right permissions
sudo -u git -H mkdir -p /home/git/data/repositories/
sudo chmod ug+rwX,o-rwx /home/git/data/repositories/
sudo chmod ug-s /home/git/data/repositories/
find /home/git/data/repositories/ -type d -print0 | sudo xargs -0 chmod g+s
chown git:git /home/git/data/repositories
# make sure /home/git/gitlab-satellites/ has the right permissions in case it is mounted as a volume.
sudo chmod ug+rwX,o-rwx /home/git/gitlab-satellites/

View File

@ -6,6 +6,9 @@
# add git user
adduser --disabled-login --gecos 'GitLab' git
# create the data store
sudo -u git -H mkdir -p /home/git/data
# install gitlab-shell
sudo -u git -H mkdir -p /home/git/gitlab-shell
wget "https://github.com/gitlabhq/gitlab-shell/archive/v1.8.0.tar.gz" -O - | tar -zvxf - --strip=1 -C /home/git/gitlab-shell/
@ -13,6 +16,7 @@ chown -R git:git /home/git/gitlab-shell/
cd /home/git/gitlab-shell
sudo -u git -H cp -a config.yml.example config.yml
sudo -u git -H sed 's/repos_path: "\/home\/git\/repositories"/repos_path: "\/home\/git\/data\/repositories"/' -i config.yml
sudo -u git -H ./bin/install
# install gitlab
@ -28,6 +32,9 @@ sudo -u git -H cp config/resque.yml.example config/resque.yml
sudo -u git -H cp config/unicorn.rb.example config/unicorn.rb
sudo -u git -H cp config/initializers/rack_attack.rb.example config/initializers/rack_attack.rb
# configure repositories path
sudo -u git -H sed 's/repos_path: \/home\/git\/repositories\//repos_path: \/home\/git\/data\/repositories\//' -i config/gitlab.yml
# create required tmp and log directories
sudo -u git -H mkdir -p tmp/pids/ tmp/sockets/
chmod -R u+rwX log tmp