Added options to dockerfile to allow for use of commandline options#12
Open
scottcove wants to merge 1 commit intomsztolcman:masterfrom
Open
Added options to dockerfile to allow for use of commandline options#12scottcove wants to merge 1 commit intomsztolcman:masterfrom
scottcove wants to merge 1 commit intomsztolcman:masterfrom
Conversation
milindagashe
approved these changes
Aug 13, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi there!
I was in need of using multiple Sendria instances with auth inside of a dockerised, environment, so created a new endpoint script that allows the use of the command line options by passing certain environment variables to the container. The entrypoint script will then build the sendria command that needs running, and run it.
This allows for the following environment variables to be passed to the container:
DB_PATH: This will accept any of the following (relative to the container)SMTP_USER: This is the smtp username that the user wants.SMTP_PASS: This is the smtp password that the user wants.smtp-userHTTP_USER: This is the username that the user wants.adminHTTP_PASS: This is the http password that the user wants.DEBUG: Boolean that switchessendriadebug on.NO_QUIT: Boolean that switches-non when true.NO_CLEAR: Boolean that switches-con when true.TEMPLATE_NAME: Allows the user to set the name of the templateTEMPLATE_URL: Allows the user to set the url.LOG_FILE: Accepts a full path to a logfile (inside the container). This is particularly handy if you want persistent logging.Note that all of these are optional. If none are given, the same command is run as is currently run in master.
To make this work, the following changes were made to the Dockerfile:
bashinstead ofash- this allows the BASH_REMATCH functions to work in the entrypoint script.apache2-utilsthat allow us to generatehtpasswdfiles.SENDRIA_DATA_DIRenvironment variable, which is used in the script, to allow for changes if need be, and is handy for persistent volumes.toolsfolder, and running that.This should greatly improve the usability of the docker container, and with all of the data in one directory, allows for persistence if the user so wishes.
An example docker command would be as below (I've built this as
sendria:lateston my local):docker run -d --restart unless-stopped --name sendria-project -p 1080:1080 -p 1025:1025 -v /usr/local/sendria/project/:/home/sendria/data -e HTTP_PASS="4secur3p@ssw0rd!" -e SMTP_USER="project-user" -e SMTP_PASS="4secur3p@ssw0rd!" -e NO_QUIT="TRUE" -e LOG_FILE="/home/sendria/data/log.log" -e TEMPLATE_NAME="My Projects Sendria Sinkhole" -e TEMPLATE_URL="http://172.25.1.174:1080" sendria:latestNote that the above uses the default database location, assumes that the http user is admin, and allows the user to clear the mail, but not stop (exit) the container.
Thanks for considering this PR!