From 18aa531c754668be5add6f10d72139a7a1640e8c Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sun, 7 Dec 2025 13:20:50 +0000
Subject: [PATCH 1/6] Initial plan
From 43996160c0cd3e91cedbde204646a4b3c7218fcd Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sun, 7 Dec 2025 13:23:49 +0000
Subject: [PATCH 2/6] Add COMPOSER_EXTRA_PACKAGES environment variable support
for Docker containers
Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
---
.docker/frankenphp/docker-entrypoint.sh | 12 +++++++
.docker/partdb-entrypoint.sh | 12 +++++++
docs/installation/installation_docker.md | 41 +++++++++++++++++++++++-
3 files changed, 64 insertions(+), 1 deletion(-)
diff --git a/.docker/frankenphp/docker-entrypoint.sh b/.docker/frankenphp/docker-entrypoint.sh
index 1655af5ab..ff1fbb697 100644
--- a/.docker/frankenphp/docker-entrypoint.sh
+++ b/.docker/frankenphp/docker-entrypoint.sh
@@ -26,6 +26,18 @@ if [ "$1" = 'frankenphp' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then
composer install --prefer-dist --no-progress --no-interaction
fi
+ # Install additional composer packages if COMPOSER_EXTRA_PACKAGES is set
+ if [ -n "$COMPOSER_EXTRA_PACKAGES" ]; then
+ echo "Installing additional composer packages: $COMPOSER_EXTRA_PACKAGES"
+ composer require $COMPOSER_EXTRA_PACKAGES --no-interaction --no-progress --optimize-autoloader
+ if [ $? -eq 0 ]; then
+ echo "Successfully installed additional composer packages"
+ else
+ echo "Failed to install additional composer packages"
+ exit 1
+ fi
+ fi
+
if grep -q ^DATABASE_URL= .env; then
echo "Waiting for database to be ready..."
ATTEMPTS_LEFT_TO_REACH_DATABASE=60
diff --git a/.docker/partdb-entrypoint.sh b/.docker/partdb-entrypoint.sh
index f5071e223..94d7f0f6a 100644
--- a/.docker/partdb-entrypoint.sh
+++ b/.docker/partdb-entrypoint.sh
@@ -39,6 +39,18 @@ if [ -d /var/www/html/var/db ]; then
fi
fi
+# Install additional composer packages if COMPOSER_EXTRA_PACKAGES is set
+if [ -n "$COMPOSER_EXTRA_PACKAGES" ]; then
+ echo "Installing additional composer packages: $COMPOSER_EXTRA_PACKAGES"
+ sudo -E -u www-data composer require $COMPOSER_EXTRA_PACKAGES --no-interaction --no-progress --optimize-autoloader
+ if [ $? -eq 0 ]; then
+ echo "Successfully installed additional composer packages"
+ else
+ echo "Failed to install additional composer packages"
+ exit 1
+ fi
+fi
+
# Start PHP-FPM (the PHP_VERSION is replaced by the configured version in the Dockerfile)
php-fpmPHP_VERSION -F &
diff --git a/docs/installation/installation_docker.md b/docs/installation/installation_docker.md
index 347c24510..b7048169e 100644
--- a/docs/installation/installation_docker.md
+++ b/docs/installation/installation_docker.md
@@ -80,7 +80,11 @@ services:
#- BANNER=This is a test banner
with a line break
# If you use a reverse proxy in front of Part-DB, you must configure the trusted proxies IP addresses here (see reverse proxy documentation for more information):
- # - TRUSTED_PROXIES=127.0.0.0/8,::1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
+ # - TRUSTED_PROXIES=127.0.0.0/8,::1,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
+
+ # If you need to install additional composer packages (e.g., for specific mailer transports), you can specify them here:
+ # The packages will be installed automatically when the container starts
+ # - COMPOSER_EXTRA_PACKAGES=symfony/mailgun-mailer symfony/sendgrid-mailer
```
4. Customize the settings by changing the environment variables (or adding new ones). See [Configuration]({% link
@@ -149,6 +153,9 @@ services:
# Override value if you want to show a given text on homepage.
# When this is commented out the webUI can be used to configure the banner
#- BANNER=This is a test banner
with a line break
+
+ # If you need to install additional composer packages (e.g., for specific mailer transports), you can specify them here:
+ # - COMPOSER_EXTRA_PACKAGES=symfony/mailgun-mailer symfony/sendgrid-mailer
database:
container_name: partdb_database
@@ -169,6 +176,38 @@ services:
```
+### Installing additional composer packages
+
+If you need to use specific mailer transports or other functionality that requires additional composer packages, you can
+install them automatically at container startup using the `COMPOSER_EXTRA_PACKAGES` environment variable.
+
+For example, if you want to use Mailgun as your email provider, you need to install the `symfony/mailgun-mailer` package.
+Add the following to your docker-compose.yaml environment section:
+
+```yaml
+environment:
+ - COMPOSER_EXTRA_PACKAGES=symfony/mailgun-mailer
+ - MAILER_DSN=mailgun+api://API_KEY:DOMAIN@default
+```
+
+You can specify multiple packages by separating them with spaces:
+
+```yaml
+environment:
+ - COMPOSER_EXTRA_PACKAGES=symfony/mailgun-mailer symfony/sendgrid-mailer
+```
+
+{: .info }
+> The packages will be installed when the container starts. This may increase the container startup time on the first run.
+> The installed packages will persist in the container until it is recreated.
+
+Common mailer packages you might need:
+- `symfony/mailgun-mailer` - For Mailgun email service
+- `symfony/sendgrid-mailer` - For SendGrid email service
+- `symfony/brevo-mailer` - For Brevo (formerly Sendinblue) email service
+- `symfony/amazon-mailer` - For Amazon SES email service
+- `symfony/postmark-mailer` - For Postmark email service
+
### Update Part-DB
You can update Part-DB by pulling the latest image and restarting the container.
From 354d20147688c2670a4d5c75ff94d1c79b6d79e9 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sun, 7 Dec 2025 13:25:31 +0000
Subject: [PATCH 3/6] Add shellcheck disable comment for intentional word
splitting
Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
---
.docker/frankenphp/docker-entrypoint.sh | 3 +++
.docker/partdb-entrypoint.sh | 3 +++
2 files changed, 6 insertions(+)
diff --git a/.docker/frankenphp/docker-entrypoint.sh b/.docker/frankenphp/docker-entrypoint.sh
index ff1fbb697..0aaf6674d 100644
--- a/.docker/frankenphp/docker-entrypoint.sh
+++ b/.docker/frankenphp/docker-entrypoint.sh
@@ -29,6 +29,9 @@ if [ "$1" = 'frankenphp' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then
# Install additional composer packages if COMPOSER_EXTRA_PACKAGES is set
if [ -n "$COMPOSER_EXTRA_PACKAGES" ]; then
echo "Installing additional composer packages: $COMPOSER_EXTRA_PACKAGES"
+ # Note: COMPOSER_EXTRA_PACKAGES is intentionally not quoted to allow word splitting
+ # This enables passing multiple package names separated by spaces
+ # shellcheck disable=SC2086
composer require $COMPOSER_EXTRA_PACKAGES --no-interaction --no-progress --optimize-autoloader
if [ $? -eq 0 ]; then
echo "Successfully installed additional composer packages"
diff --git a/.docker/partdb-entrypoint.sh b/.docker/partdb-entrypoint.sh
index 94d7f0f6a..745fccd45 100644
--- a/.docker/partdb-entrypoint.sh
+++ b/.docker/partdb-entrypoint.sh
@@ -42,6 +42,9 @@ fi
# Install additional composer packages if COMPOSER_EXTRA_PACKAGES is set
if [ -n "$COMPOSER_EXTRA_PACKAGES" ]; then
echo "Installing additional composer packages: $COMPOSER_EXTRA_PACKAGES"
+ # Note: COMPOSER_EXTRA_PACKAGES is intentionally not quoted to allow word splitting
+ # This enables passing multiple package names separated by spaces
+ # shellcheck disable=SC2086
sudo -E -u www-data composer require $COMPOSER_EXTRA_PACKAGES --no-interaction --no-progress --optimize-autoloader
if [ $? -eq 0 ]; then
echo "Successfully installed additional composer packages"
From 0444d4e50573e78b65c3bdef3d89a7d6ea7c0f50 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sun, 7 Dec 2025 14:15:47 +0000
Subject: [PATCH 4/6] Add documentation for installing mailer packages in
email.md
Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
---
docs/installation/email.md | 64 +++++++++++++++++++++++++++++++++++++-
1 file changed, 63 insertions(+), 1 deletion(-)
diff --git a/docs/installation/email.md b/docs/installation/email.md
index 0418fb4a3..228825a51 100644
--- a/docs/installation/email.md
+++ b/docs/installation/email.md
@@ -15,13 +15,75 @@ To make emails work you have to properly configure a mail provider in Part-DB.
## Configuration
Part-DB uses [Symfony Mailer](https://symfony.com/doc/current/mailer.html) to send emails, which supports multiple
-automatic mail providers (like MailChimp or SendGrid). If you want to use one of these providers, check the Symfony
+mail providers (like Mailgun, SendGrid, or Brevo). If you want to use one of these providers, check the Symfony
Mailer documentation for more information.
We will only cover the configuration of an SMTP provider here, which is sufficient for most use-cases.
You will need an email account, which you can use to send emails from via password-based SMTP authentication, this account
should be dedicated to Part-DB.
+### Using specialized mail providers (Mailgun, SendGrid, etc.)
+
+If you want to use a specialized mail provider like Mailgun, SendGrid, Brevo (formerly Sendinblue), Amazon SES, or
+Postmark instead of SMTP, you need to install the corresponding Symfony mailer package first.
+
+#### Docker installation
+
+If you are using Part-DB in Docker, you can install additional mailer packages by setting the `COMPOSER_EXTRA_PACKAGES`
+environment variable in your `docker-compose.yaml`:
+
+```yaml
+environment:
+ - COMPOSER_EXTRA_PACKAGES=symfony/mailgun-mailer
+ - MAILER_DSN=mailgun+api://API_KEY:DOMAIN@default
+ - EMAIL_SENDER_EMAIL=noreply@yourdomain.com
+ - EMAIL_SENDER_NAME=Part-DB
+ - ALLOW_EMAIL_PW_RESET=1
+```
+
+You can install multiple packages by separating them with spaces:
+
+```yaml
+environment:
+ - COMPOSER_EXTRA_PACKAGES=symfony/mailgun-mailer symfony/sendgrid-mailer
+```
+
+The packages will be installed automatically when the container starts.
+
+Common mailer packages:
+- `symfony/mailgun-mailer` - For [Mailgun](https://www.mailgun.com/)
+- `symfony/sendgrid-mailer` - For [SendGrid](https://sendgrid.com/)
+- `symfony/brevo-mailer` - For [Brevo](https://www.brevo.com/) (formerly Sendinblue)
+- `symfony/amazon-mailer` - For [Amazon SES](https://aws.amazon.com/ses/)
+- `symfony/postmark-mailer` - For [Postmark](https://postmarkapp.com/)
+
+#### Direct installation (non-Docker)
+
+If you have installed Part-DB directly on your server (not in Docker), you need to manually install the required
+mailer package using composer.
+
+Navigate to your Part-DB installation directory and run:
+
+```bash
+# Install the package as the web server user
+sudo -u www-data composer require symfony/mailgun-mailer
+
+# Clear the cache
+sudo -u www-data php bin/console cache:clear
+```
+
+Replace `symfony/mailgun-mailer` with the package you need. You can install multiple packages at once:
+
+```bash
+sudo -u www-data composer require symfony/mailgun-mailer symfony/sendgrid-mailer
+```
+
+After installing the package, configure the `MAILER_DSN` in your `.env.local` file according to the provider's
+documentation (see [Symfony Mailer documentation](https://symfony.com/doc/current/mailer.html) for DSN format for
+each provider).
+
+## SMTP Configuration
+
To configure the SMTP provider, you have to set the following environment variables:
`MAILER_DSN`: You have to provide the SMTP server address and the credentials for the email account here. The format is
From 562e4772cd0c995e8e37eedc0e9413730537e4eb Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sun, 7 Dec 2025 14:30:56 +0000
Subject: [PATCH 5/6] Add --no-dev flag to composer require to prevent dev
packages installation
Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
---
.docker/frankenphp/docker-entrypoint.sh | 2 +-
.docker/partdb-entrypoint.sh | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/.docker/frankenphp/docker-entrypoint.sh b/.docker/frankenphp/docker-entrypoint.sh
index 0aaf6674d..582793ae5 100644
--- a/.docker/frankenphp/docker-entrypoint.sh
+++ b/.docker/frankenphp/docker-entrypoint.sh
@@ -32,7 +32,7 @@ if [ "$1" = 'frankenphp' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then
# Note: COMPOSER_EXTRA_PACKAGES is intentionally not quoted to allow word splitting
# This enables passing multiple package names separated by spaces
# shellcheck disable=SC2086
- composer require $COMPOSER_EXTRA_PACKAGES --no-interaction --no-progress --optimize-autoloader
+ composer require $COMPOSER_EXTRA_PACKAGES --no-dev --no-interaction --no-progress --optimize-autoloader
if [ $? -eq 0 ]; then
echo "Successfully installed additional composer packages"
else
diff --git a/.docker/partdb-entrypoint.sh b/.docker/partdb-entrypoint.sh
index 745fccd45..7f49b5054 100644
--- a/.docker/partdb-entrypoint.sh
+++ b/.docker/partdb-entrypoint.sh
@@ -45,7 +45,7 @@ if [ -n "$COMPOSER_EXTRA_PACKAGES" ]; then
# Note: COMPOSER_EXTRA_PACKAGES is intentionally not quoted to allow word splitting
# This enables passing multiple package names separated by spaces
# shellcheck disable=SC2086
- sudo -E -u www-data composer require $COMPOSER_EXTRA_PACKAGES --no-interaction --no-progress --optimize-autoloader
+ sudo -E -u www-data composer require $COMPOSER_EXTRA_PACKAGES --no-dev --no-interaction --no-progress --optimize-autoloader
if [ $? -eq 0 ]; then
echo "Successfully installed additional composer packages"
else
From e12bf570f98fc7215c948d774bee2fc824cd4d8c Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sun, 7 Dec 2025 14:39:43 +0000
Subject: [PATCH 6/6] Use --no-install with require and run separate install
command
Co-authored-by: jbtronics <5410681+jbtronics@users.noreply.github.com>
---
.docker/frankenphp/docker-entrypoint.sh | 13 ++++++++++---
.docker/partdb-entrypoint.sh | 13 ++++++++++---
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/.docker/frankenphp/docker-entrypoint.sh b/.docker/frankenphp/docker-entrypoint.sh
index 582793ae5..56b3bc31f 100644
--- a/.docker/frankenphp/docker-entrypoint.sh
+++ b/.docker/frankenphp/docker-entrypoint.sh
@@ -32,11 +32,18 @@ if [ "$1" = 'frankenphp' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/console' ]; then
# Note: COMPOSER_EXTRA_PACKAGES is intentionally not quoted to allow word splitting
# This enables passing multiple package names separated by spaces
# shellcheck disable=SC2086
- composer require $COMPOSER_EXTRA_PACKAGES --no-dev --no-interaction --no-progress --optimize-autoloader
+ composer require $COMPOSER_EXTRA_PACKAGES --no-install --no-interaction --no-progress
if [ $? -eq 0 ]; then
- echo "Successfully installed additional composer packages"
+ echo "Running composer install to install packages without dev dependencies..."
+ composer install --no-dev --no-interaction --no-progress --optimize-autoloader
+ if [ $? -eq 0 ]; then
+ echo "Successfully installed additional composer packages"
+ else
+ echo "Failed to install composer dependencies"
+ exit 1
+ fi
else
- echo "Failed to install additional composer packages"
+ echo "Failed to add additional composer packages to composer.json"
exit 1
fi
fi
diff --git a/.docker/partdb-entrypoint.sh b/.docker/partdb-entrypoint.sh
index 7f49b5054..61e8d1e6b 100644
--- a/.docker/partdb-entrypoint.sh
+++ b/.docker/partdb-entrypoint.sh
@@ -45,11 +45,18 @@ if [ -n "$COMPOSER_EXTRA_PACKAGES" ]; then
# Note: COMPOSER_EXTRA_PACKAGES is intentionally not quoted to allow word splitting
# This enables passing multiple package names separated by spaces
# shellcheck disable=SC2086
- sudo -E -u www-data composer require $COMPOSER_EXTRA_PACKAGES --no-dev --no-interaction --no-progress --optimize-autoloader
+ sudo -E -u www-data composer require $COMPOSER_EXTRA_PACKAGES --no-install --no-interaction --no-progress
if [ $? -eq 0 ]; then
- echo "Successfully installed additional composer packages"
+ echo "Running composer install to install packages without dev dependencies..."
+ sudo -E -u www-data composer install --no-dev --no-interaction --no-progress --optimize-autoloader
+ if [ $? -eq 0 ]; then
+ echo "Successfully installed additional composer packages"
+ else
+ echo "Failed to install composer dependencies"
+ exit 1
+ fi
else
- echo "Failed to install additional composer packages"
+ echo "Failed to add additional composer packages to composer.json"
exit 1
fi
fi