2
6

More than 1 year has passed since last update.

Redmine on Docker にプラグイン導入を簡単に

Last updated at Posted at 2021-10-02

やりたいこと

  • redmineを公式dockerイメージで簡単に立てたい
  • プラグインは入れたい
  • buildはしたくない ← ここ重要

やること

  • docker-compose.yml で redmine と postgres を設定する
  • plugin を解凍して plugins フォルダに入れて起動する

手順

docker-compose.yml

version: '3'

services:
    pdb:
        image: postgres:11-alpine
        environment:
            POSTGRES_PASSWORD: postgres
        #ports:
        #    # for debugging
        #    - 5432:5432
        volumes:
            - /opt/server/postgres:/var/lib/postgresql/data
            - /etc/localtime:/etc/localtime:ro
        restart: unless-stopped

    redmine:
        image: redmine:4-alpine
        environment:
            REDMINE_DB_POSTGRES: pdb
            REDMINE_DB_USERNAME: postgres
            REDMINE_DB_PASSWORD: postgres
            REDMINE_PLUGINS_MIGRATE: "true"
        volumes:
            - /opt/redmine/files:/usr/src/redmine/files
            - /opt/redmine/plugins:/usr/src/redmine/plugins
        ports:
            # for debugging
            - 8080:3000
        depends_on:
            - pdb
        restart: unless-stopped

ポイント

        volumes:
            - /opt/server/postgres:/var/lib/postgresql/data

postgresのデータの永続化のために必要

        environment:
            REDMINE_PLUGINS_MIGRATE: "true"

pluginsフォルダの中のプラグインに対して rake redmine:plugins:migrate を走らせる.一部,なくても動作するプラグインはあるけど,普通は走らせないと500エラーを吐くので必要

        volumes:
            - /opt/redmine/files:/usr/src/redmine/files

チケット等に添付したファイルはストレージに保存されるので,ここの永続化は必須

        volumes:
            - /opt/redmine/plugins:/usr/src/redmine/plugins

プラグインフォルダに後からプラグインを追加するために,ここもマウントしておくと便利

redmine がマウントするファイルパスは書き込み権限をつけておく.

sudo mkdir -p /opt/redmine
sudo chmod 777 /opt/redmine

プラグインの配置

cd /opt/redmine/plugins
unar hogehoge.zip   # アーカイブはunzipしておく
git clone https://github.com/hogehoge/hogehoge.git  # cloneしたら動くものも沢山ある

実行

いつも通りに

docker-compose up -d

dockerを動かしているマシン (host_addressとする) に対して http://host_address:8080/ でアクセスするとredmineが見えるはず.
WEBrickが起動するまで接続できないので,焦らないこと.

docker-compose.yml 内で for debugging と書いたところは,フロントエンドにnginxとかを使う場合は不要.
その場合,upstreamにredmine:3000を指定する
pdbのportsは隠蔽しておいた方がいい

使っているプラグイン

参考までに

2
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
6