New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker/Podman builds for notqmail #141
base: main
Are you sure you want to change the base?
Conversation
if [ ! -f /etc/mtab ] ; then | ||
if [ -f /proc/self/mounts ] ; then | ||
echo "Warning linking /etc/mtab to /proc/self/mounts" 1>&2 | ||
ln -s /proc/self/mounts /etc/mtab | ||
elif [ -f /proc/mounts ] ; then | ||
echo "Warning linking /etc/mtab to /proc/mounts" 1>&2 | ||
ln -s /proc/mounts /etc/mtab | ||
else | ||
echo "Warning /etc/mtab: No such file or directory" 1>&2 | ||
fi | ||
fi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
simply curious here: is that a boilerplate to get a full filesystem or is it specific to notqmail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not specific to notqmail. I have a virtualdomains package which uses getmntent() call to find out the filesystem in which the user's Maildir is getting created (when adding a new user). It then creates maildirsize file for quota calculation. I guess the same can be done by using statvfs() call, but I have not yet investigated. This error came up (IIRC) on the ubuntu images. Most podman images are having the /etc/mtab file. The mounted filesystems are also in /proc/self/mounts. So I created this link so that user creation could go on without errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once you create this link, getmntent() library call doesn't fail. I believe getmntent() should be modified to not look at a hardcoded /etc/mtab file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the insight. Maybe we adding a short comment like # in case getmntent(3) is needed
before ?
getmntent(3):
DESCRIPTION
These routines are used to access the filesystem description file
/etc/fstab and the mounted filesystem description file /etc/mtab.
I am interested in knowing what is the motive for bringing Docker into the repository:
|
It can be used for testing. Once can put few scripts which sends out emails to some standard email address and a reply is sent back. But I doubt we could be anywhere near achieving that soon. Maybe few months later.
Yes.
Docker / podman provides an easy way for a user to quickly run a notqmail instanace on most platforms. Theoretically the user can run a notqmail ubuntu instance on Windows too on a macbook too. Once a docker image is ready, the configuration will be identical for all users. When you run a docker instance on your production server, you will not be modifiying any files on the server. The docker or podman instance is an isolated container that has everything needed to run notqmail in an isolated container. This gives the ability to the user to minimize changes to his/her existing server (the only change required is to install podman or docker using apt-get, dnf or yum). The ultimate goal should be to have ucspi-tcp, daemontools also installed. Then one can have a complete mail server setup in a container. Users can simply (regardless of their OS), pull the docker image and run the container using the docker run or the podman run command (using the --net) command. and by doing that the user can have incoming SMTP and outgoing delivery from his server. |
Also once you have a deployable podman container for notqmail, one can go to the next step. Deploy kubernetes. I haven't reached there yet. But I know people who have deployed one of my fork of qmail and made a scalable solution. |
Adding more directories regarding various build, containerization, integration with other platforms... could mislead those discovering notqmail into thinking that these became part of the build process. Some project even have a Docker file instead of a Makefile. The convention seems to be that everything that is not part of the project itself starts with a dot, so the same could go for docker. Or maybe an extra "contrib" directory, or maybe grouping it with the other continuous integration configs #148 could help with standing it clear that notqmail is not tied to GitHub or Docker. Is there a requirement or a conventions for the location of docker images from projects? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given docker is not a dependency for notqmail, I see no issue in having resources for it, and bundling it into the repo make it easy to find.
I am fine with keeping it in, keeping it as a separate repo, or everything in-between, as it provides more ways of testing the code in more diverse environments.
Reading #148 again, it looks like /docker aside to /tests will help keeping the ambiguity away ! :) |
Dockerfile repository for automated builds.
This docker subdirectory is a repository for Dockerfiles used for building docker/podman images for notqmail. We use Docker Hub for automated builds. However one can create the container images locally by using docker build or podman build command
https://hub.docker.com/r/notqmail/notqmail/tags
The following tags/images can be pulled by executing the commands
a) docker
or
b) podman
Replace tag in the above command with one of the following
Instructions for starting the docker/podman container
(replace podman with docker for docker operations)
list podman images
$ podman images
Start the podman container
notqmail uses docker-entrypoint to execute qmail-start and start qmail-send, qmail-lspawn, qmail-rspawn. You just need to pass any argument other than notqmail to bypass the default entrypoint.
$ podman run -d -h notqmail.org --name notqmail d3b533841934
You can use --net host to map the container's network to the HOST
Query the id of the container
$ podman ps
Execute an interactive shell in the container
$ podman exec -ti notqmail /bin/bash
Get processlist in the container
Get console logs of the container
Stop the container
$ podman stop `podman ps -q`
Clear the stopped container image
$ podman rm `podman ps -aq`
c) github respository for Dockerfile
The Dockerfile for each of the images is located in a separate subdirectory for each linux distro
notqmail
https://github.com/notqmail/docker/tree/master/notqmail
If you want to build the image yourself instead of using hub.docker.com, you can use the below commands. You will need to install either docker or podman using yum/dnf/apt-get
NOTE THIS FILE REQUIRES Editing after completing following steps
create a user docker_user on hub.docker.com (docker_user)Take a look at
https://github.com/mbhangui/docker
&
https://hub.docker.com/repository/docker/cprogrammer/indimail-mta