Create assets in the docker host machine's local storage, so they will be preserved when the docker container is stopped
$ mkdir ~/downloads
$ mkdir ~/redmine-docker
$ cd ~/redmine-docker
$ mkdir assets
$ cd assets
$ mkdir plugins-new
$ mkdir plugins
$ mkdir themes
# This command is to prepare to provide email server and database config:
$ mkdir config
# For upgrading in the same OS:
# Copy previous redmine instance's files for the new instance:
$ sudo cp -r ~/www/redmine/files .
$ sudo cp -r ~/www/redmine/plugins/* ./plugins/
# This command is for Production Server only:
$ sudo cp -r ~/www/redmine/config/configuration.yml ./config/
# OR for Fresh OS, copy-in the backup files and extract them:
# Use scp in reverse direction from the backup computer to the
# downloads folder, and then extract the tar files as shown here:
$ tar -xzf ~/downloads/redmine-files.gz ./
$ tar -xzf ~/downloads/redmine-plugins.gz ./
$ tar -xzf ~/downloads/redmine-themes.gz ./
# Remove the obsolete plugins we got from the backup file, for example:
$ sudo rm -rf plugins/clipboard_image_paste
$ sudo rm -rf plugins/redmine_agile
$ sudo rm -rf plugins/redmine_custom_css
$ sudo rm -rf plugins/redmine_emojibutton
$ sudo rm -rf plugins/redmine_lightbox2
# Download or copy the new plugins
$ cd plugins-new
$ git clone https://github.com/red-soft-ru/time_logger.git time_logger
$ git clone https://github.com/onozaty/redmine-view-customize.git view_customize
$ git clone https://github.com/AlphaNodes/redmine_messenger.git redmine_messenger
$ wget -O checklists.zip
<your checklists plugin download link>
$ unzip checklists.zip
$ rm checklists.zip
$ wget -O redminex-lightbox2-1-0-0.zip <your lightbox2 plugin download link>
$ unzip redminex-lightbox2-1-0-0.zip
$ rm redminex-lightbox2-1-0-0.zip
# Install Coffee theme
$ cd ../themes
$ wget -O coffee.zip <your theme download link>
$ unzip coffee.zip
$ rm coffee.zip
$ cd ..
# Change ownership of the asset folders to the administrator
$ sudo chown -R administrator:docker plugins
$ sudo chown -R administrator:docker plugins-new
$ sudo chown -R administrator:docker files
$ sudo chown -R administrator:docker themes
$ sudo chown -R administrator:docker config
$ sudo chmod -R 777 plugins
$ sudo chmod -R 777 plugins-new
$ sudo chmod -R 777 files
$ sudo chmod -R 777 themes
$ sudo chmod -R 777 config
# move to the redmine docker project folder
$ cd ~/redmine-docker
Setup email server
For Production Server only:
- Create the file
assets/config/configuration.yml
$ nano assets/config/configuration.yml
- Make sure these items in the file are as shown below:
# = Redmine configuration file
#
# Each environment has it's own configuration options. If you are only
# running in production, only the production block needs to be configured.
# Environment specific configuration options override the default ones.
#
# Note that this file needs to be a valid YAML file.
# DO NOT USE TABS! Use 2 spaces instead of tabs for identation.
# default configuration options for all environments
default:
# database command timeout
checkout_timeout: 30
# Outgoing emails configuration
# See the examples below and the Rails guide for more configuration options:
# http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration
email_delivery:
# ==== Simple SMTP server at localhost
#
# email_delivery:
# delivery_method: :smtp
# smtp_settings:
# address: "localhost"
# port: 25
#
# ==== SMTP server at example.com using LOGIN authentication and checking HELO for foo.com
#
# email_delivery:
delivery_method: :smtp
smtp_settings:
address: <you mail server, e.g: mail.abc.com>
port: <you smtp port>
authentication: :login
user_name: <your email client login>
password: <you email client password>
Press CTRL+S
and CTRL+X
to save and exit
Create SQL Server Database Config File
This section shows how to configure the SQL server as the database for Redmine, and set the timeout. Setting the timeout prevents errors when running queries. If you use a different database server, then change the values as needed by your database, or skip this section and use the configuration the docker compose file (shown below), as described in the Redmine installation documents, for your database.
- Create the file
assets/config/database.yml
with the contents shown below :
$ nano assets/config/database.yml
database.yml
File Contents:
production:
adapter: "sqlserver"
host: "<SQL server host name or IP>"
port: "1433"
username: "<SQL server user for redmine database>"
password: "<SQL server password for redmine database user>"
database: "<Redmine database name>"
encoding: "utf8"
timeout: 30000
The last line with the timeout helps avoid SQL timeout errors when running queries in Redmine.
Press CTRL+S
and CTRL+X
to save and exit
Create Docker Compose File
In the folder ~/redmine-docker
, create a file compose.yaml
with the contents shown below:
# Create and edit the compose.yaml file
$ nano compose.yaml
compose.yaml
File Contents:
version: '3.1'
# Build and run redmine docker image
#
# To run the image: sudo docker compose up
# Append -d to run detached (in the background)
# to run with upgrading of plugins, add -e REDMINE_PLUGINS_MIGRATE=1:
#
# $ sudo docker compose run -e REDMINE_PLUGINS_MIGRATE=1
services:
redmine:
image: redmine:5.0.5
container_name: redmine
restart: always
ports:
- 80:3000
#environment:
# these have been moved to assets/config/database.yml so we can specify the timeout
# REDMINE_DB_SQLSERVER: <SQL server host name or IP>
# REDMINE_DB_PASSWORD: <SQL server password for redmine database user>
# REDMINE_DB_USERNAME: <SQL server user for redmine database>
# REDMINE_DB_DATABASE: <Redmine database name>
# REDMINE_DB_ENCODING: utf8
volumes:
- /home/administrator/redmine-docker/assets/plugins:/usr/src/redmine/plugins
- /home/administrator/redmine-docker/assets/themes:/usr/src/redmine/public/themes-new
- /home/administrator/redmine-docker/assets/files:/usr/src/redmine/files
- /home/administrator/redmine-docker/assets/config/configuration.yml:/usr/src/redmine/config/configuration.yml
- /home/administrator/redmine-docker/assets/config/database.yml:/usr/src/redmine/config/database.yml
Press CTRL+S
and CTRL+X
to save and exit
The above docker cmpose file will setup the Redmine docker instance with port 80 on the host server mapped to the internal port 3000 for Redmine in the docker container. That means you will be able to access Redmine by going to your server's http address.
Launch Redmine Docker Image
$ docker compose build
# Launch docker container in interactiver terminal mode
$ docker compose up
# (To stop the running container in interactive mode, press @CTRL+C@)
# OR launch docker container in the background
$ docker compose up -d
For your reference, you can stop and remove the image as follows:
$ docker compose down
Install and Update Plugins and Themes
After the docker image is running and the website is up, copy or fetch the plugin into the host machine's plugins folder.
Then, login to the docker container's bash CLI and install the plugins using the gem bundler:
# Copy new plugins into the mapped plugin folder and remove the source folder
$ mv -r /home/administrator/redmine-docker/assets/plugins-new/* /home/administrator/redmine-docker/assets/plugins/
$ rm -rf /home/administrator/redmine-docker/assets/plugins-new
# Find the docker container name
$ sudo docker ps
# The container name is: redmine
# Login to the container's bash CLI:
$ sudo docker exec -ti redmine gosu redmine bash
# Copy the default themes from the new Redmine instance into the new themes folder
redmine-1234$ cp -r /usr/src/redmine/public/themes/*.* /usr/src/redmine/public/themes-new/
# Setup bundle to not install for development and test setup
redmine-1234$ bundle config set --local without 'development test'
# install any new gem bundles
redmine-1234$ bundle install
# Upgrade all the plugins
redmine-1234$ bundle exec rake redmine:plugins:migrate RAILS_ENV=production
redmine-1234$ exit
$
Now that we have copied the new Redmine's default themes into the new themes folder, it now contains the default themes that came with Redmine, as well as our latest downloaded themes. So, let's switch the new themese folder to be the actual themes folder. Edit the compose file and under the volumes
section, change to themes-new
to themes
:
$ nano compose.yaml
compose.yaml
Content under volumes:
- /home/administrator/redmine-docker/assets/themes:/usr/src/redmine/public/themes
Press CTRL+S
and CTRL+X
to save and exit
Re-start Redmine:
# Re-start Redmine:
$ docker compose down
$ docker compose up -d
You should now be able to login to Redmine using your old Redmine login instance by going to your host machine's IP or DNS name as http://<server IP or domain name>
Configure plugins, etc
- For users to use the API access key, Enable REST web service must be turned on in the "API" tab of the setting page.
- You can use the
view-customize
plugin to inject css and js into Redmine:- go to Administration/View customize
- Click on the + sign for New View Customize
- define pattern as:
/issues
- Insertion position:
Head of all pages
- Type:
CSS
- Code: Enter your customized css code
- Enabled:
Checked
- Click
Create
on the bottom-left
- Click on the + sign for New View Customize
- define pattern as:
/issues
- Insertion position: Head of all pages
- Type:
Javascript
- Code: Enter your customized js code
- Enabled:
Checked
- Click
Create
on the bottom-left
LDAP Configuration
We use Exchange server for user authentication, and this section shows how to setup LDAP Authentication in Redmine for user authenitcation via the exchange server.
- Click
Administration
- Click
LDAP Authentication
- Click
New Authentication Mode
near the top-right - Enter these values:
Field | Value |
---|
Name | Active Directory |
Host | <your LDAP server name e..g ldap.abc.com> |
Port, protocol | 389, LDAP |
Account | <LDAP domain e.g. abc>\$login |
Password | [leave empty] |
Base DN | DC=<LDAP domain e.g abc>,DC=com |
LDAP filter | [leave empty] |
Timeout | [leave empty] or try : (sAMAccountType=805306368) |
On-the-fly user creation | [checked] |
ATTRIBUTES | |
Login attribute | sAMAccountName |
Firstname Attribute | givenName |
Lastname Attribute | sN |
email Attribute | mail |
Test LDAP:
You can test to make sure LDAP is working on the host machine as follows:
# install LDAP utilities
$ sudo apt install ldap-utils -y
# test LDAP connection
$ ldapsearch -H ldap://<LDAP server domain name> -D "<username@domain.com>" -W -b "dc=<LDAP domain e.g. abc>,dc=com" "(sAMAccountType=805306368)" | grep "# "