RPI Computers

Project Management Web Platform with Redmine on Raspberry PI and Docker

Project managing involves strong communication requirements. Keeping all teams aligned on tasks progress and issues solutions requires strong tools to share info between involved owners and a strict timeline sharing.

In this guide, I’ll show you how to install Redmine in your Raspberry PI (a very cheap single-board computer) with Docker.

For this guide, I will use a Raspberry PI 3 model A+, but this also works with newer Raspberry PI boards.

What is Redmine

Redmine is an open source project management platform, based on web application service. Written using the Ruby on Rails framework, it is cross-platform and cross-database. It allows to manage multiple projects and associated subprojects, with related objects like tasks, issues, files management and GANTT charts.

What We Need

As usual, I suggest adding from now to your favourite e-commerce shopping cart all the needed hardware, so that at the end you will be able to evaluate overall costs and decide if to continue with the project or remove them from the shopping cart. So, hardware will be only:

Step-by-Step Procedure

We’ll start by installing the Raspberry PI operating system, and then setting up docker and docker-compose. After that, we’ll prepare docker-compose configuration files to create our Redmine platform with only 1 command line.

Redmine requires a database and works well with MySQL. I use MariaDB instead of MySQL because it is fully compatible and requires fewer resources (which is a good idea working with low-capacity hardware like Raspberry PI). MariaDB for ARM has only a docker hub image compatible with ARM 64. I’ll use instead a custom MariaDB docker installation, to be compatible with all Raspberry PI boards able to run docker.

Prepare Raspberry PI Environment

Start installing Raspberry Pi OS Lite, to have a headless and lite environment. If you start from an existing Raspberry PI OS installation, please remember to update from the terminal:

sudo apt update
sudo apt upgrade

Then install Docker and docker-compose in your Raspberry PI. Portainer can be installed to visually control your docker environment, but it is not strictly required.

Prepare Docker-Compose Configuration Files

Create a redmine folder in your Raspberry PI. I’m going to name it “redmine”, but you can use whatever name you want. Then enter your folder. From terminal:

mkdir redmine
cd redmine

We’ll create 3 main files:

docker-compose.yml
Dockerfile
mySqlScript.sql

docker-compose.yml is your main docker-compose configuration file. It includes the service configuration we’ll create. Dockerfile will drive mariaDB image building. mySqlScript.sql will be used to initialize MariaDB creating the Redmine database, user and permission.

The next paragraphs will show file content.

Docker-compose yaml file

Create a docker-compose file:

nano docker-compose.yml

and add the following code. Use your favourite credentials for “redmine” and “redmine_password” and remember them for mySqlScript.sql

# My Redmine
# from peppe8o.com
version: '3'
services:
 redmine:
  image: redmine:latest
  restart: unless-stopped
  ports:
   - 8080:3000
  environment:
   REDMINE_DB_MYSQL: db
   REDMINE_DB_USERNAME: redmine
   REDMINE_DB_PASSWORD: redmine_password
   REDMINE_SECRET_KEY_BASE: supersecretkey
 db:
  build: .
  restart: unless-stopped

Of course, you can customize this script by changing the exposing port, mapping volumes for persistent data, and so on.

As you can see, our database will be built on custom installation (please refer to create custom MariaDB container on Raspberry PI for more info).

Dockerfile

Create a Dockerfile:

nano Dockerfile

And use the following content inside it:

FROM debian
RUN apt update && apt install mariadb-server -y
RUN sed -i 's/bind-address/bind-address = 0.0.0.0 #/i' /etc/mysql/mariadb.conf.d/50-server.cnf
RUN mkdir /mysql_scripts
COPY mySqlScript.sql /mysql_scripts/
RUN /etc/init.d/mariadb start && mariadb -uroot --password="" -e "source /mysql_scripts/mySqlScript.sql"
CMD /etc/init.d/mariadb start && tail -f /dev/null

For security purposes please remember, once all procedures are completed, to enforce your MariaDB root password.

MySQL Initialization Script

Finally, create your database initialization script:

nano mySqlScript.sql

Use the following code, changing “redmine” and “redmine_password” with your preferred credentials:

CREATE DATABASE redmine CHARACTER SET utf8mb4;
CREATE USER 'redmine'@'%' IDENTIFIED BY 'redmine_password';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'%';
FLUSH PRIVILEGES;
quit

Service Creation and Initialization

With previous files ready to be used, you will be able to install and have Redmine up only with following command:

docker-compose up -d

This process will require a while to:

  • download and extract required images from Docker Hub (Redmine and Debian, the latest being used for our custom MariaDB container)
  • install and configure MariaDB
  • run mySqlScript.sql initialization script

Once container preparation has been completed, from the terminal you will see something like the following:

...
Creating redmine_redmine_1 … done
Creating redmine_db_1 … done
pi@raspberrypi:~/redmine $

At this point, Docker has done its job. But a few operations are still going on inside the Redmine container. The Docker ps command will confirm that containers are up and running (containers will inherit first part of their name from the folder name):

pi@raspberrypi:~/redmine $ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
265be67bf2d8 redmine:latest "/docker-entrypoint.…" 2 minutes ago Up 2 minutes 0.0.0.0:8080->3000/tcp redmine_redmine_1
26a443a3a1d2 redmine_db "/bin/sh -c '/etc/in…" 2 minutes ago Up 2 minutes redmine_db_1

We can check that redmine_redmine_1 container is still working to setup. With command:

