Added options to dockerfile to allow for use of commandline options #12
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-user
HTTP_USER
: This is the username that the user wants.admin
HTTP_PASS
: This is the http password that the user wants.DEBUG
: Boolean that switchessendria
debug on.NO_QUIT
: Boolean that switches-n
on when true.NO_CLEAR
: Boolean that switches-c
on 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:
bash
instead ofash
- this allows the BASH_REMATCH functions to work in the entrypoint script.apache2-utils
that allow us to generatehtpasswd
files.SENDRIA_DATA_DIR
environment variable, which is used in the script, to allow for changes if need be, and is handy for persistent volumes.tools
folder, 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:latest
on 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:latest
Note 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!