Deployment Overview of Redmine on Server¶
Prerequisites and Basic Requirements¶
The deployment of Redmine on the server requires the following environment conditions:
- Operating System: Linux distribution compatible with Docker Engine.
- Privileges: Root access or
sudoprivileges are required to manage Docker services and configure system-level network settings. - Domain Configuration: A valid domain name configured with DNS records pointing to the server's IP address. The domain follows the pattern
{{ prefix }}{{ server_id }}.{{ zone }}. - Network Ports:
- Port
80(HTTP) for initial SSL certificate validation. - Port
443(HTTPS) for secure application access. - Port
3000is used internally by the Redmine container but is not exposed directly to the public network.
File and Directory Structure¶
The application utilizes specific directories for configuration, data storage, and certificate management:
/opt/redmine: The primary directory containing the Docker Compose configuration file (docker-compose.yml)./data/nginx/user_conf.d: The directory storing the custom Nginx server configuration files, named according to the pattern{{ prefix }}{{ server_id }}.{{ zone }}.conf./data/nginx/nginx-certbot.env: The environment file containing variables required by the Nginx-Certbot container./etc/letsencrypt: The mount point for SSL certificates and keys managed by Certbot, accessed via thenginx_secretsvolume.
Docker Containers and Their Deployment¶
The application is deployed using Docker Compose, orchestrating three primary services: a database, the Redmine application, and a reverse proxy with SSL termination.
The deployment is initiated by executing the following command within the /opt/redmine directory:
The docker-compose.yml file defines the following services:
- Database Service (
db): - Image:
mysql:8.0 - Container Name:
redmine-mysql - Restart Policy:
always - Environment Variables:
MYSQL_ROOT_PASSWORD: Set via the{{ REDMINE_MYSQL_PASSWORD }}variable.MYSQL_DATABASE: Set toredmine.
-
Health Check: Verifies connectivity using
mysqladmin ping. -
Redmine Service (
redmine): - Image:
redmine - Container Name:
redmine - Restart Policy:
always - Environment Variables:
REDMINE_DB_MYSQL: Set todb(the service name of the database).REDMINE_DB_PASSWORD: Set via the{{ REDMINE_MYSQL_PASSWORD }}variable.REDMINE_SECRET_KEY_BASE: Set via the{{ REDMINE_SECRET_KEY }}variable.
- Dependencies: Starts only after the
dbservice is healthy. -
Health Check: Verifies the application is responding on
http://localhost:3000. -
Nginx Service (
nginx): - Image:
jonasal/nginx-certbot:latest - Container Name:
redmine-nginx - Restart Policy:
unless-stopped - Ports: Exposes
80and443to the host. - Environment Variables:
CERTBOT_EMAIL: Set to[email protected].
- Volumes:
nginx_secretsmounted to/etc/letsencrypt.- Host directory
/data/nginx/user_conf.dmounted to/etc/nginx/user_conf.d.
- Dependencies: Starts only after the
redmineservice is healthy.
Proxy Servers¶
The Nginx container acts as a reverse proxy and handles SSL certificate management via Certbot.
- SSL Configuration: The server loads SSL certificates from
/etc/letsencrypt/live/{{ prefix }}{{ server_id }}.{{ zone }}/. - Certificate File:
fullchain.pem - Private Key File:
privkey.pem - Chain File:
chain.pem - Diffie-Hellman Parameters: Loaded from
/etc/letsencrypt/dhparams/dhparam.pem. - Server Name: Configured to respond to
{{ prefix }}{{ server_id }}.{{ zone }}. - Proxy Settings:
- The Nginx configuration forwards requests from the location
{{ external_path }}to the Redmine container athttp://redmine:3000. - Headers
X-Forwarded-Host,X-Forwarded-Server,X-Real-IP, andX-Forwarded-Forare set to preserve client information. - WebSocket support is enabled with
proxy_http_version 1.1and appropriate upgrade headers. - Proxy buffering is disabled (
proxy_buffering off).
Databases¶
The application uses a MySQL database for data storage.
- Connection Method: The Redmine container connects to the database service named
dbusing the internal Docker network. - Database Name:
redmine. - Authentication: The root password is provided via the
MYSQL_ROOT_PASSWORDenvironment variable. - Storage: Database data is stored within the Docker container's writable layer or associated volumes managed by Docker, as no external volume is explicitly defined for the database in the provided configuration.
Starting, Stopping, and Updating¶
Service management is handled through Docker Compose commands executed in the /opt/redmine directory.
- Start Services:
- Stop Services:
- Update Services: To apply changes to the configuration or pull new images, stop the services, pull the latest images, and restart:
Permission Settings¶
The configuration files and directories are set with specific ownership and permissions to ensure security and proper access:
/opt/redmine: Owned byroot:rootwith mode0644./opt/redmine/docker-compose.yml: Owned byroot:rootwith mode0644./data/nginx/user_conf.d/{{ prefix }}{{ server_id }}.{{ zone }}.conf: Owned byroot:rootwith mode0644./data/nginx/nginx-certbot.env: Accessible by the Nginx container via volume mount.