安裝 python 環境
為了方便地使用並執行 docker,docker-compose 會簡化不少事情!!
yum install -y epel-release python-pip
yum install -y epel-release python-pip
sudo curl -L "https://github.com/docker/compose/releases/download/1.25.4/docker-compose-$(uname -s)-$(uname -m)" -o /usr/bin/docker-compose sudo chmod +x /usr/bin/docker-compose
mkdir -p /home/git/data cd /home/git wget https://raw.githubusercontent.com/sameersbn/docker-gitlab/master/docker-compose.yml docker-compose up
# postgresql docker run --name gitlab-postgresql -d \ --env 'DB_NAME=gitlabhq_production' \ --env 'DB_USER=gitlab' --env 'DB_PASS=password' \ --env 'DB_EXTENSION=pg_trgm' \ --volume /srv/docker/gitlab/postgresql:/var/lib/postgresql \ sameersbn/postgresql:latest # radis docker run --name gitlab-redis -d \ --volume /srv/docker/gitlab/redis:/var/lib/redis \ sameersbn/redis:latest #gitlab docker run --name gitlab -d \ --link gitlab-postgresql:postgresql --link gitlab-redis:redisio \ --publish 10022:22 --publish 10080:80 \ --env 'GITLAB_PORT=10080' --env 'GITLAB_SSH_PORT=10022' \ --env 'GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alpha-numeric-string' \ --env 'GITLAB_SECRETS_SECRET_KEY_BASE=long-and-random-alpha-numeric-string' \ --env 'GITLAB_SECRETS_OTP_KEY_BASE=long-and-random-alpha-numeric-string' \ --volume /srv/docker/gitlab/gitdata:/home/git/data \ sameersbn/gitlab:10.8.4
docker start gitlab-postgresql docker start gitlab-redis docker start gitlab
docker run \ --name='gitlab_backup' \ -it \ --rm \ --link gitlab-postgresql:postgresql --link gitlab-redis:redisio \ --env 'GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alpha-numeric-string' \ --env 'GITLAB_SECRETS_SECRET_KEY_BASE=long-and-random-alpha-numeric-string' \ --env 'GITLAB_SECRETS_OTP_KEY_BASE=long-and-random-alpha-numeric-string' \ -v /var/run/docker.sock:/run/docker.sock \ -v $(which docker):/bin/docker \ -v /srv/docker/gitlab/gitdata:/home/git/data \ -v /srv/docker/gitlab/log/log:/var/log/gitlab \ sameersbn/gitlab:10.8.4 app:rake gitlab:backup:create
docker-compose rm -sf gitlab docker-compose run --rm gitlab app:rake gitlab:backup:create
docker run \ --name='gitlab_restore' \ -it \ --rm \ --link gitlab-postgresql:postgresql \ --link gitlab-redis:redisio \ --env 'GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alpha-numeric-string' \ --env 'GITLAB_SECRETS_SECRET_KEY_BASE=long-and-random-alpha-numeric-string' \ --env 'GITLAB_SECRETS_OTP_KEY_BASE=long-and-random-alpha-numeric-string' \ -v /var/run/docker.sock:/run/docker.sock \ -v $(which docker):/bin/docker \ -v /srv/docker/gitlab/gitdata:/home/git/data \ -v /srv/docker/gitlab/log:/var/log/gitlab \ sameersbn/gitlab:10.8.4 app:rake gitlab:backup:restore