165 lines
7.3 KiB
Markdown
165 lines
7.3 KiB
Markdown
|
|
[](https://github.com/okainov/mantisbt-docker/actions) [](https://hub.docker.com/r/okainov/mantisbt) [](https://hub.docker.com/r/okainov/mantisbt)
|
|
|
|
# MantisBT bug tracker Docker image
|
|
|
|
Docker image for Mantis Bug Tracker https://www.mantisbt.org/
|
|
|
|
# Why this image?
|
|
|
|
There are some other alternative images exist already such as [vimagick/mantisbt](https://hub.docker.com/r/vimagick/mantisbt/), [xlrl/docker-mantisbt](https://github.com/xlrl/docker-mantisbt) and a few others. Why do we need yet another image?
|
|
|
|
The reason is to combine all the useful features they have and add some missing ones. To list some:
|
|
|
|
- Always latest MantisBT version.
|
|
- Comes with the latest PHP version (8.4 as for today)
|
|
- Allows to easily configure presence of `admin` service folder
|
|
- Comes with built-in integration with Gitlab and Github [source plugins](https://github.com/mantisbt-plugins/source-integration)
|
|
- Example `docker-compose.yml` file provided for getting started in one click!
|
|
- Easy customization of the config files and custom plugins without destroying data from base image
|
|
- Consistent Dockerfile style following all best practices (ensured by Dockerfile lint)
|
|
|
|
|
|
# Quick start
|
|
|
|
- Download `docker-compose.yml` from this repo: `wget https://raw.githubusercontent.com/okainov/mantisbt-docker/master/docker-compose.yaml`
|
|
- Check the environment variables (at least you need to set MASTER_SALT env variable, [doc](
|
|
https://www.mantisbt.org/docs/master/en-US/Admin_Guide/html-desktop/#admin.config.security))
|
|
- `docker-compose up -d`
|
|
- Open browser at `localhost:8989/admin/install.php` and follow installation instructions, default out-of-the-box values are good to use.
|
|
-- Ignore `Config File Exists but Database does not` warning and proceed installation
|
|
- Log in as `administrator`/`root` (default credentials) and confugre whatever you need (typically you want to create your own Admin user and disable built-in "administrator" first)
|
|
- Check MantisBT own's checks at `localhost:8989/admin/`. Note: several warnings are expected to be "WARN" due to issues in MantisBT, such as magic quotes warning ([#26964](https://www.mantisbt.org/bugs/view.php?id=26964)) and "folder outside of web root" warnings ([#21584](https://mantisbt.org/bugs/view.php?id=21584)))
|
|
- When ready to move to production, either remove `MANTIS_ENABLE_ADMIN` env variable or set it to 0 - this will remove "admin" folder from the installation.
|
|
|
|
For further details refer to [official documentation](https://www.mantisbt.org/docs/master/en-US/Admin_Guide/html-desktop/#admin.install.new)
|
|
|
|
## Example docker-compose.yml
|
|
|
|
```YAML
|
|
version: "3"
|
|
|
|
services:
|
|
web:
|
|
# Pin the version for production usage!
|
|
image: okainov/mantisbt:latest
|
|
container_name: mantis_web
|
|
ports:
|
|
- "8989:80"
|
|
environment:
|
|
- MANTIS_ENABLE_ADMIN=1
|
|
# Set master salt, typically can be generated by `cat /dev/urandom | head -c 64 | base64`
|
|
#- MASTER_SALT=
|
|
# Set base email settings. For more detailed configuration (i.e. SMTP) you'll need to add own config file
|
|
- EMAIL_WEBMASTER=webmaster@localhost
|
|
- EMAIL_FROM=webmaster@localhost
|
|
- EMAIL_RETURN_PATH=webmaster@localhost
|
|
# SMTP Settings, below are default values
|
|
#- SMTP_HOST=smtp.yourmail.com
|
|
#- SMTP_USER=username
|
|
#- SMTP_PASSWORD=superstrongpassword
|
|
#- SMTP_PORT=587
|
|
#- SMTP_MODE=tls # Maps to $g_smtp_connection_mode, defaults to tls, can be ssl or empty
|
|
# Uncomment only if modified from default values
|
|
#- MYSQL_HOST=db
|
|
#- MYSQL_DATABASE=bugtracker
|
|
#- MYSQL_USER=mantis
|
|
#- MYSQL_PASSWORD=mantis
|
|
depends_on:
|
|
- db
|
|
restart: always
|
|
|
|
db:
|
|
image: mysql:8.4
|
|
container_name: mantis_db
|
|
volumes:
|
|
- ./db_data_v8:/var/lib/mysql
|
|
environment:
|
|
- MYSQL_ROOT_PASSWORD=root
|
|
- MYSQL_DATABASE=bugtracker
|
|
- MYSQL_USER=mantis
|
|
- MYSQL_PASSWORD=mantis
|
|
command: ['mysqld', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci']
|
|
|
|
```
|
|
|
|
## Upgrading
|
|
|
|
Normally, you should be able to upgrade freely without any restrictions, just make sure to run the compose with `MANTIS_ENABLE_ADMIN=1` after updating the versions and go to `your-mantis-instance/admin` to perform database upgrades when needed. That's all :)
|
|
|
|
### MySQL 5.7 EOL
|
|
|
|
`docker-compose.yaml` file before May 2025 in this repo was using `mysql:5.7` as database container. This has became EOL in 2023, so it was updated to current LTS version 8.4. Unfortunately [MySQL does NOT support direct upgrade](https://dev.mysql.com/doc/refman/8.4/en/upgrade-paths.html), so the recommended way is to just backup the database, upgrade the version and set new path for `db_data`, then recreate the database from dump.
|
|
|
|
```
|
|
# Backup first anyway
|
|
docker exec mantis_db /usr/bin/mysqldump -u root -proot bugtracker > backup.sql
|
|
docker compose down
|
|
# Change 5.7->8.4 and either update db_data mount path e.g. to db_data_v8 or rename db_data->db_data.old
|
|
docker compose up -d
|
|
|
|
docker cp backup.sql mantis_db:/backup.sql
|
|
docker exec -it mantis_db bash
|
|
# Inside container
|
|
mysql -u root -p bugtracker < /backup.sql
|
|
|
|
# Test the instance, check /admin, if all good - set MANTIS_ENABLE_ADMIN=0 and enjoy
|
|
|
|
```
|
|
|
|
# Extensions
|
|
|
|
## Custom config settings
|
|
|
|
If you need to customize more options in config, create `config_inc_addon.php` file and mount it to `/var/www/html/config/config_inc_addon.php` in container. This fill will be added to default `config_inc.php`. Mounting it will allow you to see the changes instantly without rebuilding/restarting the container.
|
|
|
|
Some of the typical settings you might want to change:
|
|
|
|
```
|
|
$g_window_title = 'Title of your MantisBT instance';
|
|
|
|
// Default is useless 5 minutes
|
|
$g_reauthentication_expiry = 60 * 60;
|
|
|
|
// Increase upload file size from default 5MB
|
|
$g_max_file_size = 5 * 1024 * 1024;
|
|
|
|
// Enable anonymous access
|
|
|
|
$g_allow_anonymous_login = true;
|
|
$g_anonymous_account = 'anonymous';
|
|
|
|
```
|
|
|
|
## Email
|
|
|
|
There are following env variables supported:
|
|
|
|
- `EMAIL_WEBMASTER` - maps to `g_webmaster_email`
|
|
- `EMAIL_FROM` - maps to `g_from_email`
|
|
- `EMAIL_RETURN_PATH` - maps to `g_return_path_email`
|
|
- `EMAIL_FROM_NAME` - maps to `$g_from_name`
|
|
|
|
Also SMTP env variables are supported as well:
|
|
|
|
- `SMTP_HOST=smtp.yourmail.com`
|
|
- `SMTP_USER=username`
|
|
- `SMTP_PASSWORD=superstrongpassword`
|
|
- `SMTP_PORT=587`
|
|
- `SMTP_MODE=tls` - Maps to $g_smtp_connection_mode, defaults to tls, can be ssl or empty
|
|
```
|
|
|
|
Those are good enough to start with. Going further, to configure more details you might need to create custom config (as described above) with the values like those:
|
|
```
|
|
$g_phpMailer_method = PHPMAILER_METHOD_SMTP;
|
|
$g_smtp_host = 'mail.domain.com';
|
|
$g_smtp_username = 'mail@domain.com';
|
|
$g_smtp_password = 'FILLME';
|
|
```
|
|
|
|
More details are available in [official documentation](https://www.mantisbt.org/docs/master/en-US/Admin_Guide/html-desktop/#admin.config.email)
|
|
|
|
## Custom plugins
|
|
|
|
In order to add your own custom plugins into the image, either create your own Dockerfile and copy extra plugins to `/var/www/html/plugins/` or add volume in docker-compose to mount extra plugin directly inside existing image `./custom_plugin/:/var/www/html/plugins/custom_plugin/`
|