Web app not working in mailadm

Hi Guys,

I have installed mailadm. It seems that almost everything is ok, but the container for gunicorn server is not responding to calls …
If I check the containers, it shows me: c9b210371891 mailadm-mailcow “gunicorn --timeout …” 2 minutes ago Restarting (1) 23 seconds ago mailadm
I started it with the command according to mailadm: managing token-based temporary e-mail accounts — mailadm 1.0.0 documentation : $ sudo docker run -d -p 3691:3691 --restart=unless-stopped --mount type=bind,source=$PWD/docker-data,target=/mailadm/docker-data --name mailadm mailadm-mailcow gunicorn --timeout 60 -b :3691 -w 4 mailadm.app:app

But if I start it with command:
sudo docker run -d -p 3691:3691 --mount type=bind,source=$PWD/docker-data,target=/mailadm/docker-data --name mailadm mailadm-mailcow gunicorn -b :3691 -w 1 mailadm.app:app
according to: How to Setup a Mail Server for Delta Chat - Delta Chat, then I get:
7ff298d1c796 mailadm-mailcow “gunicorn -b :3691 -…” 2 seconds ago Exited (1) 1 second ago mailadm

I understand that in both cases the container is in not-started status.

I have tried to start the container in interactive mode like this:
root@chat:/opt/mailadm# docker run -ti -p 3691:3691 --mount type=bind,source=$PWD/docker-data,target=/mailadm/docker-data --name mailadm mailadm-mailcow
/mailadm # gunicorn -b :3691 -w 1 mailadm.app:app
[2024-03-26 18:40:59 +0000] [6] [INFO] Starting gunicorn 21.2.0
[2024-03-26 18:41:00 +0000] [6] [INFO] Listening at: http://0.0.0.0:3691 (6)
[2024-03-26 18:41:00 +0000] [6] [INFO] Using worker: sync
[2024-03-26 18:41:00 +0000] [12] [INFO] Booting worker with pid: 12
To complete the mailadm setup, please run: mailadm setup-bot
/mailadm #

But it exits, too.

Would you advice me what to do in this case?
Thank you for your support,

Carlos

You need to run scripts/mailadm.sh setup-bot beforehand, to setup the admin group. Right now, the container exits because the admin group doesn’t exist yet.

Thank you for your quick reply, [missytake]

I believe I have run before scripts/mailadm.sh setup-bot, as I have a container for it like this:
d88df7c978c4 mailadm-mailcow “mailadm setup-bot” 3 hours ago Up 3 hours cranky_visvesvaraya

The mailadm@ has been created, too. I checked it in Mailcow backend. From DeltaChat app, I have joined the admin group using the generated QR code. As a matter of fact, I sent a message from DeltaChat like: /help, but didn’t get an answer as per explanation in the documentation.

I don’t what I am missing here. Why gunicorn can’t see the bot?
:thinking:

did setup-bot show you a QR code? did you scan it? it should only run once and have CLI output. If it’s still up, but in the background, you should run docker logs cranky_visvesvaraya, look for the QR code, and scan it with Delta Chat. After the bot has added you to the admin group, the container should stop. Then you can start the gunicorn container.

1 Like

Thank you, it works! My gunicorn is running!! :ok_hand:

The only thing missing now is that redirection to mailadm.my-domain/new_email is not working, but if I make:
$ curl -X POST ‘http://localhost:3691?t=1d_r84EW3N8hEKk&n=oneday’
then I get the right response and it creates a new account.

My server_name.active looks like:
server_name chat.my-domain mailadm.my-domain autodiscover.* autoconfig.* ;

and my site.mailadm.custom looks like:
location /new_email {
proxy_pass http://my-server-ip:3691/;
}

I can’t find out why it is not forwarding the request:
curl -X POST ‘https://mailadm.my-domain/new_email?t=1d_r84EW3N8hEKk&n=oneday’

Thank you,

Carlos

I managed to solve this issue!

The problem was that gunicorn was running on a different network from the one Mailcow is running. You need to include --net=mailcowdockerized_mailcow-network into the running command specified by the documentation:
sudo docker run -d -p 3691:3691 --mount type=bind,source=$PWD/docker-data,target=/mailadm/docker-data --name mailadm mailadm-mailcow gunicorn -b :3691 -w 1 mailadm.app:app

Then it should look like this:
sudo docker run -d -p 3691:3691 --mount type=bind,source=$PWD/docker-data,target=/mailadm/docker-data --net=mailcowdockerized_mailcow-network --name mailadm mailadm-mailcow gunicorn -b :3691 -w 1 mailadm.app:app

mailcowdockerized_mailcow-network is the name of the network configured by Mailcow at the time of this writing.

And remember that data/conf/nginx/server_name.active should be modified like this:
server_name my-mail-server-domain mailadm.my-mail-domain autodiscover.* autoconfig.* ;

And data/conf/nginx/site.mailadm.custom should be modified like this:
location /new_email {
proxy_pass http://mailadm:3691/;
}
mailadm is the DNS name on which gunicorn is hanging as a docker container. The DNS service within docker will translate it to its internal ip address.

This 2 files have to be copied into the Mailcow nginx container :
docker cp data/conf/nginx/site.mailadm.custom mailcowdockerized-nginx-mailcow-1:/etc/nginx/conf.d
docker cp data/conf/nginx/server_name.active mailcowdockerized-nginx-mailcow-1:/etc/nginx/conf.d
Then you need to reload the nginx server at Mailcow:
docker exec mailcowdockerized-nginx-mailcow-1 nginx -s reload

Hopefully this can be helpful for other guys at installing mailadm service :slightly_smiling_face:

great that it works now :slight_smile:

not sure if I understand correctly what you had to do differently to fix it - could you open a pull request to deltachat-pages/en/serverguide.md at master · deltachat/deltachat-pages · GitHub describing the difference?