Git Product home page Git Product logo

Comments (7)

tortuetorche avatar tortuetorche commented on June 30, 2024

Hi @kapik, can you replace single quote ', with double quote " in your docker-compose file?

from portainer-stack-utils.

kapik avatar kapik commented on June 30, 2024

Hey @tortuetorche ,
Same issue with double quote.

from portainer-stack-utils.

greenled avatar greenled commented on June 30, 2024

Hi @kapik. Please, could you provide some details about the execution environment, like the portainer-stack-utils script version and wether you are running the script from the Docker image or in your own bash interpreter? This would help to reproduce the error.

I tried to deploy your docker-compose file (using nginx:alpine as the image) against a Portainer 1.20.1 instance using the Docker image (bash 4.4) and I got a different error about the compose file version. After changing version: '2' to version: '3' it deployed sucessfully. But no substitution error 🤔

from portainer-stack-utils.

kapik avatar kapik commented on June 30, 2024

Hi @greenled,

I'm using the last version of portainer-stack-utils (clone this week).
I use it on my laptop: macOS Mojave via my terminal (zsh).

I have the same error with version: '3' of my compose file version.
And I use Portainer 1.20.1.

I have ran the script with DEBUG=true :

ACTION -> deploy
PORTAINER_USER -> MYUSER
PORTAINER_PASSWORD -> MYPWD
PORTAINER_URL -> http://XX.XX.XX.XX:XXXX
PORTAINER_STACK_NAME -> MyStack
DOCKER_COMPOSE_FILE -> docker-compose.yml
ENVIRONMENT_VARIABLES_FILE -> 
PORTAINER_ENDPOINT -> 1
PORTAINER_PRUNE -> false
HTTPIE_VERIFY_SSL -> yes
VERBOSE_MODE -> false
DEBUG_MODE -> true
STRICT_MODE -> false
Get auth token response -> {
  "jwt": "MYTOKEN"
}
Auth token -> MYTOKEN
Get stacks response -> [
  {
    "Id": 2,
    "Name": "MyStack",
    "Type": 1,
    "EndpointId": 1,
    "SwarmId": "xxxxxx",
    "EntryPoint": "docker-compose.yml",
    "Env": [],
    "ProjectPath": "/data/compose/2",
    "ResourceControl": {
      "Id": 0,
      "ResourceId": "",
      "SubResourceIds": null,
      "Type": 0,
      "UserAccesses": null,
      "TeamAccesses": null,
      "Public": false
    }
  }
]
Stack MyStack -> {
  "Id": 2,
  "Name": "MyStack",
  "Type": 1,
  "EndpointId": 1,
  "SwarmId": "xxxxxx",
  "EntryPoint": "docker-compose.yml",
  "Env": [],
  "ProjectPath": "/data/compose/2",
  "ResourceControl": {
    "Id": 0,
    "ResourceId": "",
    "SubResourceIds": null,
    "Type": 0,
    "UserAccesses": null,
    "TeamAccesses": null,
    "Public": false
  }
}
./psu: line 290: bad substitution: no closing `}' in "${docker_compose_file_content//"/'\"'}"

from portainer-stack-utils.

greenled avatar greenled commented on June 30, 2024

There you have it: zsh. I have not tested the script with zsh before, only bash. From the zsh documentation and this stack overflow question I see there are some diferences in the way parameter expansion works on both interpreters. I will investigate further.

Meanwhile, you could install bash or use the docker image. In the second case, the image is set to run the script as the entry point so it could be as simple as:

docker run -v /path/to/docker-compose.yml:/path/to/docker-compose.yml greenled/portainer-stack-utils:latest -a deploy -c /path/to/docker-compose.yml ...

from portainer-stack-utils.

greenled avatar greenled commented on June 30, 2024

@kapik would you prefer an executable binary made for your particular platform instead of a bash script? It would have zero dependencies (no bash, no jq, no httpie). It would "just work". I'm playing with the idea of reimplementing the tool in Go.

from portainer-stack-utils.

greenled avatar greenled commented on June 30, 2024

@kapik check out v2.0.0-alpha.2 release. It comes with binaries compiled for several platforms, macOS included. Beware it's still in an alpha stage, but it's stable enough to play around.

Will close this issue, as future v2.x releases will be on a similar fashion.

from portainer-stack-utils.

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.