Nov 21, 2022

Redmine on Docker

This is a quick tutorial on setting up a Redmine on Docker container.

 

Overview

Redmine is a flexible project management web application written using Ruby on Rails framework.


Architecture

This is to simulate how to dockerize a production-ready infrastructure on Redmine application using Nginx as reverse proxy.


Prerequisite

I'm using the Multipass to setup my docker platform.

PS> multipass launch docker -n dido

PS> multipass shell dido


Setup

First, create 3 files within an empty folder.

  1. Dockerfile
  2. conf/default.conf
  3. conf/supervisord.conf

~$ mkdir red

~$ cd red

~/red$ cat Dockerfile 

------------------8<-------------------------

FROM redmine:5

RUN apt update && \
    apt install -y \
    supervisor \
    nginx && \
    apt clean && \
    rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY conf/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
COPY conf/default.conf /etc/nginx/sites-available/default

EXPOSE 80

ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]

------------------8<------------------------- 

~/red$ cat conf/default.conf

------------------8<------------------------- 

server {
    listen       80;
    server_name  _;

    location / {
        proxy_pass http://127.0.0.1:3000;
    }
}

------------------8<------------------------- 

~/red$ cat conf/supervisord.conf

------------------8<------------------------- 

[supervisord]
nodaemon=true
user=root

[program:nginx]
user=root
command=nginx

[program:redmine]
user=redmine
directory=/usr/src/redmine
command=/docker-entrypoint.sh rails server -b 127.0.0.1

------------------8<-------------------------

 

Build the Docker Image

Next, build the docker image called "redapp".

~/red$ docker build -t redapp . 

Sending build context to Docker daemon  4.608kB
Step 1/6 : FROM redmine:5
 ---> 7cc28c5d1864
Step 2/6 : RUN apt update &&     apt install -y     supervisor     nginx &&     apt clean &&     rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
 ---> Using cache
 ---> 03ee1eb12c0a
Step 3/6 : COPY conf/supervisord.conf /etc/supervisor/conf.d/supervisord.conf
 ---> Using cache
 ---> bfaee539e7d4
Step 4/6 : COPY conf/default.conf /etc/nginx/sites-available/default
 ---> Using cache
 ---> 8f20ffe3be6a
Step 5/6 : EXPOSE 80
 ---> Using cache
 ---> de69fec60e49
Step 6/6 : ENTRYPOINT ["/usr/bin/supervisord", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
 ---> Using cache
 ---> 3e9b0eecdfaf
Successfully built 3e9b0eecdfaf
Successfully tagged redapp:latest


Start the Docker image as Container

Next, run the container by exposing the port 80 (external on eth0 interface) with Nginx (internal port 80 on docker0 interface)

~/red$ docker run -p 80:80 -d redapp 

4851a3266f50ebd3ee7c3c69e87bc2e4697e74e699839b21f566119c39e5665f


Access the Redmine Application

Last, point the browser to the URL at http://172.18.238.107/login (where 172.18.238.107 is the IP address at my eth0 interface).

http://172.18.238.107/login

Links: