Giter Site home page Giter Site logo

Comments (3)

flololan avatar flololan commented on June 15, 2024

Also posted here: https://forums.portainer.io/t/templates-when-using-traefik/464

from templates.

deviantony avatar deviantony commented on June 15, 2024

Hi @flololan

If I understand correctly then the "traefik.http.routers.${NAMEOFSERVICE}.rule=Host(${HOSTNAME})" is located inside the helloworld.yml ?

Everything defined in the env property of the template will be passed to the environment (via export) when deploying a stack file, you'll want to make sure your setup works properly with the CLI first.

Something like:

export HOSTNAME=value1
export NAMEOFSERVICE=value2
docker stack deploy -c helloworld.yaml stackname

If this does not work with the CLI, Portainer won't support it as it is using the CLI behind the scenes for stack deployment.

from templates.

flololan avatar flololan commented on June 15, 2024

Thanks for that!

I tried exactly that and while the service/stack started without issue, it seems that Traefik couldn't route properly to it. Logs showed something like:

Router defined multiple times with different configurations

Solution

Instead of (in helloworld.yml)
traefik.http.routers.${NAMEOFSERVICE}.rule=Host(`${HOSTNAME}`)
I had to add something like "helloworld-"bevore the variable.
traefik.http.routers.helloworld-${NAMEOFSERVICE}.rule=Host(`${HOSTNAME}`)

With this change the field NAMEOFSERVICE is being shown in the Templates-UI and the services/stacks run without any issues (so far).

from templates.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.