初号機 環境構築 その10 Docker、Redmine

不要サービスを切るなどをしたかったんだが、取り急ぎ、Redmine を試しに使ってみたいので、初号機に Docker を入れて使ってみることにする。

1.依存パッケージのインストール

ホントは、device-mapper-persistent-data と lvm2 も必要だが、既に入っているので割愛。

# yum install -y yum-utils

2.リポジトリの追加

# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo

3.Docker のインストール~確認

# yum install docker-ce docker-ce-cli containerd.io
# vi /lib/systemd/system/docker.service
====
[Service]
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -g /home/iwakiri/exdata/docker
# ↑ -g /path/to/docker-dir の部分を追記。
====
# systemctl enable docker
# systemctl start docker
# docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:6f744a2005b12a704d2608d8070a494ad1145636eeb74a570c56b94d94ccdbfc
Status: Downloaded newer image for hello-world:latest

Hello from Docker!
This message shows that your installation appears to be working correctly.

To generate this message, Docker took the following steps:
 1. The Docker client contacted the Docker daemon.
 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.
    (amd64)
 3. The Docker daemon created a new container from that image which runs the
    executable that produces the output you are currently reading.
 4. The Docker daemon streamed that output to the Docker client, which sent it
    to your terminal.

To try something more ambitious, you can run an Ubuntu container with:
 $ docker run -it ubuntu bash

Share images, automate workflows, and more with a free Docker ID:
 https://hub.docker.com/

For more examples and ideas, visit:
 https://docs.docker.com/get-started/

4.Docker composeのインストール

# curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
# chmod +x /usr/local/bin/docker-compose
# ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
# docker-compose --version
docker-compose version 1.24.0, build 0aa59064

5.一般ユーザーでDockerを実行できるようにする

さすがにこの辺は Ubuntu にDocker インストールした時と一緒。

$ cat /etc/group | grep docker
docker:x:993:
$ sudo gpasswd -a hoge docker  # hoge は一般ユーザー名
$ cat /etc/group | grep docker
$ docker:x:993:hoge  # 追加されたのを確認
(一旦、ターミナルからログアウトし、再ログイン)
$ docker run hello-world
Unable to find image 'hello-world:latest' locally
latest: Pulling from library/hello-world
1b930d010525: Pull complete
Digest: sha256:92695bc579f31df7a63da6922075d0666e565ceccad16b59c3374d2cf4e8e50e
Status: Downloaded newer image for hello-world:latest
Hello from Docker!
This message shows that your installation appears to be working correctly.
(以下略)

6.Redmine のインストール

今回はパパっと Redmine を立ち上げたかったので、bitnami の配布イメージを使う。(https://bitnami.com/stack/redmine/containers)

$ curl -sSL https://raw.githubusercontent.com/bitnami/bitnami-docker-redmine/master/docker-compose.yml > docker-compose.yml
$ vi docker-compose.yml
====
version: '2'
services:
  mariadb:
    image: 'bitnami/mariadb:10.1'
    environment:
      - ALLOW_EMPTY_PASSWORD=yes
    volumes:
      - 'mariadb_data:/bitnami'
  redmine:
    image: 'bitnami/redmine:4'
    ports:
      - '13000:3000'  # デフォルトはホストの80ポート使うので、ここだけ変えておく。
    volumes:
      - 'redmine_data:/bitnami'
    depends_on:
      - mariadb
volumes:
  mariadb_data:
    driver: local
  redmine_data:
    driver: local
====
$ docker-compose up -d

これだけだと、クライアントの Windows からDocker コンテナとして立ち上げた Redmine にはアクセスできないので、Windows 側で下記のコマンドを実行する。

> route -p add 172.17.0.0 mask 255.255.0.0 [DockerホストのIPアドレス]

 

これで、Windows機から、Docker コンテナの Redmine にアクセスが出来た。

あくまでも Redmine はプロジェクト管理システムなので、大変なのはここからだが・・・

とりあえず、Brabio! やAzure DevOps、trello あたりと比べて使い勝手が良いかどうか。現状、輻輳するタスクを管理するために、DevOps Board → Brabio! と試して来て、Brabio! がそれなりに使えていたのだが、フリープランだと1プロジェクトあたりのタスク数に上限があり、プロジェクトの数にも制限がある。

*それなりに使い勝手は良かったが、期間の短いタスクが多数発生するので、同時にたくさんのタスクを面倒見ようと思うと、操作感はかなりかったるい。

 

Redmine を自力でサーバー用意して動かすならそういった制限はないので、使い勝手が同等に近ければ、本格的に Redmine に乗り換えるとしよう。

 

 

タグ: # #
コメントはまだありません

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA