Commit Graph

88 Commits

Author SHA1 Message Date
Tortue Torche
0406b36020 Change version to 0.2.0-alpha.4 2020-01-17 12:56:01 +00:00
Tortue Torche
8413e5148f Add parallel requests TODO 2020-01-17 12:56:01 +00:00
Tortue Torche
b39f017d00 Update help for --timeout flag 2020-01-17 12:56:01 +00:00
Tortue Torche
867357401c Reorder flags in help 2020-01-17 12:56:01 +00:00
Tortue Torche
d3fe9898cf Reduce help margin 2020-01-17 12:56:01 +00:00
Tortue Torche
31947b4702 Add the "actions" action
To list the available actions of psu
2020-01-17 12:56:01 +00:00
Tortue Torche
7dd1c16a8d Rename tasks_healthy to tasks:healthy 2020-01-17 12:56:01 +00:00
Tortue Torche
85ccf0c94b Change version to 0.2.0-alpha.2 2020-01-17 12:56:01 +00:00
Tortue Torche
7f94f8b5da Cleaner way to handle special actions 'help' and 'version' 2020-01-17 12:56:01 +00:00
Tortue Torche
3b6a8bf7e6 Fix a comment 2020-01-17 12:56:01 +00:00
Tortue Torche
0ae5f96a4e Fix version 2020-01-17 12:56:01 +00:00
Tortue Torche
63c5a727b8 Remove commented code 2020-01-17 12:56:01 +00:00
Tortue Torche
4dbe06e99d Add containers action
It prints the containers of a stack (or specific
service, if the `--service=service_name` option is set)
2020-01-17 12:56:01 +00:00
Tortue Torche
53f4bde4eb Change VERSION to "0.2.0-alpha1" 2020-01-17 12:56:01 +00:00
Tortue Torche
540d3678b0 Change VERSION to "0.2.0-alpha" to follow Semantic Versioning 2.0.0
See https://semver.org/spec/v2.0.0.html
2020-01-17 12:56:01 +00:00
Tortue Torche
7e20c52b6e Several changes
- Add "list" action to print all stacks.
- Add "info" action to print information about a stack.
- Add "services" action to print a list of stack services.
- Add "tasks" action to print a list of stack service tasks.
- Add "PORTAINER_SERVICE_NAME" environment variable (string) to specify which stack service tasks wil be printed.
- Add "-S, --service" flag (string) to specify which stack service tasks wil be printed.
- Add "tasks_healthy" action. Like "tasks", but only prints **healthy** stack service tasks.
- Add "status" action to print stack tasks statuses.
- Add "AUTO_DETECT_JOB" environment variable (true|false) to autodetect services which are jobs.
- Add "-j, --detect-job" flag (true|false) to autodetect services which are jobs.
- Add quiet mode to limit output to the minimal.
  - In "list", "info", "services" actions shows only stack/service name.
  - In "tasks", "tasks_healthy" actions shows only task name.
- Add "QUIET_MODE" environment variable (true|false) to enable/disable quiet mode.
- Add "-q, --quiet" flag (true|false) to enable/disable quiet mode.
- Add "ROLLOUT_STATUS_TIMEOUT" environment variable to set a maximum waiting time for requests.
- Add "-T, --timeout" flag to set a maximum waiting time for requests.
- Add "-i, --insecure" flag (bool) to replace "-s, --secure" flag.
- Add "version" action to print script version.
- Add "-V, --version" flag (bool) to print script version.
- Add "help" action to print script usage.
- Add "--action", "--secure", "--strict", "--debug", "--verbose", "--prune", "--endpoint", "--env-file", "--compose-file", "--name", "--url", "--password" and "--user" long name version flags for existing "-a", "-s", "-t", "-d", "-v", "-r", "-e", "-g", "-c", "-n", "-l", "-p" and "-u" flags.
- Add argument to specify the action to execute without the need to use the "-a, --action" flag.
2020-01-17 12:56:01 +00:00
Juan Carlos Mejías Rodríguez
2d14c6d1a5
Merge pull request #33 from openmindlab/1-0-next
improve and simplifying quotes excape
2019-10-29 14:37:16 -04:00
Vincenzo Cerbone
0c4167bbf4 improve and simplifying quotes excape 2019-10-19 15:23:39 +02:00
Juan Carlos Mejías Rodríguez
c18ee4ae1b Add Docker images documentation
Fixes #9
2019-07-21 19:17:52 -04:00
Juan Carlos Mejías Rodríguez
acba31c9b0 Fix typo in supported API version's documentation 2019-07-21 19:17:26 -04:00
Juan Carlos Mejías Rodríguez
74d35b765e
Update changelog 2019-06-05 11:01:01 -07:00
Juan Carlos Mejías Rodríguez
e9caa803b6
Merge pull request #14 from tortuetorche/patch-2
Fix environment variables who contains spaces in their value
2019-06-05 10:50:32 -07:00
Tortue Torche
e386126466
Use the realpath of the env file to be able to source it
Without this commit:
This command works correctly:
psu -a deploy -u admin -p password -l http://portainer.local -n mystack -c /path/to/docker-compose.yml -g ./env_vars

