Comments (3)
Also posted here: https://forums.portainer.io/t/templates-when-using-traefik/464
from templates.
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.
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)
- Stack suggestion: Phabricator with MariaDB
- Add new neo4j template
- git clone of type 2 template on private repository HOT 1
- Use variables in Template
- Introduce a version property for templates
- [edge] - remove trailing commas in edge templates HOT 1
- Edge - template urls are invalid HOT 1
- Does Portainer stack templates support pulling docker-stack.yml from private github repos ? HOT 1
- Custom Template - cap_add not working? HOT 1
- Outdated product logo
- Changing templates URL results no templates at all HOT 1
- Add The Ubuntu and NodeJS Templates
- Self Host App Templates
- Adding more headless cms systems
- Nginx proxy manager template
- fix raw github redirect for json template HOT 1
- Adding wireguard template HOT 2
- Add OPC Router template for Raspberry Pi 4 HOT 2
- Ghost template fails
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from templates.