项目作者: flweber

项目描述 :
This tool can be used to update a stack via the portainer project.
高级语言: JavaScript
项目地址: git://github.com/flweber/portainer-stack-updater.git
创建时间: 2019-07-26T12:30:04Z
项目社区:https://github.com/flweber/portainer-stack-updater

开源协议:MIT License

下载


Build Status npm (tag) npm GitHub issues Libraries.io dependency status for GitHub repo npm GitHub license

Portainer Update

This tool can be used to update a stack via the portainer project.

Feature list

  • [X] Update existing stacks
  • [X] Read a docker-compose file from file system
  • [X] Make tool available through npx
  • [X] Deploy new stacks
  • [X] Command line tool

    Usage

==Attention: Portainer only supports compose file version 2 at the moment==

Example Usage

As package

  1. const { Auth, Deploy, Update, GetStackByName } = require('portainer-update');
  2. const url = "http://localhost:9000/api";
  3. Auth("username", "password", url)
  4. .then(async (response) => {
  5. const stacks = [];
  6. const stackid = await GetStackByName(response.jwt, url, "stackname");
  7. // JsonWebToken, Portainer api url, id of stack which should be updated,
  8. // endpoint id, docker compose as string
  9. stacks.push(await Update(response.jwt, url, stackid, 1, "compose string"));
  10. // JsonWebToken, Portainer api url, name of the new stack which will be deployed,
  11. // endpoint id, docker compose as string
  12. stacks.push(await Deploy(response.jwt, url, "stackname", 1, "compose string"));
  13. console.info(JSON.stringify(stacks));
  14. });

In Terminal

  1. npx portainer-update -p <Stackname> -u <Portainer Username> --password <Portainer Password> -f <Path to docker compose> -s <Portainer URL>

Parameters

Parameter Name Description Required
-h \ —help Help Show this parameter table
-e \ —env Envrionment At the moment this parameter has no effect
-p \ —project Stackname The name of the stack you want to update X
-u \ —user Portainer Username The username of the user which will update the stack ==The user need the permission to edit the stack== X
—password Portainer Password This tool is for use in CiCD pipelines so please provide the password as a secret variable X
-f \ —compose Path to compose Fill in the path to the compose file, which you want to deploy X
-s \ —portainersystem Portainer API URL The address where to find portainer API (The url you are browsing to in your browser) Default value: http://localhost:9000
—endpoint Endpoint ID The id of the endpoint where the stack should be deployed Default value: 1