docker logs redmine_redmine_1

you will see internal redmine operations progressing and our service will be ready once this command shows you the following final line:

INFO WEBrick::HTTPServer#start: pid=1 port=3000

From your favorite browser, check the URL “http://<<yourRaspberryIpAddress>>:8080” (in my screenshot, my Raspberry PI IP address is 192.168.1.177):

If this is your output, it means that everything went well.

Use the “Sign in” link on top/right:

Use the following default Redmine credentials:

  • login: admin
  • Password: admin

and click login. You will be asked to change immediately admin password. Insert the old “admin” in “Password” field. Use a new password for other 2 fields:

Then click the “Apply” button. You will be logged in:

From here you can refer to Redmine Users Guide and your Redmine platform is ready.

Enjoy!

peppe8o

Open source and Raspberry PI lover

View Comments

  • How can I solve this?
    sudo docker-compose up -d
    ERROR: The Compose file './docker-compose.yml' is invalid because:
    Unsupported config option for services.redmine: 'REDMINE_DB_MYSQL'
    services.redmine.environment contains an invalid type, it should be an object, or an array

    # My Redmine
    # from peppe8o.com
    version: '3'
    services:
    redmine:
    image: redmine:latest
    restart: unless-stopped
    ports:
    - 8080:3000
    environment:
    REDMINE_DB_MYSQL: mymariadb_database
    REDMINE_DB_USERNAME: redmine
    REDMINE_DB_PASSWORD: mypassword
    REDMINE_SECRET_KEY_BASE: supersecretkey
    db:
    build: .
    restart: unless-stopped

    • Hi Chris,
      take care of the "-" sign near the port declaration ("- 8080:3000"). In your docker-compose extract it appears to me to be a different (even if the may appear similar). The best way is pasting the docker compose file into a notepad app and then again copy-> paste to yuoy file into Raspberry PI.
      Also, please tale care of respecting the indentation as shown in my post.
      Please let me know if this helps to fix

  • Me da este error:

    /bin/sh: 1: /etc/init.d/mysql: not found
    The command '/bin/sh -c /etc/init.d/mysql start && mysql -uroot --password="" -e "source /mysql_scripts/mySqlScript.sql"' returned a non-zero code: 127
    ERROR: Service 'db' failed to build : Build failed

    • Hi Juan,
      please can you try to change the following line:
      RUN /etc/init.d/mysql start && mysql -uroot --password="" -e "source /mysql_scripts/mySqlScript.sql"

      with this:
      RUN /etc/init.d/mariadb start && mariadb -uroot --password="" -e "source /mysql_scripts/mySqlScript.sql"

  • Hi! Thank you so much for this tutorial.

    A few bugfixes though :
    - Like Chris, if you get the following error : **"Unsupported config option for services.redmine: ‘REDMINE_DB_MYSQL’"**, just make sure the 'REDMINE' environment entries are correctly indented below the 'environment:' tag. I had to add two spaces for those 'REDMINE' environment entries ;
    - Like Juan, if you get the following error :
    **"The command ‘/bin/sh -c /etc/init.d/mysql start && mysql -uroot –password=”” -e “source /mysql_scripts/mySqlScript.sql”‘ returned a non-zero code: 127
    ERROR: Service ‘db’ failed to build : Build failed" error, "**
    You must change the last two lines in the 'Dockerfile' file : replace 'mysql' by 'mariadb'
    **RUN /etc/init.d/mariadb start && mariadb -uroot --password="" -e "source /mysql_scripts/mySqlScript.sql"
    CMD /etc/init.d/mariadb start && tail -f /dev/null**
    However, don't replace 'mysqlscript'!

    When everything is good, you have to be patient. Especially when Redmine is starting for the first time, it can take quite a while.

    Cheers!

    • Thank you for your feedback.
      Regarding the change from mysql -> mariadb, this has been a change in the way MariaDB calls its CLI interface from the last updates. In general, after the Raspberry PI published its 64-bit OS, there should be no need to build a custom MariaDB container in our docker-compose file, as MariaDB has its own arm64 docker image. But there could be people that still use the old 32-bit OS, especially those with old Raspberry PI models... I have to decide for a (near) future update of this post if I will move directly to the 64 bit or to split this tutorial into 2 parts (32-bit and 64-bit).
      In the meanwhile, I'm going to fix the mariadb cli call.

Published by
peppe8o

Recent Posts

Some links in this post may be affiliate links. We may get paid if you buy something or take an action after clicking one of these, but without addictional costs for you compared to direct buying.

SPI communication between two Arduinos

In this tutorial, we will use two Arduino Uno to demonstrate the Serial Peripheral Interface…

1 week ago

Automatic irrigation system with Arduino and Sensors

In this tutorial, we will be making an automatic irrigation system (AIS) with Arduino and…

3 weeks ago

Beginner’s Guide to Use Python Virtual Environment with Raspberry PI (venv)

This tutorial will show you how to use Python Virtual Environment with Raspberry PI computer…

3 weeks ago

Get Betting Odds with Raspberry PI and Odds-API (free)

This tutorial will show you how to get betting odds with Raspberry PI by using…

1 month ago

Backup Raspberry PI (computer) Data with Rsync to Remote NAS

This tutorial will show you how to perform the backup of Raspberry PI (computer board)…

1 month ago

Honeygain and Raspberry PI: Earn by Sharing Internet Connection

This tutorial will show you how to install Honeygain on a Raspberry PI computer board…

1 month ago