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
Juan Carlos Mejías Rodríguez
fe9e73c41e
Improve code comments
2018-11-25 13:29:47 -05:00
Juan Carlos Mejías Rodríguez
c82b81b313
Add function to print error messages to stderr
2018-11-25 13:15:25 -05:00
Juan Carlos Mejías Rodríguez
14039d9fe4
Redirected error messages to stderr
2018-11-25 13:09:06 -05:00
Juan Carlos Mejías Rodríguez
96ef7b19fa
Add verbose mode docs
2018-11-25 12:52:58 -05:00
Juan Carlos Mejías Rodríguez
64012237e7
Update debug mode docs
2018-11-25 12:52:58 -05:00
Juan Carlos Mejías Rodríguez
f2b1a4bd15
Add strict mode
2018-11-25 12:52:58 -05:00
Juan Carlos Mejías Rodríguez
291ef0c616
Remove error exit when undeploying unexistent stak
2018-11-25 12:16:38 -05:00
Juan Carlos Mejías Rodríguez
9433d019f1
Remove "Done"s messages
2018-11-25 11:22:27 -05:00
Juan Carlos Mejías Rodríguez
b44d6b1899
Add some comments and echoes
2018-11-25 11:21:46 -05:00
Juan Carlos Mejías Rodríguez
44c56fa43a
Replace STACK_YAML_PATH with DOCKER_COMPOSE_FILE
2018-11-25 11:04:12 -05:00
Juan Carlos Mejías Rodríguez
b87976549c
Replace STACK_NAME with PORTAINER_STACK_NAME
2018-11-25 10:56:39 -05:00
Juan Carlos Mejías Rodríguez
a34b8cdca0
Move action check earlier
2018-11-25 10:39:18 -05:00
Juan Carlos Mejías Rodríguez
5ea07b9f60
Add some comments
2018-11-25 10:16:26 -05:00
Juan Carlos Mejías Rodríguez
280f4d792c
Remove default user, password and url from Dockerfile envvars
2018-11-24 21:42:24 -05:00
Juan Carlos Mejías Rodríguez
5788f13d4b
Add missing envvars in Dockerfile
2018-11-24 21:41:26 -05:00
Juan Carlos Mejías Rodríguez
f1afff6b01
Update readme
2018-11-24 21:03:23 -05:00
Juan Carlos Mejías Rodríguez
677df92bba
Update docs for ACTION and -a in readme
2018-11-24 20:51:16 -05:00
Juan Carlos Mejías Rodríguez
d24e356663
Fix script file name in Dockerfile
2018-11-24 18:34:40 -05:00
Juan Carlos Mejías Rodríguez
215e907b56
Fix Dockerfile script COPY
2018-11-24 18:12:30 -05:00
Juan Carlos Mejías Rodríguez
70a99d263b
Fix typo
2018-11-24 15:54:10 -05:00
Juan Carlos Mejías Rodríguez
e873d4a9d8
Add debug mode
2018-11-24 15:09:14 -05:00
Juan Carlos Mejías Rodríguez
de4150afa6
Add verbose mode
2018-11-24 14:34:07 -05:00
Juan Carlos Mejías Rodríguez
56328eff6c
Fix variable substitution
2018-11-24 14:34:07 -05:00
Juan Carlos Mejías Rodríguez
a35594a668
Update readme with envvars and flags documentation
2018-11-24 14:34:07 -05:00
Juan Carlos Mejías Rodríguez
ba37e1be6c
Merge deploy and undeploy scripts into psu script
2018-11-24 13:36:38 -05:00
Juan Carlos Mejías Rodríguez
3fe1ead303
Add flag options to deployment script with getopts
2018-11-24 13:31:53 -05:00