Skip to content

Add SMTP configuration and environment support#129

Merged
stephdl merged 25 commits intomainfrom
sdl-smarthost
Feb 19, 2026
Merged

Add SMTP configuration and environment support#129
stephdl merged 25 commits intomainfrom
sdl-smarthost

Conversation

@stephdl
Copy link
Collaborator

@stephdl stephdl commented Feb 9, 2026

Introduce a script to discover SMTP settings and create an environment file for smarthost configuration. Update the container setup to include OpenSSL and ensure the service can access the new SMTP environment variables.

NethServer/dev#7859

Copy link
Member

@DavidePrincipi DavidePrincipi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since discover-smarthost runs under multiple unit instances, separate temporary files are required to avoid conflicts when smarthost.env is written.

Copy link
Member

@DavidePrincipi DavidePrincipi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds smarthost/SMTP settings discovery to the webserver module so php-fpm containers can consume centrally-managed SMTP configuration, and updates the container/runtime setup accordingly (issue: NethServer/dev#7859).

Changes:

  • Add discover-smarthost script to read smarthost settings from Redis and generate an SMTP environment file.
  • Update phpfpm@.service to load the new env file and attempt to pass SMTP variables into the php-fpm container; add an event handler to restart php-fpm on smarthost changes.
  • Install openssl in the PHP images and refactor build-images.sh to reduce duplication.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
imageroot/systemd/user/phpfpm@.service Loads optional smarthost env file, runs discovery pre-start, and attempts to forward SMTP env vars into the container.
imageroot/events/smarthost-changed/10restart_phpfpm New handler to restart configured php-fpm instances when smarthost changes.
imageroot/bin/discover-smarthost New script to generate smarthost.env from Redis smarthost settings.
container/Containerfile Adds openssl to runtime packages.
build-images.sh Refactors repeated image builds into a function.
README.md Documents smarthost discovery behavior and environment propagation.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@DavidePrincipi DavidePrincipi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot raised a red flag: --env-file is required to fix the .env write-then-read order.
Please consider also other points.

Copy link
Member

@DavidePrincipi DavidePrincipi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check this comment too #129 (comment)

stephdl and others added 2 commits February 19, 2026 09:25
Co-authored-by: Davide Principi <davide.principi@nethesis.it>
Updated the path for the SMTP configuration environment file in the README.
Copy link
Member

@DavidePrincipi DavidePrincipi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

stephdl and others added 2 commits February 19, 2026 09:41
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@stephdl stephdl merged commit 5ec308e into main Feb 19, 2026
1 check passed
@stephdl stephdl deleted the sdl-smarthost branch February 19, 2026 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants