Setup Redmine in 5 minutes using Docker

 

Why use Docker ?

  Using pre-built Docker images is the easiest way to avoid some of the Ruby on Rails version issues: Docker images are provided having been tested and provide a working Redmine solution. This means that you only have to deal with Plugin compatibility issues, which can be sorted out simply by changing the Docker deployement script to use a different Redmine image.

 

Pre-requisites:

  • A server with Docker installed with the docker-compose package
  • Optional: access to a dedicated database & database user if the database is hosted separately

 

Files and folders configuration

 

For this demonstration, a sub-directory "redminedocker" has been created in /opt containing:

File docker-compose.yml

File at the root of the directory containing our running image configuration (see below)

Folder

files

Where the files uploaded to the platform will be stored.

We want to keep the files on the host so that they are not lost if we need to delete the container.

Folder

plugins

Directory where we will "git pull" the plugins we want to try.

We want to keep the files on the host so that they are not lost if we need to delete the container.

Folder

public/themes

Directory and sub-directory where custom/alternative Redmine themes will be installed

We want to keep the files on the host so that they are not lost if we need to delete the container.

Folder configs

Contains the files used when building our custom container image

Optional: to be used if you want to customize the Docker image 

File

Dockerfile

Lists the instructions used to build the custom image

Optional: to be used if you want to customize the Docker image 

File

entrypoint.sh

File that allows us to set up scripts to be run when launching the container or once it's running

Optional: to be used if you want to customize the Docker image 

 

docker-compose.yml

 

Ubuntu
Redhat
version: "3.9"
services:
  redmine:
    container_name: redmine
    image: redmine:5.0.5
    #build: /opt/redminedocker/configs
    restart: always
    ports:
      - "80:3000"
    environment:
      - "REDMINE_PLUGINS_MIGRATE=true"
      - "REDMINE_HTTPS=true"
      - "REDMINE_DB_POSTGRES=db"
      - "REDMINE_DB_DATABASE=redmine"
      - "REDMINE_DB_USERNAME=redadmin"
      - "REDMINE_DB_PASSWORD=tB6mcmsC"
      - "REDMINE_DB_PORT=5432"
    extra_hosts:
      - "db:172.10.11.201"
    volumes:
      - /opt/redminedocker/plugins:/usr/src/redmine/plugins
      - /opt/redminedocker/public/themes:/usr/src/redmine/public/themes
      - /opt/redminedocker/files:/usr/src/redmine/files
version: "3.3"
services:
  redmine:
    container_name: redmine
    image: redmine:5.0.5
    #build: /opt/redminedocker/configs
    restart: always
    ports:
      - "80:3000"
    environment:
      - "REDMINE_PLUGINS_MIGRATE=true"
      - "REDMINE_HTTPS=true"
      - "REDMINE_DB_POSTGRES=db"
      - "REDMINE_DB_DATABASE=redhatmine"
      - "REDMINE_DB_USERNAME=redhatadmin"
      - "REDMINE_DB_PASSWORD=PG8gb5Ts"
      - "REDMINE_DB_PORT=5432"
    extra_hosts:
      - "db:172.10.11.201"
    volumes:
      - /opt/redminedocker/plugins:/usr/src/redmine/plugins
      - /opt/redminedocker/public/themes:/usr/src/redmine/public/themes
      - /opt/redminedocker/files:/usr/src/redmine/files

 

As you can see, there is no major changes: I wanted both images to have their own database in order to run separately database so credentials are different.

 

The only significant change: the version  value.

It depends on the docker engine version available on your platform. You can use a compose version/engine compatibility matrix to select what version to use although it is more likely that the version will be selected based on the options you want/need to use so better read the release notes.

 

 

Our application will be exposed not on the Redmine default port 3000 but on port 80 meaning we only need to connect to the server's public IP once application is up and running.

Leaving defaut value "3000:3000" would only force us to connect by typing:

XXX.XXX.XXX.XXX:3000 

 

  1. Launching the application

If you haven't installed docker and docker-compose packages:

 

Ubuntu
Redhat
sudo apt update -y
sudo apt upgrade -y
sudo apt install docker-compose -y                

sudo dnf upgrade
sudo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf repolist -v
sudo dnf install --nobest docker-ce
sudo dnf install docker-ce -y
sudo systemctl enable --now docker
systemctl is-active docker
curl -L "https://github.com/docker/compose/releases/download/1.23.2/docker-compose-$(uname -s)-$(uname -m)" -o docker-compose
sudo mv docker-compose /usr/local/bin && sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

Simply running an update & upgrade will add Docker packages to APT cache.

Installing docker-compose will automatically install all dependencies.

Docker is enabled by default.

We need to add the proper repository and then install the packages.

Docker is disabled by default, so we need to enable it.

And then Docker-compose package must be installed.

 

 

Once your docker-compose.yml file is ready, simply go to the directory in which it's stored  (/opt/redminedocker in our example) and execute:

sudo docker-compose up -d

 

The service will then pull the image listed and deploy it with the parameters listed in the docker-compose.yml file:

 

Once deployed, you can check that the container is running by executing:

sudo docker ps -a

It will list all the running containers.

 

 

If you only want to check one particular container:

sudo docker ps -a container_name

Which would be for our example:

sudo docker ps -a redmine

 

At this point, you should be able to log into your Redmine application:

 

You can now connect using the default credentials and setup your Redmine platform.

 

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x