Install redmine plug-in using docker container
Asked Answered
Z

3

16

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.

Zebulen answered 15/4, 2017 at 10:36 Comment(0)
B
22

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.

Batchelder answered 18/4, 2017 at 17:47 Comment(4)
In case of environment variables, can I use consistent syntax like - REDMINE_DB_MYSQL= instead of REDMINE_DB_MYSQL: ?Zebulen
I understood this. # environment does not accept = because it is a dictionary just like image. volumes and ports are lists.Zebulen
Before you bundle install, you might need to apt update & apt install make gcc.Mohn
If you are using docker-compose, you don't need to formulate the docker command directly. Use docker-compose exec redmine bash, docker-compose restart.Supranatural
P
6

No need to explain what was said at the docker-composer level

version: '3'
services:

  redmine:
    image: redmine
    restart: always
    ports:
      - 3000:3000
    environment:
      - REDMINE_DB_MYSQL=mysql_redmine
      - REDMINE_DB_USERNAME=root
      - REDMINE_DB_PASSWORD=pass
      - REDMINE_PLUGINS_MIGRATE=true
    volumes:
      - ./redmine_data:/usr/src/redmine/files
      - ./redmine-plugins:/usr/src/redmine/plugins

  mysql_redmine:
    image: mysql:5.7
    restart: always
    environment:
      - MYSQL_ROOT_PASSWORD=pass
      - MYSQL_DATABASE=redmine
    volumes:
      - ./mysql-data_red:/var/lib/mysql 

The environment variable REDMINE_PLUGINS_MIGRATE gives the possibility to migrate directly your plugins ! also there is no need to enter in the container

Now you just need to use git submodule add with your plugin git repository in ./redmine-plugins

Profluent answered 25/3, 2019 at 15:29 Comment(0)
Z
3
# if the name of the redmine container is abt then use the following command to login:
docker exec -it abt bash

# change to plugins directory
cd plugins

# download source code
wget https://redmine.ociotec.com/attachments/download/440/scrum%20v0.16.2.tar.gz

# extract
tar xvf scrum\ v0.16.2.tar.gz

# install
bundle exec rake redmine:plugins:migrate

# restart container: 
docker restart abt
Zebulen answered 15/4, 2017 at 11:1 Comment(2)
Doing things this way you're going to lose all your plugins on container recreation.Batchelder
Can I commit the container and create a new image with all my plug-ins?Zebulen

© 2022 - 2024 — McMap. All rights reserved.