Requirements about MariaDB

Create a MariaDB database and user for Redmine,

pwgen (copy/paste password)
docker exec -ti mariadbprod mysql -p
GRANT ALL PRIVILEGES ON redminedb.* TO 'redmineuser';
  • Note. change USERPASS accordingly
  • Note. allowing mysql user redmineuser to connect remotely in case mysqld is listening on the network (@localhost not forced)

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
COPY upload/ /root/upload/
RUN /root/upload/install.bash
CMD /root/upload/

wget .../install.bash
wget .../

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,

docker run -d --name $app -h $app \
    -p 3000:3000 \
    --link mariadbprod:mariadb \
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,

redmine: root

then setup the outgoing mail,

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

vi configuration.yml
    delivery_method: :sendmail


    delivery_method: :smtp
      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: ''}

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
  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/
#export RAILS_ENV=production
rails server -b

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,


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,
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

  • send a dump of the db (-B) to the new server
  • inject the db into mariadb
  • create a user to access this db

(optional) Enable Digest Plugin

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