Using docker-compose for redmine
What is docker-compose
Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application’s services. Then, with a single command, you create and start all the services from your configuration. To learn more about all the features of Compose, see the list of features. More details could be found here.
What is Redmine
Redmine is a free and open source, web-based project management and issue tracking tool. It allows users to manage multiple projects and associated subprojects. It features per project wikis and forums, time tracking, and flexible role based access control. It includes a calendar and Gantt charts to aid visual representation of projects and their deadlines. Redmine integrates with various version control systems and includes a repository browser and diff viewer.

Why use docker-compose for Redmine
Redmine has two components, one is database service and another one is Redmine web service. Those two components are tightly tied together, so it would be better to specify them in a single YAML file and use one single command to start the entire Redmine service.
Getting started
Prepare the YAML file named
docker-compose.yaml.
We have two services defined in docker-compose.yaml. One named redmine, another one named redmine-db.
restart: always - Always restart the service if it dies.
volumes - Mount the container directory to host for data persistence.
environment - The required environment variables which are required to start the redmine and database services. Refer to redmine docker hub for more details.
Note that the passing password in as environment variable as plain text is very ugly. Redmine supports REDMINE_DB_PASSWORD_FILE, and need further research on how to pass in secret to postgres. I am just using the plain text for a demo in this article.
Refer to official compose file doc for more details on each properties.
Once you have the
docker-compose.yamlfile ready, you could just rundocker-compose up -dto bring up those services.-dmeans detached mode.
docker-compose psto check the status.
Now you would be able to access the redmine from
localhost:3000. According to the Redmine doc, the default username and password areadmin/admin
Backup and Restoration the Redmine
Backup
Redmine backups should include:
Database
Attachments (stored in the
filesdirectory under the installation directory by default)
For attachments, we have the attachments folder mounted on host, so we could easily backup the attachments under files directory.
For database(PostgreSQL in our example), the following commands need to be executed:
You can find <username>, <hostname>, and <redmine_database> in the file config/database.yml. <hostname> may not be required depending on your installation of the database. The pg_dumpcommand will prompt you to enter the password when necessary.
The reason to use --file=/root/redmine.sqlc is because /root has been mounted on host, so it could easily be persistent if container restarts
Restoration
For attachments, you do not need to do anything specific since those files have been mounted on host. If container restarts, they will be re-mounted into container.
For database, the following commands need to be executed:
More backup and restoration details could be found here
Online help
Last updated