Install redmine plug-in using docker container

shantanuo picture shantanuo · Apr 15, 2017 · Viewed 15.1k times · Source

I am able to install redmine using these 2 commands.

docker run --name myred1 -e MYSQL_ROOT_PASSWORD=india -e MYSQL_DATABASE=redmine -v /my/custom:/etc/mysql/conf.d  -v /storage/mysql/datadir:/var/lib/mysql -d mysql:5.6

docker run --name abt -p 3000:3000 -v /my/own/datadir:/usr/src/redmine/files --link myred1:mysql -d redmine

But how do I install scrum plugin?

http://www.redmine.org/plugins/scrum-plugin

As per Installation notes...

Download from Files section in the plugin page.

As any Redmine plugin, just deploy it in the plugins folder, ensure folder name is just scrum and then run:

bundle exec rake redmine:plugins:migrate

I tried the above command at command prompt (within docker container)

root@d7b535b9c607:/usr/src/redmine/plugins/scrum# bundle exec rake redmine:plugins:migrate
(in /usr/src/redmine)

But it does not installs the plug-in.

Answer

firegurafiku picture firegurafiku · Apr 18, 2017

You can preserve plugins between container recreations by adding additional data volumes to keep them. Since spawning docker containers without docker-compose is a pain, let me use it for further explanation.

1. Create docker-compose.yml describing your setup

It should create two services (one for each of MySQL and Redmine) in a separate bridged network:

version: '2'

networks:
  redmine-network:

volumes:
  redmine-plugins:
  redmine-themes:
  redmine-data:

services:
  mysql-for-redmine:
    image: mysql:5.6
    networks:
      - redmine-network
    volumes:
      # Consider using separate volume containers
      # instead of host directory mounts.
      - /my/custom:/etc/mysql/conf.d
      - /storage/mysql/datadir:/var/lib/mysql
    environment:
      MYSQL_ROOT_PASSWORD: "<india>"
      MYSQL_DATABASE:      "redmine"

  redmine:
    image: redmine:3.3-passenger
    ports:
      - 3000:3000
    networks:
      - redmine-network
    volumes:
      - redmine-plugins:/usr/src/redmine/plugins
      - redmine-themes:/usr/src/redmine/public/themes
      - redmine-data:/usr/src/redmine/files
    environment:
      # Host name matches the MySQL container name.
      REDMINE_DB_MYSQL:        "mysql-for-redmine"
      REDMINE_DB_USERNAME:     "root"
      REDMINE_DB_PASSWORD:     "<india>"
      REDMINE_SECRET_KEY_BASE: "..."
    restart: always

2. Deploy your config

Simply run docker-compose up -d from the directory where you put your configuration file.

3. Install your plugins (and themes) manually

Find the name of the container running Redmine with docker ps; on my system it's root_redmine_1. Run the following to attach into it:

# docker exec -ti root_redmine_1 gosu redmine bash

It will open a shell for "redmine" user inside the container. Use wget and tar xjf to download and extract plugins you need. Exit the shell when it's done.

4. Restart your instance to check if plugins work

Cast docker restart root_redmine_1 command and see if it's working as supposed. Since the plugins are put on a separate data volume, they should survive container recreation as well.