Redmine is a powerful, flexible, and open-source project management and issue-tracking tool that is perfect for self-hosting. It offers extensive customization, giving users full control over their data, while providing key features like Gantt charts, time tracking, and a robust plugin ecosystem. This guide will walk you through installing, configuring, securing, and managing Redmine, whether youβre deploying it via Docker or manually on a Linux server.
Installing Redmine
π¦ Docker/Docker Compose Setup
To deploy Redmine using Docker, create a docker-compose.yml
file to define the applicationβs services, volumes, and ports. Hereβs a sample setup:
version: '3.9'
services:
redmine:
image: redmine:latest
container_name: redmine
environment:
REDMINE_DB_MYSQL: redmine_db
REDMINE_DB_PASSWORD: secretpassword
REDMINE_DB_USERNAME: redmine_user
ports:
- "3000:3000"
volumes:
- redmine_data:/usr/src/redmine/files
depends_on:
- mysql
mysql:
image: mysql:5.7
container_name: redmine_db
environment:
MYSQL_ROOT_PASSWORD: rootpassword
MYSQL_DATABASE: redmine_db
MYSQL_USER: redmine_user
MYSQL_PASSWORD: secretpassword
volumes:
- mysql_data:/var/lib/mysql
volumes:
redmine_data:
mysql_data:
Deploy the application using the following commands:
docker-compose up -d
The app will be accessible at http://<your-server-ip>:3000
.
π Manual Installation
For a direct installation on a Linux server, follow these steps:
- Install required dependencies:
sudo apt update
sudo apt install -y ruby ruby-dev build-essential libmysqlclient-dev mysql-client git
- Clone the Redmine repository:
git clone https://github.com/redmine/redmine.git /opt/redmine
cd /opt/redmine
- Install Ruby gems:
sudo gem install bundler
bundle install --without development test
- Set up the database configuration in
/opt/redmine/config/database.yml
:
production:
adapter: mysql2
database: redmine_db
host: localhost
username: redmine_user
password: secretpassword
- Run database migrations and start the server:
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rails server
Access Redmine at http://<your-server-ip>:3000
.
Configuring Nginx as a Reverse Proxy
π Nginx Configuration
To serve Redmine through Nginx, create the following server block in /etc/nginx/sites-available/redmine
:
server {
server_name your-domain.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
listen 80;
}
Enable the configuration and restart Nginx:
sudo ln -s /etc/nginx/sites-available/redmine /etc/nginx/sites-enabled/
sudo systemctl restart nginx
π SSL/TLS Setup
Secure your Redmine instance using Letβs Encrypt:
sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d your-domain.com
Automate certificate renewal:
sudo crontab -e
0 3 * * * certbot renew --quiet
π οΈ Testing and Reloading Nginx
Verify the configuration and restart Nginx:
sudo nginx -t
sudo systemctl reload nginx
Logging and Debugging Redmine
ποΈ Enabling Debug Logs
To enable debug-level logging, modify config/additional_environment.rb
:
config.log_level = :debug
Restart the application to apply changes.
π Viewing Logs
For Docker-based installations, view logs using:
docker logs redmine
For manual installations, check the log file in /opt/redmine/log/production.log
:
tail -f /opt/redmine/log/production.log
π οΈ Troubleshooting Common Issues
If Redmine fails to start, review logs for database connection errors or missing dependencies. For example, ensure the database is properly configured and running.
π€ Exporting Logs
To send logs to an external system like ELK Stack, use a tool like Filebeat:
sudo apt install filebeat
sudo filebeat setup
sudo systemctl start filebeat
Backup and Restore
ποΈ File-Based Backups
Create a backup of Redmineβs files directory:
tar -czvf redmine_files_backup.tar.gz /usr/src/redmine/files
π Database Backups
Export the database:
mysqldump -u redmine_user -p redmine_db > redmine_db_backup.sql
Restore the database:
mysql -u redmine_user -p redmine_db < redmine_db_backup.sql
π Automated Backup Scripts
Set up a cron job for automated backups:
crontab -e
## Add the line:
0 2 * * * tar -czvf /backup/redmine_$(date +\%F).tar.gz /usr/src/redmine/files && mysqldump -u redmine_user -p'redmine_db' > /backup/redmine_db_$(date +\%F).sql
Updating and Upgrading Redmine
β¬οΈ Updating Docker Images
Pull the latest Redmine image and recreate containers:
docker-compose pull
docker-compose up -d
π οΈ Manual Updates
For manual installations, update the source code and dependencies:
cd /opt/redmine
git pull
bundle install --without development test
RAILS_ENV=production bundle exec rake db:migrate
π Checking for Updates
Visit the Redmine Changelog to monitor new releases.
Leveraging Redmineβs Unique Features
π§ Enabling APIs
Activate the Redmine REST API in config/configuration.yml
:
rest_api_enabled: true
Example API usage with curl
:
curl -H "X-Redmine-API-Key: your_api_key" -X GET http://your-domain.com/issues.json
π Advanced Configurations
Enable plugins by adding them to the plugins
directory and migrating:
cd /opt/redmine/plugins
git clone https://github.com/example-plugin.git
RAILS_ENV=production bundle exec rake redmine:plugins:migrate
Restart the server to apply the changes.
Wrapping Up
With Redmine installed, configured, and secured, you now have a powerful project management tool tailored to your needs. From seamless backups to advanced API utilization, this guide equips you with the foundation to maximize Redmineβs potential. Start implementing these steps today and unlock the full power of self-hosted project management!