stalwartlabs / smtp-server

Stalwart SMTP Server
https://stalw.art/smtp
GNU Affero General Public License v3.0
477 stars 24 forks source link

config not output when installing using smtp-server image #23

Closed bsheldrick closed 11 months ago

bsheldrick commented 1 year ago

When following the installation instructions for docker using the stalwartlabs/smtp-server:latest image there was no config file output to the mounted volume.

The volume was mounted to a folder created in the directory it was running from by the user running docker. There was no error reported indicating it couldn't write to the mounted volume.

I tried with the stalwartlabs/mail-server:latest image and it worked.

mdecimus commented 12 months ago

If you are on Mac, Docker and Virtualbox seem to have an issue with mounting a volume outside of the /Users directory.

bsheldrick commented 12 months ago

If you are on Mac, Docker and Virtualbox seem to have an issue with mounting a volume outside of the /Users directory.

This is happening on Linux Ubuntu Server 22.04

mdecimus commented 12 months ago

Make sure that the docker process has write access to the directory you are mounting as a volume.

bsheldrick commented 12 months ago

I think the problem is in your installation instructions. It explicitly says to map a volume to /opt/stalwart-mail. However, the Dockerfile in the smtp-server project exposes a volume to /opt/stalwart-smtp.

The installation instructions need to be updated to account for the variable volume mapping dependent on the image being used for configuration.

mdecimus commented 12 months ago

@bsheldrick the -v parameter should override the VOLUME definition in the Dockerfile. Is this not working for you?

bsheldrick commented 12 months ago

Yes, I understand how the docker volume parameter works. I was referring to the installation instructions at https://stalw.art/docs/install/docker.

image

The volume maps to the container path /opt/stalwart-mail. This will only work when using the stalwartlabs/mail-server image. The replacement parameter doesn't work when using other images.

You can easily test this by creating a new folder on your local computer and then follow your own instructions using any of the other images (not the mail-server image).

For example (using the smtp-server image):

$ mkdir stalwart_test

$ docker run -it -v stalwart_test:/opt/stalwart-mail \
             --entrypoint /bin/bash stalwartlabs/smtp-server:latest \
             -c "bash /usr/local/bin/configure.sh" 

$ cd stalwart_test
$ ls
// folder is empty

In this particular example changing the volume parameter to stalwart_test:/opt/stalwart-smtp still results in an empty output folder.

mdecimus commented 12 months ago

Yes, that is correct. The instructions include the -v parameter to avoid this but I'll remove the VOLUME from the Dockerfile to avoid confusion. I'll also find a way to configure the instance using docker exec rather than docker run.

mdecimus commented 12 months ago

Update: Version 0.3.1 has just been released with a simpler Docker setup process. As of 5.30pm CET the ARM64 image was still being compiled but the AMD64 one is ready if you want to check it out.

bsheldrick commented 12 months ago

I gave it a test on my local machine. I get the following error:

/usr/local/bin/entrypoint.sh: 10: exec: /usr/local/bin/stalwart-mail: not found

Your Dockerfile doesn't seem to be building or copying the executable into the container. It only copies the shell scripts.

mdecimus commented 12 months ago

That is correct, the configure.sh script now downloads the binaries instead of being compiled using a builder image. This had to be done because the Github Actions Docker CI job for ARM64 was taking sometimes more than 6 hours to compile and was cancelled by Github.

However, as you have found out, the script does not contemplate upgrading an existing installation. The new Dockerfile in the repository was updated to download the binaries before the image is bundled. A new Docker image will be published at some point this week, but in the meantime you can either run configure.sh manually using a temporary volume so the binaries are downloaded to /usr/local/bin or you can build a new image locally using the updated Dockerfile in the repo.

mdecimus commented 11 months ago

Update: The latest and 0.3.2 Docker tags now include the binaries in the image.