Project Management Web Platform with Redmine on Raspberry PI and Docker
Last Updated on 12th April 2024 by peppe8o
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:
- Raspberry PI Computer Board (including proper power supply or using a smartphone micro USB charger with at least 3A)
- high speed micro SD card (at least 16 GB, at least class 10)
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!
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.
Hello
Thanks a lot for this instruction!
However, after completing the process when I check with ‘docker PS’, the redmine_db_1 process is up and running, but the redmine_redmine_1 process in constantly restarting (every few seconds).
I have executed the installation on a clean 32 bit environment.
(in order to be sure I did not make a mistake, I have executed the process a couple of times).
Do you have an idea what is going wrong?
Thanks! Hugo
Hi Hugo,
please check the logs with the following command:
docker logs redmine_redmine_1
This is the result of the docker logs redmine_redmine_1 command:
permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get “http://%2Fvar%2Frun%2Fdocker.sock/v1.24/containers/redmine_redmine_1/json”: dial unix /var/run/docker.sock: connect: permission denied
I hope you know what the issue is.
Thanks!
Hugo
When you installed Docker, did you also issued the command
sudo usermod -aG docker pi
(or, if your user is different from the default pi,sudo usermod -aG docker $USER
)?After this command you must reload your user profile, better if you reboot your Raspberry PI
I am one step further!
I don’t get this message anymore, but now it gives another error: LoadError: /usr/local/bundle/gems/nokogiri-1.15.6-arm-linux/lib/nokogiri/3.2/nokogiri.so: cannot open shared object file: No such file or directory – /usr/local/bundle/gems/nokogiri-1.15.6-arm-linux/lib/nokogiri/3.2/nokogiri.so (LoadError)
/
Hugo
After fixing the user group, did you tryied to remove the containers:
docker-compose down
and create them again:
docker-compose up -d
Hi,
Unfortunately the docker-compose down and up did not help.
I am still getting the Nokogiri error..
Thanks for all your efforts!
Hugo
Are you using a 64-bit OS? Are you on Raspberry PI OS Lite or Desktop? I’ve just reproduced the installation steps from a fresh Raspberry PI OS Lite (64-bit) OS and it worked to me, but I need to check if we’re working on the same environment
This works like a charm!
So 2 lessons: you have to reboot after the sudo usermod -aG docker pi command and the process seemingly requires the 64 bit OS version.
A huge thanks for your help!!
Hugo
Happy it helped you too!
I have been playing with Redmine a bit, it works very nicely.
A bit off-topic, but I tried to install plugins, but I don’t know how/where to install them. I tried to Google this, but that did not bring a solution.
Do you know how to do this when Redmine is installed in Docker?
Thanks
Hugo
Hello,
I am using a raspberry pi 64 bit desktop OS and your installation process worked for me. Thank you very much.
Now I have a problem, I changed the password in Redmine, but after restarting Redmine I found that the password was not changed.
I use the ‘sudo’ prefix for all my installs, could it be causing the permissions issue?