But this command doesn't work correctly:
psu -a deploy -u admin -p password -l http://portainer.local -n mystack -c /path/to/docker-compose.yml -g env_vars
2019-05-29 10:25:33 +02:00
Tortue Torche
0828e59bc7
Fix environment variables who contains spaces in their value
If you have a `.env` file with some environment variables who contains spaces, like this:

DB_INITIALIZE="cd /app && RAILS_ENV=production bin/setup"
DB_MIGRATE="cd /app && RAILS_ENV=production bin/update"
2019-05-29 09:57:10 +02:00
–Juan Carlos Mejías Rodríguez
79d3b5e775 Add changelog 2019-05-24 04:09:04 -07:00
Juan Carlos Mejías Rodríguez
d90eb42ab5
Merge pull request #8 from tortuetorche/patch-1
Add custom stack environment variables
2019-05-10 20:42:30 -07:00
Juan Carlos Mejías Rodríguez
a692212a9f
Add Dockerfile ENV for stack environment variables 2019-05-10 20:39:15 -07:00
Juan Carlos Mejías Rodríguez
a47e653fae
Add documentation for stack environment variables 2019-05-10 20:32:32 -07:00
Juan Carlos Mejías Rodríguez
b0b59385f1
Make new_stack_envvars local 2019-05-10 20:02:07 -07:00
Tortue Torche
7c5e9e9b57
Add custom stack environment variables
Prior to this pull request `psu` script act like this:
Stack env vars are set in the `deploy()` function. When a new stack is deployed it gets no env vars, and when an existing one is updated its envvars are reused (extracted from its stack definition into the stack_envvars variable and set back again).

For the first case this pull request load the content of the env vars file and transform it into JSON using a `jq` command and set it as the `stack_envvars` value.
For the second case, though, the script update the current stack env vars rather than setting them from scratch, keeping any value not previously set in the env file.

The environment variables file path is customizable with the environment variable `$ENVIRONMENT_VARIABLES_FILE` or the `-g` flag, like this:
```bash
export ACTION="deploy"
export PORTAINER_USER="admin"
export PORTAINER_PASSWORD="password"
export PORTAINER_URL="http://portainer.local"
export PORTAINER_STACK_NAME="mystack"
export DOCKER_COMPOSE_FILE="/path/to/docker-compose.yml"
export ENVIRONMENT_VARIABLES_FILE="/path/to/env_vars_file"

./psu
```

Or with flags:
```bash
./psu -a deploy -u admin -p password -l http://portainer.local -n mystack -c /path/to/docker-compose.yml -g /path/to/env_vars_file
```

close #7
2019-05-10 16:33:49 +02:00
Juan Carlos Mejías Rodríguez
e446fb6b1c
Fix relative links in docs 2018-12-29 10:44:59 -08:00
Juan Carlos Mejías Rodríguez
41fb0f2256 Change Docker entrypoint to /usr/local/bin/psu 2018-11-26 19:24:14 -05:00
Juan Carlos Mejías Rodríguez
14c0e97d85
Add "How to install" section to docs 2018-11-26 14:40:50 -05:00
Juan Carlos Mejías Rodríguez
8a8020d013 Quote usages of $@ 2018-11-26 00:39:43 -05:00
Juan Carlos Mejías Rodríguez
09500d1697 Fix Dockerfile envvar declaration 2018-11-26 00:20:04 -05:00
Juan Carlos Mejías Rodríguez
3d8748d26c Move check_for_errors calls before echo_debug calls 2018-11-26 00:02:06 -05:00
Juan Carlos Mejías Rodríguez
3864db4c2a Separate local variables declaration and assignment for command substitutions 2018-11-26 00:02:03 -05:00
Juan Carlos Mejías Rodríguez
52379ef2f2 Add colored output 2018-11-25 23:43:10 -05:00
Juan Carlos Mejías Rodríguez
49cc138a14 Replace && with newlines 2018-11-25 22:47:01 -05:00
Juan Carlos Mejías Rodríguez
d821155f6b Enhance main function comments 2018-11-25 22:47:01 -05:00
Juan Carlos Mejías Rodríguez
ad040ff9a3 Move initial globals setting to a function 2018-11-25 22:31:34 -05:00
Juan Carlos Mejías Rodríguez
79f461535d Update function comments 2018-11-25 22:11:03 -05:00
Juan Carlos Mejías Rodríguez
4ca1ab72c6 Rename err function to echo_error 2018-11-25 22:06:03 -05:00
Juan Carlos Mejías Rodríguez
76caefc30b Add strict mode value to initial debug echoes 2018-11-25 22:02:56 -05:00
Juan Carlos Mejías Rodríguez
e224207e31 Change some global variables to local 2018-11-25 21:58:57 -05:00
Juan Carlos Mejías Rodríguez
45c6f1101d Update strict mode docs 2018-11-25 21:19:56 -05:00
Juan Carlos Mejías Rodríguez
bf089d1bfd Fix broken markdown link in readme 2018-11-25 21:18:12 -05:00
Juan Carlos Mejías Rodríguez
a8d57bf268 Remove space between function names and parethesis 2018-11-25 13:57:29 -05:00
Juan Carlos Mejías Rodríguez
7715832325 Add main function 2018-11-25 13:54:51 -05:00
Juan Carlos Mejías Rodríguez
2be6d03efd Add unexpected options handling 2018-11-25 13:43:09 -05:00