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

Template type #104

Closed
martadinata666 opened this issue Nov 1, 2021 · 1 comment
Closed

Template type #104

martadinata666 opened this issue Nov 1, 2021 · 1 comment

Comments

@martadinata666
Copy link
Contributor

martadinata666 commented Nov 1, 2021

As taken Portainer templating guide , there is two type of template need consider for.

  • "type:" 2
  • "type:" 3

Both of them valid but got different function.
Valid values: "1" = container; "2" = Swarm stack; "3" = Compose stack
Other information: Type "3" is limited to using the version "2" stack format (this is a docker/libcompose limitation).

As template encourage to use "type": 3 than mean the stack need overhaul, every existed stack yml file will renamed to docker-compose.yml , version: "2" at the top, and separate folder each.

Sample
Before

"name": "nginx-proxy-manager",
			"platform": "linux",
			"ports": [
				"80:8080/tcp",
				"81:8181/tcp",
				"443:4443/tcp"
			],
			"env": [
				{
					"default": "password",
					"label": "DATABASE_PASSWORD",
					"name": "DATABASE_PASSWORD"
				},
				{
					"default": "password",
					"label": "MYSQL_ROOT_PASSWORD",
					"name": "MYSQL_ROOT_PASSWORD"
				}
				
			],
			"restart_policy": "unless-stopped",
			"title": "Proxy Ngnix Manager",
			"type": 3,
			"repository": {
				"stackfile": "pi-hosted_template/stack/nginx-proxy-manager.yml",
				"url": "https://github.com/novaspirit/pi-hosted"
			}
		},		

This will not listed in web gui. As "type": 3 looking for docker-compose.yml but if set as "type": 2 this will listed at web gui because swarm type can use custom name.
Solution if gonna use "type": 3 consistently is separate each stack to separte folder such as:

  • stack/nginx-proxy-manager/docker-compose.yml
  • stack/raspberry-pi-monitor/docker-compose.yml
    And update template json accordingly.

Also the stack yml file need to change from version 3 to version 2


version: "3.8"
services:
  wg-easy:
    environment:
      # ⚠️ Required:
      # Change this to your host's public address
      - WG_HOST=raspberrypi.local

      # Optional:
      - PASSWORD=foobar123
      - WG_PORT=51820
      - WG_DEFAULT_ADDRESS=10.8.0.x
      - WG_DEFAULT_DNS=1.1.1.1
      - WG_ALLOWED_IPS=192.168.15.0/24, 10.0.1.0/24
 

to


version: "2"
services:
  wg-easy:
    environment:
      # ⚠️ Required:
      # Change this to your host's public address
      - WG_HOST=raspberrypi.local

      # Optional:
      - PASSWORD=foobar123
      - WG_PORT=51820
      - WG_DEFAULT_ADDRESS=10.8.0.x
      - WG_DEFAULT_DNS=1.1.1.1
      - WG_ALLOWED_IPS=192.168.15.0/24, 10.0.1.0/24
      

In simple that is portainer confusion naming type,

compose ver 2 is the old one and portainer called "type": 3 for standlone stack
compose ver 3 the new one in portainer called "type": 2 for swarm type

refs:

@martadinata666
Copy link
Contributor Author

martadinata666 commented Nov 1, 2021

Separate type needed if want to support swarm mode, as standalone mode not affected by this, closed

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

1 participant