Setting up a Redmine docker container

Requirements about MariaDB

Create a MariaDB database and user for Redmine,

pwgen (copy/paste password)
docker exec -ti mariadbprod mysql -p
CREATE DATABASE redminedb CHARACTER SET utf8;
CREATE USER 'redmineuser' IDENTIFIED BY 'USERPASS';
GRANT ALL PRIVILEGES ON redminedb.* TO 'redmineuser';
^D

Redmine custom image with a fake init

Tweak the official redmine image a similar fashion as custom/ubuntu,

docker pull redmine
mkdir -p ~/images/redmine/
cd ~/images/redmine/

vi Dockerfile
FROM redmine:latest
MAINTAINER user@example.com
COPY upload/ /root/upload/
RUN /root/upload/install.bash
CMD /root/upload/fakeinit.sh

wget .../install.bash
wget .../fakeinit.sh

Build the fakeinit custom/redmine image,

cd ~/images/redmine/
docker build -t custom/redmine .

Run the Redmine custom container

Launch the container based on the fakeinit custom redmine image,

app=redmineprod
docker run -d --name $app -h $app \
    -p 3000:3000 \
    --link mariadbprod:mariadb \
    custom/redmine
docker exec -ti $app bash
cd ~/
ln -s /usr/src/redmine/config
ln -s /usr/src/redmine

Check that you can access the mariadb from within the container,

nc -v -z mariadb 3306
apt -y update
apt -y install mysql-client
mysql -uroot -pPASSWORD_HERE -h mariadb
mysql -uredmineuser -pUSERPASS -h mariadb

Note. add --protocol=TCP if you cannot reach the mariadb container.

Setup Redmine

Allow simple outgoing smtp setup with some specific mail aliases for redmine,

root: user@example.com
redmine: root

then setup the outgoing mail,

cd ~/config/
cp configuration.yml.example configuration.yml

vi configuration.yml
  email_delivery:
    delivery_method: :sendmail

or,

  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: "localhost"
      port: 25
      enable_starttls_auto: false

setup the RAILS_ENV,

cd ~/config/environments/
cp production.rb production.rb.dist

vi production.rb
  # Disable delivery errors
  #config.action_mailer.raise_delivery_errors = false
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.perform_deliveries = true
  config.action_mailer.default_options = {from: 'redmine@example.com'}

Note. redmine was setup in the mail aliases and points to the email defined for root into the container.

Setup the DB credentials,

cd ~/config/
cp database.yml.example database.yml

vi database.yml
production:
  adapter: mysql2
  database: redminedb
  host: mariadb
  username: redmineuser
  password: "USERPASS"
  encoding: utf8

Populate the DB,

cd ~/redmine/
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:load_default_data
RAILS_ENV=production REDMINE_LANG=en bundle exec rake redmine:load_default_data

Generate secrets and token,

cd ~/redmine/
bundle exec rake generate_secret_token

(skipped, using a container and running the app as root) Fix the perms,

#cd ~/redmine/
#mkdir -p tmp/pdf public/plugin_assets
#sudo chown -R redmine:redmine files log tmp public/plugin_assets
#sudo chmod -R 755 files log tmp public/plugin_assets

Ready to go

Start rsyslog & postfix,

service rsyslog restart
service postfix stop
pkill master
service postfix start

Start the rails daemon,

cd /usr/src/redmine/
echo $RAILS_ENV
#export RAILS_ENV=production
rails server -b 0.0.0.0

You can now log into the app with admin/admin. You’ll get to change your password at first login, eventually generate one from the command line with,

pwgen

and copy/paste it.

Now setup the redmine URL and other things,

Administration > Settings > General tab
application title: ...
host name and path: ...
test formatting: markdown

Administration > Settings > Authentication tab
autologin: 7 days
hide my email address: uncheck

Now setup the Email notifications into the bug tracker,

Administration > Settings > Email notifications
From: ...
uncheck bcc
edit the footer with the right url prefix,
save
use the button on the bottom right corner to send a test email

Check the logs,

cd ~/redmine/
tail -f log/production.log

If you need to increase the log level, edit the env,

vi config/production.rb
  config.log_level = :debug

Redmine to RECEIVE emails

Upgrading Redmine

(optional) Enable Digest Plugin

git clone http://...
apt -y install cron

Resources

Installing Redmine http://www.redmine.org/projects/redmine/wiki/redmineinstall

redmine https://hub.docker.com/_/redmine

digest plug-in

Plugins Directory » Digest http://www.redmine.org/plugins/digest

Digest¶ ↑ https://github.com/drewkeller/redmine_digest

Plugins http://www.redmine.org/projects/redmine/wiki/Plugins


HOME | GUIDES | LECTURES | LAB | SMTP HEALTH | HTML5 | CONTACT
Copyright © 2024 Pierre-Philipp Braun