feat: add SMTP vars, upgrade PHP and MySQL
This commit is contained in:
parent
d6c8ab41b6
commit
adf6cdb3c1
@ -1,4 +1,4 @@
|
||||
FROM php:7.4-apache
|
||||
FROM php:8.4-apache
|
||||
|
||||
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
|
||||
|
||||
@ -43,7 +43,7 @@ RUN set -xe \
|
||||
COPY config_inc.php /var/www/html/config/config_inc.php
|
||||
|
||||
# Install additional plugins
|
||||
ENV SOURCE_TAG v2.5.2
|
||||
ENV SOURCE_TAG v2.9.0
|
||||
RUN set -xe && \
|
||||
curl -fSL https://github.com/mantisbt-plugins/source-integration/tarball/${SOURCE_TAG} -o /tmp/source.tar.gz && \
|
||||
mkdir /tmp/source && \
|
||||
|
56
README.md
56
README.md
@ -12,7 +12,7 @@ There are some other alternative images exist already such as [vimagick/mantisbt
|
||||
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 (7.4 as for today)
|
||||
- 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!
|
||||
@ -34,7 +34,7 @@ https://www.mantisbt.org/docs/master/en-US/Admin_Guide/html-desktop/#admin.confi
|
||||
|
||||
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
|
||||
## Example docker-compose.yml
|
||||
|
||||
```YAML
|
||||
version: "3"
|
||||
@ -54,6 +54,12 @@ services:
|
||||
- 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
|
||||
@ -64,10 +70,10 @@ services:
|
||||
restart: always
|
||||
|
||||
db:
|
||||
image: mysql:5.7
|
||||
image: mysql:8.4
|
||||
container_name: mantis_db
|
||||
volumes:
|
||||
- ./db_data:/var/lib/mysql
|
||||
- ./db_data_v8:/var/lib/mysql
|
||||
environment:
|
||||
- MYSQL_ROOT_PASSWORD=root
|
||||
- MYSQL_DATABASE=bugtracker
|
||||
@ -77,6 +83,30 @@ services:
|
||||
|
||||
```
|
||||
|
||||
## 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
|
||||
@ -105,11 +135,21 @@ $g_anonymous_account = 'anonymous';
|
||||
|
||||
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_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`
|
||||
|
||||
Those are good enough to start with. Going further, to configure SMTP you might need to create custom config (as described above) with the values like:
|
||||
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';
|
||||
|
@ -14,6 +14,19 @@ $g_crypto_master_salt = getenv('MASTER_SALT');
|
||||
# Configure email
|
||||
$g_webmaster_email = getenv('EMAIL_WEBMASTER') !== false ? getenv('EMAIL_WEBMASTER') : null;
|
||||
$g_from_email = getenv('EMAIL_FROM') !== false ? getenv('EMAIL_FROM') : null;
|
||||
if (getenv('EMAIL_FROM_NAME') !== false) {
|
||||
$g_from_name = getenv('EMAIL_FROM_NAME');
|
||||
}
|
||||
$g_return_path_email = getenv('EMAIL_RETURN_PATH') !== false ? getenv('EMAIL_RETURN_PATH') : null;
|
||||
|
||||
# SMTP
|
||||
if (getenv('SMTP_HOST') !== false) {
|
||||
$g_phpMailer_method = PHPMAILER_METHOD_SMTP;
|
||||
$g_smtp_host = getenv('SMTP_HOST');
|
||||
$g_smtp_port = getenv('SMTP_PORT') !== false ? getenv('SMTP_PORT') : 587;
|
||||
$g_smtp_connection_mode = getenv('SMTP_MODE') !== false ? getenv('SMTP_MODE') : "tls";
|
||||
$g_smtp_username = getenv('SMTP_USER') !== false ? getenv('SMTP_USER') : null;
|
||||
$g_smtp_password = getenv('SMTP_PASSWORD') !== false ? getenv('SMTP_PASSWORD') : null;
|
||||
}
|
||||
|
||||
include 'config_inc_addon.php';
|
||||
|
@ -12,10 +12,17 @@ services:
|
||||
- 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
|
||||
# Set base email settings. For more detailed configuration you'll need to add own config file
|
||||
- EMAIL_WEBMASTER=webmaster@localhost
|
||||
- EMAIL_FROM=webmaster@localhost
|
||||
- EMAIL_FROM_NAME=Mantis BT
|
||||
- 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
|
||||
@ -30,10 +37,10 @@ services:
|
||||
restart: always
|
||||
|
||||
db:
|
||||
image: mysql:5.7
|
||||
image: mysql:8.4
|
||||
container_name: mantis_db
|
||||
volumes:
|
||||
- ./db_data:/var/lib/mysql
|
||||
- ./db_data_v8:/var/lib/mysql
|
||||
environment:
|
||||
# You might want to change root password before first run
|
||||
- MYSQL_ROOT_PASSWORD=root
|
||||
|
Loading…
x
Reference in New Issue
Block a user