Skip to content
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

Deploy stuck #27

Open
gadonski opened this issue Apr 26, 2023 · 7 comments
Open

Deploy stuck #27

gadonski opened this issue Apr 26, 2023 · 7 comments

Comments

@gadonski
Copy link

After starting process, the container stuck on status complete.

On logs, there no errors but show a warning.

[services.d] starting services,
Poste.io administration available at https://10.16.1.21:443 or http://10.16.1.21:80  ,
[services.d] done.,
[cont-finish.d] executing container finish scripts...,
[!] WARNING: User-initiated shutdown.,
[cont-finish.d] done.,
[s6-finish] syncing disks.,
[s6-finish] sending all processes the TERM signal.

How can i fix it or how to debug to find the real error?

@pjeby
Copy link
Member

pjeby commented Apr 27, 2023

Did you check the logs under /data/log? That'd probably be the place to look, as the docker-level logs aren't that informative overall.

@gadonski
Copy link
Author

yep... the only log that caught my attention was the redis log with some warnings (WARNING you have Transparent Huge Pages (THP) support enabled in your kernel).

Do you know which service triggers the "[!] WARNING: User-initiated shutdown.," message?

@pjeby
Copy link
Member

pjeby commented Apr 27, 2023

Nope. That also shows during a normal shutdown of the docker container, as far as I know.

Googling the error message plus poste.io leads to this issue, which relates to not using host-mode networking. Is your container configured for host-mode networking? (It needs to be, or poste.io will not work correctly.)

@gadonski
Copy link
Author

gadonski commented May 2, 2023

Hi @pjeby ... yes, i've set to host

version: "3"
services:
  poste:
    image: dirtsimple/poste.io
    restart: always
    network_mode: host  # <-- a must-have for poste

    # serve everything on `mail.example.com`, which will be the default HELO as well:
    hostname: mail.dominioteste.com.br

    volumes:
      - /data/posteioteste:/data
      - /etc/localtime:/etc/localtime:ro

    # ==== Optional settings below: you don't need any environment vars by default ====
    ports:
        - 6080:80
        - 6443:443

    environment:


@pjeby
Copy link
Member

pjeby commented May 2, 2023

You can't use port mappings with poste.io; if you need to share the IP with other web servers you need to use the environment variables described in https://poste.io/doc/getting-started - and pay particular attention to the issue that certificate setup needs to use a real port 80 unless you turn off HTTPS.

Your container must be assigned an externally routed public IP whose hostname resolves in public DNS. This is mentioned both in the official poste.io docs and the README for this container.

I don't know whether fixing these issues will fix your problem, but they will cause a variety of problems and so should be fixed first, especially since they might well be the cause of your issue. (For example, it's possible that your port mappings are actually disabling host-mode networking, or interfering with it in a way that causes the same shutdown issue as not using host-mode networking.)

@gadonski
Copy link
Author

gadonski commented May 3, 2023

Right, but i have two environments production and homolog with dedicated servers.
On production environment we use the image analogic/poste.io with configuration below (and works fine)

version: '3.5'
       
volumes:
  posteio_data:
    driver: local
    driver_opts:
      type: 'none'
      o: 'bind'
      device: '/data/posteio'

services:
    production:
      image: analogic/poste.io
      restart: always
      hostname: mail.company.com.br
      network_mode: host
      ports:
        - 25:25
        - 6080:80
        - 6443:443
        - 110:110
        - 143:143
        - 465:465
        - 587:587
        - 993:993
        - 995:995
      environment:
        - TZ=America/Sao_Paulo
        - VIRTUAL_HOST=mail.company.com.br
      volumes:
        - posteio_data:/data

I'm testing the image dirtsimple/poste.io on homolog enviroment, with basic configuration on compose, but it does not work...

version: "3"
services:
  poste:
    image: dirtsimple/poste.io
    restart: always
    network_mode: host  # <-- a must-have for poste

    # serve everything on `mail.example.com`, which will be the default HELO as well:
    hostname: mail.dominioteste.com.br

    volumes:
      - /data/posteioteste:/data
      - /etc/localtime:/etc/localtime:ro

    # ==== Optional settings below: you don't need any environment vars by default ====
    ports:
        - 6080:80
        - 6443:443
    environment:
      # Whitespace-separated list of IP addresses to listen on. If this variable
      # is set to "host" (which is also the default if it's empty or unset), the
      # container will listen on all the IPs (v4 and v6) found in DNS or /etc/hosts
      # for the container's hostname.  Or it can be set to "*", to listen on ALL
      # available addresses (the way the standard poste.io image does).
      - "LISTEN_ON=*"

      # Whitespace-separated list of IP addresses mail can be sent from; the first
      # one in the list will be the default.  Like LISTEN_ON, it can be set to '*'
      # for "any available address" or 'host' for "any IP (v4 or v6) attached to
      # the container hostname".  If the list expands to only one address, it
      # will be used for all outgoing mail.  Otherwise, data/outbound-hosts.yml
      # is read to determine the outgoing IP for each domain, and the result is
      # validated against this list.  If this variable is empty or unset, it defaults
      # to whatever LISTEN_ON was set to.


      # Other standard poste.io vars can also be used, e.g. HTTPS_PORT, etc.

Yes, the configuration of production environment seems strange because the documentation says to do different, but works fine.

The homolog environment is a clone of production. After starting the post using the dirtsimple/poste.io image, the container hangs in "complete" status and I don't know in which log to look for the reason, because the portainer output is very simple.

I'll look at the port settings again as you commented. If you have any other suggestions you can send me I would be grateful.

Thanks

@pjeby
Copy link
Member

pjeby commented May 3, 2023

According to the documentation, port mappings are discarded and you should be seeing a warning when you combine port mapping with host mode networking. If you're not seeing that warning (in either environment), something is amiss.

The most obvious way in which your setup might be failing is that on your dev machine (w/this image) is that you have another web server using port 80 on one of its IPs. With the configuration you've shown (LISTEN_ON=* and the default http port), your nginx would likely exit with an error due to not being able to bind port 80. (Remember: port mappings are ignored in host mode, so the remapping to port 6000 will not happen, and poste's nginx will try to take over port 80 on every available IP.)

So one log you might want to check would be log/nginx/error.log in the data volume. You should probably also set LISTEN_ON to a single IP, one which does not have any conflicting listening ports on it. On the host machine, you'll want to netstat -tulpn and check there aren't any active listens on the relevant ports on the relevant IP. (You can of course list more than one IP in LISTEN_ON, but they can't be IPs that have listeners on 80, 443, or any of the mail-related ports.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants