Gerrit Docker-based deployment, including Nginx SSL, MySQL

Source: Internet
Author: User
Tags nginx ssl

gerrit  Docker Container-based deployment: command-line startup 1.   start the MySQL container sudo docker run --name mysql -d  -v /gerrit_mysql_data:/var/lib/mysql -e mysql_root_password=123qwezxc -e mysql_ database=reviewdb -e mysql_user=gerrit2 -e mysql_password=gerrit mysql2.  Start Gerrit Container sudo docker run --name gerrit2 --link mysql:db -d -p  8080:8080 -p 29418:29418 -v /gerrit_volume:/var/gerrit/review_site -e database_ type=mysql -e weburl=https://9.186.89.219 -e db_env_mysql_db=reviewdb  -e  httpd_listenurl=proxy-https://*:8080/ openfrontier/gerrit3.  boot Nginx_ssl_gerrit, this image is generated according to the official Nginx image, The corresponding dockerfile configuration is as follows: A. mkdir nginx_ssl_gerrit && cd nginx_ssl_gerritb. cat  > Dockerfile <<EOFFROM nginxCOPY ./nginx/ /etc/nginx/conf.d/    eofc. nignxThe directory structure is as follows:nginx_ssl_gerrit/├── dockerfile└── nginx    ├── default.conf    #ssl的相关配置     ├── gerrit.crt     #自签证书公钥      └── gerrit.key    #自签证书私钥d . default.conf  configuration as follows:cat >  default.conf <<eofserver {    listen 443;     Server_name 127.0.0.1;    ssl  on;    ssl_certificate       conf.d/gerrit.crt;    ssl_certificate_key   conf.d/gerrit.key;    location / {         proxy_pass              http:// gerrit:8080;        proxy_set_header         X-Forwarded-For  $remote_addr;        proxy_set_header         Host  $host;     }    location /login/ {         proxy_pass               http://gerrit:8080;        proxy_ set_header        x-forwarded-for  $remote _addr;         proxy_set_header        Host  $host;     }}EOFe.  self-signed public key certificate Generation OPENSSL&NBSP;REQ&NBSP;-X509&NBSP;-DAYS&NBSP;3650&NBSP;-SUBJ   "/cn=9.186.89.219/"  -nodes -newkey rsa:4096 -sha256 -keyout gerrit.key &NBSP;-OUT&NBSP;GERRIT.CRT Summary: Problems you may encounter during installation: 1. missing project all-projects solution: Enter the MSYQL container, Delete the REVIEWDB database first, then recreate the reviewdb database, and finallyRestart the Gerrit container can 2.  because the authentication method is Opeid, may encounter the first account login, there is no administrator rights (Gerrit default first logged on user for the administrator account) workaround:a.  Remove reviewdb, Then recreate;b.  Delete all files generated at Gerrit startup, that is, all files in/gerrit_volume:/var/gerrit/review_site 3.  use  ssh -p  29418 [email protected] gerrit gsql,  Error:fatal: docker_lab does  not have  "Access database"  capability. Workaround: http://jingyan.baidu.com/article/ 046a7b3ea8122ef9c27fa919.html for ease of administration, you can use Docker-compose to manage multiple containers: The 1.&NBSP;DOCKER-COMPOSE.YML configuration file is as follows: A. mkdir  gerrit-deploy && cd gerrit-deploycat > docker-compose.yml < <eofnginx:    image: nginx_ssl_gerrit    restart: always     links:         - gerrit2:gerrit     ports:        - 443:443gerrit2:     image: openfrontier/gerrit    restart: always    links:         - mysql:db    ports:         - 8080:8080        - 29418:29418     volumes:        - /gerrit_volume:/var/gerrit/review_site     environment:        - database_type=mysql         - DB_ENV_MYSQL_DB=reviewdb         - WEBURL=https://9.186.89.219        -  httpd_listenurl=proxy-https://*:8080/mysql:    image: mysql     restart: always    volumes:        - / gerrit_mysql_data:/var/lib/mysql    environment:        - mysql_root_password= 123qwezxc        - mysql_database=reviewdb         - MYSQL_USER=gerrit2        -  mysql_password=gerriteof2.  start the container:sudo docker-compose up -d 3.  see if it starts:sudo  Docker-compose ps


This article is from the "Everything Possible" blog, please be sure to keep this source http://noican.blog.51cto.com/4081966/1775417

Gerrit Docker-based deployment, including Nginx SSL, MySQL

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.