7/23/2017

Docker Redmine 기본설치

1. Redmine 소개 

SVN or GIT  소스를 관리만을 하지만, Redmine or Track 은 Project 관리와 버그 추적을 쉽게 해주기 위해서 만들어진 통합된 프로젝트 관리 프로그램이다.
흔히 ITS(Issue Tracking Ssystem) 이라고도 불리우기도 하며,Redmine이전에도 다양한 오픈소스가 존재한다. 

최근에는 거의 오픈소스는 Redmine으로 사용으로 가거나, 유료인 JIRA 사용하는 것으로 보인다.

오픈소스 ITS(Issue Tracking Ssystem)/BTS관련소개 
Redmine 기능 및 소개
  https://www.redmine.org/
  https://ko.wikipedia.org/wiki/%EB%A0%88%EB%93%9C%EB%A7%88%EC%9D%B8

Redmine 설치 전 기본환경사항파악
  http://www.redmine.org/projects/redmine/wiki/RedmineInstall#Supported-database-back-ends

Redmine은 Database를 필요하며, 기본적으로 Database도 설치를 해줘야 한다.
이전에는 각 서버에 다 설치해주었지만, 요즘 Docker가 있어서 편하다. 


2. Docker로 Redmine 설치방법 

아래의 설치방법을 보면, Redmine Image는 Database 필요하고, SQlite3가 포함하고 있지만, Multi-User로는 사용이 불가능하다고 한다.
Database를 MySQL or PostgreSQL로 변경하여 2개의 Container를 설치 및 연결해보자.

설치전 Docker의 기본환경을 구축하자
  https://ahyuo79.blogspot.com/2017/07/docker.html

Docker 기본 명령어 파악
  https://docs.docker.com/engine/reference/commandline/docker/

Redmine 설치방법
  https://docs.docker.com/samples/library/redmine/
  https://github.com/sameersbn/docker-redmine


2.1 Docker Images 찾기

Docker로 Redmine/MySQL/Postgres Image를 찾아 많이 사용하는 것을 찾아보자.

  • Docker Image 검색하여 설치할 Image 찾기  
Docker Hub내에서 존재하는 관련 Image들을 검색을 해보자

Docker Hub에서 검색
  https://hub.docker.com/search?q=redmine
  
$ sudo docker search redmine
NAME                              DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
redmine                           Redmine is a flexible project management w...   621       [OK]       
sameersbn/redmine                                                                 284                  [OK]
bitnami/redmine                   Bitnami Docker Image for Redmine                30                   [OK]
74th/redmine-all-in-one           Redmine includes hosting SVN & Git , backl...   9                    [OK]
inspiredgeek/redmine-alpine       Simple Docker images to run Redmine tracke...   6                    [OK]
eeacms/redmine                    EEA Redmine docker setup                        2                    [OK]
themill/redmine                   fork for redmine to add/test theming            1                    [OK]
fjudith/redmine                   Dockerized Redmine based on redmine:3.3 of...   1                    [OK]
minimaru/openshift-redmine        A Debian8 based Redmine v3.2 image for use...   1                    
arm64v8/redmine                   Redmine is a flexible project management w...   1                    
tkeydll/docker-redmine-backlogs   Redmine with backlogs plugin.                   1                    [OK]
arm32v7/redmine                   Redmine is a flexible project management w...   1                    
commonms/redmine                  Docker image for Redmine.                       1                    [OK]
sorintdev/redmine                 Redmine with custom theme                       0                    
nitra/redmine_priority_tasks      redmine_priority_tasks                          0                    [OK]
robobeerun/redmine                Redmine image that runs as non-privileged ...   0                    [OK]
togent2/redmine_ttdlx_enabled     redmine_ttdlx_enabled                           0                    [OK]
amd64/redmine                     Redmine is a flexible project management w...   0                    
stackbrew/redmine                 Deprecated; use 'redmine' from https://hub...   0                    
trollin/redmine                                                                   0                    
mikroways/redmine                 redmine passenger image                         0                    [OK]
rubykube/redmine                  Redmine 4.0 container                           0                    [OK]
honsiorovskyi/redmine             Official Redmine + Git + Mercurial              0                    [OK]
dockerpicosoft/redminemisfat                                                      0                    


 $ sudo docker search mysql
