Git Product home page Git Product logo

portainer-stack-updater's Introduction

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

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

Usage

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

Example Usage

As package

const { Auth, Deploy, Update, GetStackByName } = require('portainer-update');
const url = "http://localhost:9000/api";

Auth("username", "password", url)
	.then(async (response) => {
		const stacks = [];
		
		const stackid = await GetStackByName(response.jwt, url, "stackname");
		
		// JsonWebToken, Portainer api url, id of stack which should be updated, 
		// endpoint id, docker compose as string
		stacks.push(await Update(response.jwt, url, stackid, 1, "compose string"));

		// JsonWebToken, Portainer api url, name of the new stack which will be deployed, 
		// endpoint id, docker compose as string
		stacks.push(await Deploy(response.jwt, url, "stackname", 1, "compose string"));
		console.info(JSON.stringify(stacks));
	});

In Terminal

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

portainer-stack-updater's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar flweber avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Forkers

aniwei egzotech

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.