Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Server \ The Gitlab migrated to Docker container     - Linux operating system boot process analysis (Linux)

- CentOS 6.6 compile and install phpMyAdmin configuration PostgreSQL9.4.1 (Database)

- Apache site default home page settings (Server)

- Linux System Getting Started Learning: After starting in Ubuntu or Debian, enter the command line (Linux)

- Java regular expression syntax (Programming)

- Java thread lifecycle (Programming)

- Ubuntu 14.04 LTS 64-bit install GNS3 1.3.7 (Linux)

- Java garbage collection (Programming)

- C # asynchronous delegates (Programming)

- Linux common network tools: hping Advanced Host Scan (Linux)

- Vim copy and paste register (Linux)

- Logging information through the web GUI (LogAnalyzer) (Server)

- Glibc support encryption by modifying the DNS (Programming)

- Remote database using RMAN recovery test (RAC return to single-instance database) (Database)

- Linux disk partition, format, mount the directory (Linux)

- Linux shell script to adjust the Task Scheduler (Linux)

- Chromium Install Flash Official Guide (Linux)

- Fundamentals of the Java virtual machine memory management principles (Programming)

- Ubuntu Backup and Recovery (Linux)

- MySQL password on those things you should know (Database)

 
         
  The Gitlab migrated to Docker container
     
  Add Date : 2018-11-21      
         
         
         
  Gitlab company has been running in a virtual machine inside ovm, or version 6.7.5. Version a bit old, recent research docker, was trying to migrate to the docker container gitlab go. Find someone really has done gitlab the image, and sincere praise.

1 plan

planning:
A container runs gitlab
A container run MySQL, then link to the gitlab.
A container run Redis, and then link to the gitlab.

2 Installation gitlab

Let's run MySQL,

$ Sudo docker pull sameersbn / mysql: latest
Create mysql data directory on the host host.

$ Sudo mkdir -p / opt / mysql / data
Start MySQL container.

$ Sudo docker run --name mysql -d \
    -v / opt / mysql / data: / var / lib / mysql \
    sameersbn / mysql: latest
Connect to MySQL, modify authorization information

$ Sudo docker exec -it mysql bash
Create a database and authorization.

CREATE DATABASE IF NOT EXISTS `gitlabhq_production` DEFAULT CHARACTER SET` utf8` COLLATE `utf8_unicode_ci`;
GRANT SELECT, LOCK TABLES, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER \
. ON `gitlabhq_production` * TO 'gitlab'@'172.17.%.%' IDENTIFIED BY 'dbpassword';
FLUSH PRIVILEGES;
3 Configure redis

Pull image

$ Sudo docker pull sameersbn / redis: latest
run redis
sh $ sudo docker run --name = redis -d sameersbn / redis: latest

4 Gitlab

Pull the old version of the first back imagepull

$ Sudo docker pull sameersbn / gitlab: 6.7.5
Create a data directory

$ Sudo mkdir -p / opt / gitlab / data
This directory will be mapped to the / home / git / data directory window, so here to save all the data, be sure not to delete the content here.

Run gitlab container, set the container will be migration and other database operations.

$ Sudo docker run --name gitlab -i -t --rm --link mysql: mysql \
  -e "DB_USER = gitlab" -e "DB_PASS = dbpassword" \
  -e "DB_NAME = gitlabhq_production" \
  -v / opt / gitlab / data: / home / git / data \
  sameersbn / gitlab: 6.7.5 app: rake gitlab: setup
Run gitlab container

$ Sudo docker run --name gitlab -d -P --link mysql: mysql \
  -e "DB_USER = gitlab" -e "DB_PASS = dbpassword" \
  -e "DB_NAME = gitlabhq_production" \
  -v / opt / gitlab / data: / home / git / data \
  sameersbn / gitlab: 6.7.5
# Export Backup from the original in gitlab
$ Cd / home / git / gitlab
$ Sudo -u git -H bundle exec rake gitlab: backup: create RAILS_ENV = production
The exported file in the / home / git / gitlab / tmp / backups directory.

This document scp to docker gitlab that machine / opt / gitlab / data / backups

Log on to the container gitlab

$ Sudo docker exec -it gitlab bash
Run the following command in containers

$ Cd / home / git / gitlab
$ Sudo -u git -H bundle exec rake gitlab: backup: restore RAILS_ENV = production
$ Exit
This kind of data is all to the new gitlab up. You will find the same with the original.

Let's gitlab upgrade to the new version.

$ Sudo docker stop gitlab
$ Sudo docker rm gitlab

$ Sudo docker run --name gitlab -d -P --link mysql: mysql \
  --link redis: redisio \
  -e "DB_USER = gitlab" -e "DB_PASS = dbpassword" \
  -e "DB_NAME = gitlabhq_production" \
  -v / opt / gitlab / data: / home / git / data \
  sameersbn / gitlab: latest
Configured, save it as an image.

$ Sudo docker commit -m "update gitlab.yml, change host, set timezone to BeiJing" -a "china-ops gitlab v7.9.4" 6af1d0739ae0 china-ops / gitlab: 7.9.4
My original idea was to modify the config / gitlab.yml, the good host, timezone and other changes, and then saved as a new image. Later found to modify the config / gitlab.yml is not effective, it will restore the default values ​​after the restart container. After reading the document to know, hostname, etc. is controlled by the environment variable.

Use this image to start a container

$ Sudo docker run --name gitlab -d \
  -p 80:80 -p 8443: 443 \
  --link mysql: mysql \
  --link redis: redisio \
  -e "DB_USER = gitlab" -e "DB_PASS = dbpassword" \
  -e "DB_NAME = gitlabhq_production" \
  -e "GITLAB_HOST = gitlab.china-ops.com" \
  -e "GITLAB_TIMEZONE = Beijing" \
  -e 'GITLAB_BACKUPS = daily' \
  -e "GITLAB_GRAVATAR_ENABLED = false" \
  -v / opt / gitlab / data: / home / git / data \
  china-ops / gitlab: 7.9.4
Parameters -e 'GITLAB_BACKUPS = daily' backup strategy, we set a day
     
         
         
         
  More:      
 
- Zabbix monitoring different versions of RAID installation and monitoring and MySQL master-slave monitor (Server)
- Bash common several configuration files (Linux)
- Oracle procedure or function Empty Table (Database)
- Ubuntu way of decompressing files (Linux)
- CentOS 5.5 install ntop (Linux)
- Bug tracking library after FastJson omitted the decimal point 0 (Programming)
- Rails 4.1.6 start being given Could not find a JavaScript runtime (Linux)
- Java Set and List in the relationship and difference (Programming)
- Use OpenWrt build WDS wireless network extension on V2 WHR-G300N (Linux)
- CentOS 6.4 of cron scheduled task configuration (Linux)
- java.net.NoRouteToHostException of Hadoop problem: no route to host (Server)
- Linux Regular expressions grep and egrep (Linux)
- How to deploy Python Web application: Heroku deployment process complete records (Server)
- To install Ganglia (Linux)
- Ubuntu 14.04 Nvidia proprietary drivers for install two graphic cards (Linux)
- Linux system security configuration (Linux)
- Linux input and output redirection (Linux)
- Linux log management make the system more secure (Linux)
- Ubuntu install VMware Workstation 11 tutorials at 14.04 / 14.10 (Linux)
- Linux server Php injection prevention (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.