Install redmine via docker-compose

4.5
(2)

Sometimes the task arises to deploy, for example, redmine in a quick way and without any wisdom, in order to immediately start your tasks. In order not to be stupid for a long time over errors during installation, you can do it easier and use containerization, and specifically, the already well-known Docker.

But since containers are still essentially immutable entities and, simply by running redmine and the database without preparation, you can admire the changes made before restarting the container, then after stopping it, you have to start all over again. This is in general terms. Therefore, various methods have been invented for the removal of data that must be saved. Here I will not mention docker layers and the like, the thought leads to the fact that you need to take out some directories separately, in which there will be important and necessary data. So let’s start with a quick docker installation and then move on to installing redmine via docker-compose.

Install docker

sudo apt update

Additional components

sudo apt install 
apt-transport-https 
ca-certificates 
curl 
software-properties-common -y

Install the key from the official repository.

curl -fsSL https://download.docker.com/linux/ubuntu/gpg 
 | sudo apt-key add - 

Installing the stable version repository

sudo add-apt-repository 
"deb [arch=amd64] https://download.docker.com/linux/ubuntu 
$(lsb_release -cs) 
stable"

Update the system

sudo apt update

Install docker and docker-compose

sudo apt install -y docker-ce docker-compose 

Configure Docker

Let’s add ourselves (for example, let our login be administrator) to the docker group, so as not to write sudo every time when executing commands

sudo usermod -aG docker administrator

Create a folder for the project

mkdir ~/docker && cd ~/docker 

Let’s create a Dockerfile with the following content

nano Dockerfile
FROM redmine:4.1
RUN apt-get update

We will need the Dockerfile to create a custom Redmine image. For example, if a plugin needs to install dependencies, we just add commands to install dependencies in the Dockerfile after the RUN instruction. Create a docker-compose.yml file with the following content:

nano docker-compose.yml
version: '3.3'
services:
   postgres:
     image: postgres:10
     volumes:
       - ./storage/postgresql-data:/var/lib/postgresql/data
     environment:
       POSTGRES_PASSWORD: "strong_pass"
       POSTGRES_DB: "redmine"
       PGDATA: "/var/lib/postgresql/data"
     restart: always
   redmine:
     build:
       context: .
     image: redmine:custom
     ports:
       - 80:3000
     volumes:
       - ./storage/docker_redmine-plugins:/usr/src/redmine/plugins
       - ./storage/docker_redmine-themes:/usr/src/redmine/public/themes
       - ./storage/docker_redmine-data:/usr/src/redmine/files
     environment:
       REDMINE_DB_POSTGRES: "postgres"
       REDMINE_DB_USERNAME: "postgres"
       REDMINE_DB_PASSWORD: "strong_pass"
       REDMINE_DB_DATABASE: "redmine"
       REDMINE_SECRET_KEY_BASE: "…"
     restart: always

As you can see, several forwarding points (or volumes) are created in docker-compose.yml in which the database, theme files, user-uploaded files and plugin files are stored, which can always be found at https://www.redmine.org/plugins/ All these folders are available on the host system at the path given above: ~ / docker / storage / Now, when the container is launched, the following folders will be created along the path ~ / docker / storage /: the database files will be stored in the postgresql-data folder, plugins in the docker_redmine-plugins folder, themes in docker_redmine-themes (if anyone uses them), in docker_redmine-data – files attached to tasks in redmine. Basically everything is ready. You can run docker-compose up and, after waiting for the required images to be downloaded, you will see lines saying that everything went well.

Run

docker-compose up

After launch, be sure to go to Administration and in the pop-up message click Load data schema, otherwise many functions may not work.

Redmine is ready to go. Updating it is easy enough. To update the version of redmine, you just need to run two commands

docker-compose build  
docker-compose restart

That’s all 😉

Similar Posts:

5,302

How useful was this post?

Click on a star to rate it!

Average rating 4.5 / 5. Vote count: 2

No votes so far! Be the first to rate this post.

Scroll to Top