NAME                                                   DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
mysql                                                  MySQL is a widely used, open-source relati...   6972      [OK]       
mariadb                                                MariaDB is a community-developed fork of M...   2226      [OK]       
mysql/mysql-server                                     Optimized MySQL Server Docker images. Crea...   512                  [OK]
percona                                                Percona Server is a fork of the MySQL rela...   369       [OK]       
zabbix/zabbix-server-mysql                             Zabbix Server with MySQL database support       126                  [OK]
hypriot/rpi-mysql                                      RPi-compatible Docker Image with Mysql          96                   
zabbix/zabbix-web-nginx-mysql                          Zabbix frontend based on Nginx web-server ...   67                   [OK]
centurylink/mysql                                      Image containing mysql. Optimized to be li...   59                   [OK]
1and1internet/ubuntu-16-nginx-php-phpmyadmin-mysql-5   ubuntu-16-nginx-php-phpmyadmin-mysql-5          44                   [OK]
centos/mysql-57-centos7                                MySQL 5.7 SQL database server                   39                   
mysql/mysql-cluster                                    Experimental MySQL Cluster Docker images. ...   34                   
tutum/mysql                                            Base docker image to run a MySQL database ...   32                   
schickling/mysql-backup-s3                             Backup MySQL to S3 (supports periodic back...   23                   [OK]
bitnami/mysql                                          Bitnami MySQL Docker Image                      19                   [OK]
zabbix/zabbix-proxy-mysql                              Zabbix proxy with MySQL database support        15                   [OK]
linuxserver/mysql                                      A Mysql container, brought to you by Linux...   14                   
centos/mysql-56-centos7                                MySQL 5.6 SQL database server                   10                   
circleci/mysql                                         MySQL is a widely used, open-source relati...   6                    
openshift/mysql-55-centos7                             DEPRECATED: A Centos7 based MySQL v5.5 ima...   6                    
mysql/mysql-router                                     MySQL Router provides transparent routing ...   4                    
jelastic/mysql                                         An image of the MySQL database server main...   1                    
openzipkin/zipkin-mysql                                Mirror of https://quay.io/repository/openz...   1                    
cloudfoundry/cf-mysql-ci                               Image used in CI of cf-mysql-release            0                    
cloudposse/mysql                                       Improved `mysql` service with support for ...   0                    [OK]
ansibleplaybookbundle/mysql-apb                        An APB which deploys RHSCL MySQL                0                    [OK]


$ sudo docker search postgres
NAME                                     DESCRIPTION                                     STARS     OFFICIAL   AUTOMATED
postgres                                 The PostgreSQL object-relational database ...   5498      [OK]       
sameersbn/postgresql                                                                     135                  [OK]
paintedfox/postgresql                    A docker image for running Postgresql.          77                   [OK]
orchardup/postgresql                     https://github.com/orchardup/docker-postgr...   48                   [OK]
kiasaki/alpine-postgres                  PostgreSQL docker image based on Alpine Linux   42                   [OK]
centos/postgresql-96-centos7             PostgreSQL is an advanced Object-Relationa...   29                   
bitnami/postgresql                       Bitnami PostgreSQL Docker Image                 22                   [OK]
begriffs/postgrest                       Moved to https://hub.docker.com/r/postgres...   16                   [OK]
centos/postgresql-94-centos7             PostgreSQL is an advanced Object-Relationa...   15                   
schickling/postgres-backup-s3            Backup PostgresSQL to S3 (supports periodi...   13                   [OK]
crunchydata/crunchy-postgres             Crunchy PostgreSQL is an open source, unmo...   12                   
circleci/postgres                        The PostgreSQL object-relational database ...   11                   
wrouesnel/postgres_exporter              Postgres metrics exporter for Prometheus.       9                    
postdock/postgres                        PostgreSQL server image, can work in maste...   9                    [OK]
clkao/postgres-plv8                      Docker image for running PLV8 1.4 on Postg...   8                    [OK]
centos/postgresql-95-centos7             PostgreSQL is an advanced Object-Relationa...   6                    
blacklabelops/postgres                   Postgres Image for Atlassian Applications       4                    [OK]
frodenas/postgresql                      A Docker Image for PostgreSQL                   3                    [OK]
camptocamp/postgresql                    Camptocamp PostgreSQL Docker Image              3                    [OK]
fredboat/postgres                        PostgreSQL 10.0 used in FredBoat's docker-...   0                    
ansibleplaybookbundle/postgresql-apb     An APB which deploys RHSCL PostgreSQL           0                    [OK]
cfcommunity/postgresql-base              https://github.com/cloudfoundry-community/...   0                    
relatable/postgrest                      Nginx container to serve web requests to t...   0                    [OK]
cfcommunity/postgresql                   https://github.com/cloudfoundry-community/...   0                    
ansibleplaybookbundle/rds-postgres-apb   An APB that deploys an RDS instance of Pos...   0                    [OK]



2.2  Docker Container/Image 설치 

Redmine은 Database를 사용하는데, MySql or Postgres로 설치하여 연결할 것이다.
docker run을 이용하여 새로운 Container에 이름을 할당하고, 상위에서 찾은 Image 이름으로 설치 와 동시에 실행해보자



docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
Options Description
--detach , -d Run container in background and print container ID
--name Assign a name to the container
--env , -e Set environment variables
--link Add link to another container
--publish , -p Publish a container’s port(s) to the host


-p 옵션을 통해 Redmine에 접속할수 있는 port를 변경이 가능하다.
http://localhost:3000 or http://host-ip:3000 으로 redmine 접속이 가능하다.
이 옵션이 없다면, 기본적으로 http://localhost:8080, or http://host-ip:8080 로 동작한다.

  • MySql or Postgres Container / Image 설치 및 실행 
$ sudo docker run -d --name mysql -e MYSQL_ROOT_PASSWORD=secret -e MYSQL_DATABASE=redmine mysql 
or 
$ sudo  docker run -d --name postgres -e POSTGRES_PASSWORD=secret -e POSTGRES_USER=redmine postgres

-e 옵션은 Environment Variables 부분 참조
마지막에 반드시 찾은 Image 이름
  • Redmine  Container / Image 설치 및 실행 
$ sudo docker run -d --name redmine -p 3000:3000 --link mysql:mysql redmine // Database: MySQL
or 
$ sudo docker run -d --name redmine -p 3000:3000 --link postgres:postgres redmine  // Database: Postgres


Redmine 설치방법

  https://docs.docker.com/engine/reference/commandline/run/

2.3 Docker Container/Image 삭제 

상위에서 Container와 Image를 생성했기 때문에, 관련사항들을 다 삭제해보자.

  • Container/ Image 제거 

$ sudo docker ps  // 동작중인 Container 파악 
CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS              PORTS                    NAMES
1fd4d477c23b        redmine:latest      "/docker-entrypoint.   4 months ago        Up 3 minutes        0.0.0.0:3000->3000/tcp   redmine             
89d3dc20a51a        mysql:latest        "docker-entrypoint.s   4 months ago        Up 3 minutes        3306/tcp                 mysql 
 
$ sudo docker stop mysql redmine  // 동작중인 Container 멈춤, 상위 CONTAINER ID 가능  

$ sudo docker rm mysql redmine   // Containers 제거   

$ sudo docker rmi mysql redmine  // Images 제거 

$ sudo docker images             // 설치된 Image 재확인 
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE


2.4  Docker Containers 실행/정지 

현재 Ubuntu를 사용하고 있으며, 기본적으로 재부팅을 하면, Docker Engine도 멈추기 때문에, 다시 Container를 가동하여 Image를 동작해야한다.

  • Docker-MySql 과 Redmine 동작실행 
$ sudo docker start mysql redmine
mysql
redmine

  • Docker-MySql 과 Redmine 동작멈춤 
$ sudo docker stop mysql redmine
mysql
redmine


2.5 Docker Container/Images 확인 및 동작확인

Docker에서 Container or Images의 상태를 각각 확인을 해보자.

  • 설치된 Docker-Images 확인
$ sudo docker images // MySQL 설치시
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
redmine             latest              1b5ebc39dc3e        4 months ago        662.5 MB
mysql               latest              08fa4e794b8b        5 months ago        371.4 MB

$ sudo docker images  //Postgres 설치시 
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
redmine             latest              e297148f3bd1        10 hours ago        687.2 MB
postgres            latest              a283a33b6783        10 days ago         228.4 MB

  • 동작 중인 Docker-Container/Images 확인 

$ sudo docker ps // MySQL 사용시 
CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS              PORTS                    NAMES
1fd4d477c23b        redmine:latest      "/docker-entrypoint.   4 months ago        Up 3 minutes        0.0.0.0:3000->3000/tcp   redmine             
89d3dc20a51a        mysql:latest        "docker-entrypoint.s   4 months ago        Up 3 minutes        3306/tcp                 mysql 

$ sudo docker ps // Postgres 사용시 
CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS              PORTS                    NAMES
33f9f499cef9        redmine:latest      "/docker-entrypoint.   12 seconds ago      Up 11 seconds       0.0.0.0:3000->3000/tcp   redmine             
0e33f82bb946        postgres:latest     "docker-entrypoint.s   6 minutes ago       Up 6 minutes        5432/tcp                 postgres 


  • Docker의 Container 상태 (CPU/MEM/NET 정보)


$ sudo docker stats mysql redmine  // 각 container가 미동작 확인  
CONTAINER           CPU %               MEM USAGE/LIMIT     MEM %               NET I/O
mysql               0.00%               0 B/0 B             0.00%               0 B/0 B
redmine             0.00%               0 B/0 B             0.00%               0 B/0 B

$ sudo docker stats mysql redmine  // 각 container 동작 Image 실행 
CONTAINER           CPU %               MEM USAGE/LIMIT       MEM %               NET I/O
mysql               0.10%               244.1 MiB/3.778 GiB   6.31%               55.03 KiB/282.5 KiB
redmine             0.01%               124.5 MiB/3.778 GiB   3.22%               284.1 KiB/52.86 KiB


  • Docker Container의 Log 파악 


$  sudo docker logs redmine  // redmine or mysql 각 Image 선택 
........


  • Docker 관련사항 찾아보기 

$ sudo find / -name redmine  // redmine image 찾기 
/var/lib/docker/vfs/dir/06d0898d2ee8f722f5dbb5db412ec12f44ab8ca997398367612a442570f5b580/redmine
/var/lib/docker/aufs/diff/07edb9d05a16af091a3eb354febfa11691632aba9faed3df2985aea033d5b06b/usr/src/redmine
/var/lib/docker/aufs/diff/605d9552a2bf32d1ebda51db67c3ea87e235bcd0a07afa347688248481acbd44/usr/src/redmine
/var/lib/docker/aufs/diff/605d9552a2bf32d1ebda51db67c3ea87e235bcd0a07afa347688248481acbd44/usr/src/redmine/lib/redmine
/var/lib/docker/aufs/diff/605d9552a2bf32d1ebda51db67c3ea87e235bcd0a07afa347688248481acbd44/usr/src/redmine/test/unit/lib/redmine
/var/lib/docker/aufs/diff/605d9552a2bf32d1ebda51db67c3ea87e235bcd0a07afa347688248481acbd44/usr/src/redmine/test/integration/lib/redmine
/var/lib/docker/aufs/diff/716af2fdc4bfa300f02e52e3676615ee00faa82d2ffe011f5b8dc03f2edff416/usr/src/redmine
/var/lib/docker/aufs/diff/1fd4d477c23b613b7d6c463f9548dc89b10cc11e5dfbf871390c5af34de5c80c/usr/src/redmine

$ sudo find / -name mysql  // mysql  image 찾기 
/etc/apparmor.d/abstractions/mysql
/etc/apparmor.d/snap/abstractions/mysql
/etc/init.d/mysql
/etc/mysql
/var/lib/docker/vfs/dir/06d0898d2ee8f722f5dbb5db412ec12f44ab8ca997398367612a442570f5b580/mysql
/var/lib/docker/aufs/diff/9ca537d00bf27e382442900487f836aedb7f2eb4805e87fa6bca90921e840f49/etc/mysql
/var/lib/docker/aufs/diff/e15d670277a7990e98ddeaeeba7ac34531c8db08d418a69330a4e886fa8aa768/etc/init.d/mysql
/var/lib/docker/aufs/diff/e15d670277a7990e98ddeaeeba7ac34531c8db08d418a69330a4e886fa8aa768/etc/mysql
/var/lib/docker/aufs/diff/e15d670277a7990e98ddeaeeba7ac34531c8db08d418a69330a4e886fa8aa768/var/lib/mysql
/var/lib/docker/aufs/diff/e15d670277a7990e98ddeaeeba7ac34531c8db08d418a69330a4e886fa8aa768/var/log/mysql
/var/lib/docker/aufs/diff/e15d670277a7990e98ddeaeeba7ac34531c8db08d418a69330a4e886fa8aa768/usr/lib/mysql
/var/lib/docker/aufs/diff/e15d670277a7990e98ddeaeeba7ac34531c8db08d418a69330a4e886fa8aa768/usr/bin/mysql
/var/lib/docker/aufs/diff/e15d670277a7990e98ddeaeeba7ac34531c8db08d418a69330a4e886fa8aa768/usr/share/mysql
...

$ sudo ls /var/lib/docker/   
aufs  containerd  graph  init   network   plugins        runtimes  tmp vfs
builder  containers  image  linkgraph.db  overlay2  repositories-aufs  swarm  trust volumes



2.6 Docker 설치 및 실행시 Network 상태확인

상위에서 Docker를 설치 한 후, Docker Image들을 설치하고 실행을 한 후 네트워크 상태를 확인해보면
아래와 같이 두 종류의 Link가 새로 생성되었다.

  1. docker0:  docker 명령어 설치시 생성됨 
  2. vethx : docker image 실행시 생성됨 


$ ifconfig
docker0   Link encap:Ethernet  HWaddr 8e:12:bf:f6:e3:e5  
          inet addr:172.17.42.1  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::5c9b:24ff:fea2:322/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:17 errors:0 dropped:0 overruns:0 frame:0
          TX packets:70 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1100 (1.1 KB)  TX bytes:10832 (10.8 KB)

eth0      Link encap:Ethernet  HWaddr 08:00:27:0f:63:43  
          inet addr:192.168.1.100  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe0f:6343/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5777 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2116 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:7996724 (7.9 MB)  TX bytes:192119 (192.1 KB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:288 errors:0 dropped:0 overruns:0 frame:0
          TX packets:288 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:23759 (23.7 KB)  TX bytes:23759 (23.7 KB)

veth15bcff9 Link encap:Ethernet  HWaddr 8e:12:bf:f6:e3:e5  
          inet6 addr: fe80::8c12:bfff:fef6:e3e5/64 Scope:Link
          UP BROADCAST RUNNING  MTU:1500  Metric:1
          RX packets:348 errors:0 dropped:0 overruns:0 frame:0
          TX packets:408 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:289303 (289.3 KB)  TX bytes:56696 (56.6 KB)

veth1c96ca0 Link encap:Ethernet  HWaddr f6:bb:61:16:e3:09  
          inet6 addr: fe80::f4bb:61ff:fe16:e309/64 Scope:Link
          UP BROADCAST RUNNING  MTU:1500  Metric:1
          RX packets:390 errors:0 dropped:0 overruns:0 frame:0
          TX packets:365 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:54193 (54.1 KB)  TX bytes:291716 (291.7 KB)


3. Redmine 설정 및 사용

브라우저에서 http://192.168.1.100:3000/login  로그인

ID: admin
PW: admin


내계정->비밀번호 바꾸기
PW변경
Atom 접근키 생성

현재 기본사용만 했을 뿐 다른 플러그인이나, 관련사항을 설치하지 않았다.


Redmine 설치 후 설정부분
  http://www.whatwant.com/367
  http://www.redmine.org/projects/redmine/wiki/RedmineInstall#Supported-database-back-ends