Docker Redmine 公式イメージを使った構築
オフィシャルイメージ
こちらのサイトを参考に、docker-compose.yml を作成
docker-compose.yml
パスワードなどは、適宜変更する。
また、一旦起動した後に再起動する場合は、REDMINE_NO_DB_MIGRATE を設定しないと、DB 内容が消えてしまう。。。
version: '3.1' services: redmine: image: redmine restart: always ports: - 8080:3000 environment: REDMINE_DB_MYSQL: db REDMINE_DB_PASSWORD: example REDMINE_SECRET_KEY_BASE: supersecretkey REDMINE_NO_DB_MIGRATE: 1 volumes: - redmine-files:/usr/src/redmine/files db: image: mysql:5.7 restart: always environment: MYSQL_ROOT_PASSWORD: example MYSQL_DATABASE: redmine volumes: - redmine-db:/var/lib/mysql volumes: redmine-db: redmine-files:
起動後に admin ユーザーの姓・名を変更しようとすると、エラーになる。。。
ActiveRecord::StatementInvalid:
Mysql2::Error: Incorrect string value: '\x..\x..'
どうやらマルチバイト文字を保存しようとすると、エラーになる模様。。。
ネットを探すと、同じような症状の方の対策があったため、修正を実施。
修正用SQL
ALTER DATABASE redmine CHARACTER SET utf8mb4 COLLATE utf8mb4_bin; ALTER TABLE ar_internal_metadata CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE attachments CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE boards CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE changes CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE changeset_parents CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE changesets CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE changesets_issues CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE comments CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE custom_field_enumerations CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE custom_fields CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE custom_fields_projects CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE custom_fields_roles CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE custom_fields_trackers CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE custom_values CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE documents CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE email_addresses CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE enabled_modules CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE enumerations CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE groups_users CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE import_items CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE imports CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE issue_categories CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE issue_relations CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE issue_statuses CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE issues CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE journal_details CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE journals CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE member_roles CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE members CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE messages CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE news CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE open_id_authentication_associations CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE open_id_authentication_nonces CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE projects CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE projects_trackers CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE queries CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE queries_roles CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE repositories CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE roles CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE roles_managed_roles CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE schema_migrations CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE settings CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE time_entries CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE tokens CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE trackers CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE user_preferences CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE users CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE versions CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE watchers CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE wiki_content_versions CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE wiki_contents CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE wiki_pages CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE wiki_redirects CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE wikis CONVERT TO CHARACTER SET utf8mb4; ALTER TABLE workflows CONVERT TO CHARACTER SET utf8mb4;
メール送信設定
メールの設定は、/usr/src/redmine/config/configuration.yml に記述する。
とりあえず、docker-compose.yml を置いたディレクトリに configuration.yml を作成
default: email_delivery: delivery_method: :smtp smtp_settings: address: "smtp.your.external.server" port: 587 authentication: :login domain: 'my.domain.net' user_name: 'smtp_user_name' password: 'smtp_user_password'
これを docker-compose で読み込むよう、ボリュームマッピングする。
version: '3.1' services: redmine: ... volumes: - ./configuration.yml:/usr/src/redmine/config/configuration.yml - redmine-files:/usr/src/redmine/files
Todos
- Nginx 経由の Reverse Proxy で SSL 化する
- 定期バックアップを取得する