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

Stack is not created if a dependency within the stack fails #7656

Open
a-gerhard opened this issue Sep 12, 2022 · 5 comments
Open

Stack is not created if a dependency within the stack fails #7656

a-gerhard opened this issue Sep 12, 2022 · 5 comments
Assignees
Labels

Comments

@a-gerhard
Copy link

Bug description
I am trying to create a stack with two containers. Container 2 has a service_completed_successfully condition dependency on container 1. Container 1 fails to start. I then end up with the stack not having been created, the browser is still in the "add stack" view which shows me the stack I am currently creating (as if I had posted invalid syntax or another input error). Container 1 is in state 'failed', and Container 2 is in state 'created', both are not connected to any stack. If I want to try creating the stack again I will get an error that the container names are already taken. I need to remove the containers in order to try creating the stack again

Expected behavior
The stack is created, even though Container 1 fails and Container 2 stays in state 'created'.

In my case, the failing of Container 1 is a firewall issue that I am waiting for the network adminsitrators to fix. I would like to "save" the stack in Portainer so I can retry tomorrow, instead of having to enter it again tomorrow when the firewall would allow this.

Portainer Logs
Provide the logs of your Portainer container or Service.
You can see how here

Steps to reproduce the issue:

  1. In an environment, go to Stacks -> Add Stack
  2. Enter a stack where one service is a short-lived CLI tool that prepares the data used by the other service, and that other service has a service_completed_successfully dependency on the preparation service. I have attached an example below.
  3. Click on "Deploy the stack"
  4. Wait for deployment to fail and show an error message.

Technical details:

  • Portainer version: 2.14.2
  • Docker version (managed by Portainer):
  • Platform (windows/linux): linux
  • Command used to start Portainer (Ansible playbook):
- name: setting up portainer docker container
  docker_container:
          name:  portainer
          image: "portainer/portainer-ce:{{portainer_version}}"
          state: started
          restart_policy: always
          published_ports:
                  - "8000:8000"
          env:
                  http_proxy: "{{proxy_env['http_proxy']}}"
                  https_proxy: "{{proxy_env['https_proxy']}}"
                  no_proxy: "{{proxy_env['no_proxy']}}"
                  TZ: "{{timezone}}"
          volumes:
                  - "/var/run/docker.sock:/var/run/docker.sock"
                  - "portainer_data:/data"
                  - "/etc/localtime:/etc/localtime"
                  - "/etc/timezone:/etc/timezone"
          networks:
                  - name: traefik
          labels:
              com.centurylinklabs.watchtower.enable: "true"
              traefik.enable: "true"
              traefik.http.routers.portainer.rule: "PathPrefix(`/`)"  # Host(`{{ansible_facts['hostname']}}`)"
              traefik.http.routers.portainer.tls: "true"
              traefik.http.routers.portainer_insecure.rule: "PathPrefix(`/`)"  # Host(`{{ansible_facts['hostname']}}`)"
              traefik.http.services.portainer.loadbalancer.server.port: "9000"
          recreate: "{{portainer_upgrade}}"
          pull: "{{portainer_upgrade}}"
  register: docker_container
  when: portainer_upgrade or not portainer_container.exists
  • Browser: Chrome 105.0.5195.102
  • Use Case: Using Portainer in a Commercial setup.
  • Have you reviewed our technical documentation and knowledge base? Yes

Additional context
Here is what I am trying to run:

version: "3.5"

services:
  register:
    restart: 'no'
    image: gitlab/gitlab-runner:latest
    volumes:
      - config:/etc/gitlab-runner
    command:
      - register [..args..]
  runner:
    restart: always
    image: gitlab/gitlab-runner:latest
    depends_on:
      register:
        condition: service_completed_successfully
    volumes:
      - config:/etc/gitlab-runner
      - /var/run/docker.sock:/var/run/docker.sock
    
volumes:
  config:

The host that I want to run this on cannot reach the gitlab instance, and therefor the register command fails (which is expected behavior).

@tamarahenson
Copy link

@a-gerhard

Thank you for the information. I am going to further investigate and work on reproducing. I will update you as I learn more.

Thanks!

@fgierlinger
Copy link

@tamarahenson This issue persists in portainer-ce 2.16.2 . As soon as a variable is named "HTTPS_PROXY" the deployment/update of an environment fails with the following error

error during connect: Get "https://tasks.agent:9001/v1.24/info": proxyconnect tcp: dial tcp: lookup proxy.example.com on 127.0.0.11:53: no such host

This error only happens when defining Environment variables with the portainer UI. To trigger the error above, I used a minimal docker-compose

version: "3"
services:
  test:
    image: "alpine:latest"

and set the following environment variable in the UI: HTTPS_PROXY=proxy.example.com .

@tamarahenson
Copy link

@fgierlinger

Upon release of 2.17.1 and upgrade, can you please provide feedback?

Thanks!

@fgierlinger
Copy link

@tamarahenson The error persists after the upgrade to 2.17.1

@tamarahenson
Copy link

@a-gerhard

I wanted to follow up on this request. Have you tested this in later versions of Portainer? If anything in the Stack fails, Portainer does a clean-up and removes everything in the Stack.

Thanks!

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

No branches or pull requests

3 participants