Commit Graph

67 Commits

Author SHA1 Message Date
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
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
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
79d3b5e775 Add changelog 0.1.0 v0.1.0 2019-05-24 04:09:04 -07:00
d90eb42ab5 Merge pull request #8 from tortuetorche/patch-1
Add custom stack environment variables
2019-05-10 20:42:30 -07:00
a692212a9f Add Dockerfile ENV for stack environment variables 2019-05-10 20:39:15 -07:00
a47e653fae Add documentation for stack environment variables 2019-05-10 20:32:32 -07:00
b0b59385f1 Make new_stack_envvars local 2019-05-10 20:02:07 -07:00
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
e446fb6b1c Fix relative links in docs 2018-12-29 10:44:59 -08:00
41fb0f2256 Change Docker entrypoint to /usr/local/bin/psu 2018-11-26 19:24:14 -05:00
14c0e97d85 Add "How to install" section to docs 2018-11-26 14:40:50 -05:00
8a8020d013 Quote usages of $@ 2018-11-26 00:39:43 -05:00
09500d1697 Fix Dockerfile envvar declaration 2018-11-26 00:20:04 -05:00
3d8748d26c Move check_for_errors calls before echo_debug calls 2018-11-26 00:02:06 -05:00
3864db4c2a Separate local variables declaration and assignment for command substitutions 2018-11-26 00:02:03 -05:00
52379ef2f2 Add colored output 2018-11-25 23:43:10 -05:00
49cc138a14 Replace && with newlines 2018-11-25 22:47:01 -05:00
d821155f6b Enhance main function comments 2018-11-25 22:47:01 -05:00
ad040ff9a3 Move initial globals setting to a function 2018-11-25 22:31:34 -05:00
79f461535d Update function comments 2018-11-25 22:11:03 -05:00
4ca1ab72c6 Rename err function to echo_error 2018-11-25 22:06:03 -05:00
76caefc30b Add strict mode value to initial debug echoes 2018-11-25 22:02:56 -05:00
e224207e31 Change some global variables to local 2018-11-25 21:58:57 -05:00
45c6f1101d Update strict mode docs 2018-11-25 21:19:56 -05:00
bf089d1bfd Fix broken markdown link in readme 2018-11-25 21:18:12 -05:00
a8d57bf268 Remove space between function names and parethesis 2018-11-25 13:57:29 -05:00
7715832325 Add main function 2018-11-25 13:54:51 -05:00
2be6d03efd Add unexpected options handling 2018-11-25 13:43:09 -05:00
fe9e73c41e Improve code comments 2018-11-25 13:29:47 -05:00
c82b81b313 Add function to print error messages to stderr 2018-11-25 13:15:25 -05:00
14039d9fe4 Redirected error messages to stderr 2018-11-25 13:09:06 -05:00
96ef7b19fa Add verbose mode docs 2018-11-25 12:52:58 -05:00
64012237e7 Update debug mode docs 2018-11-25 12:52:58 -05:00
f2b1a4bd15 Add strict mode 2018-11-25 12:52:58 -05:00
291ef0c616 Remove error exit when undeploying unexistent stak 2018-11-25 12:16:38 -05:00
9433d019f1 Remove "Done"s messages 2018-11-25 11:22:27 -05:00
b44d6b1899 Add some comments and echoes 2018-11-25 11:21:46 -05:00
44c56fa43a Replace STACK_YAML_PATH with DOCKER_COMPOSE_FILE 2018-11-25 11:04:12 -05:00
b87976549c Replace STACK_NAME with PORTAINER_STACK_NAME 2018-11-25 10:56:39 -05:00
a34b8cdca0 Move action check earlier 2018-11-25 10:39:18 -05:00
5ea07b9f60 Add some comments 2018-11-25 10:16:26 -05:00
280f4d792c Remove default user, password and url from Dockerfile envvars 2018-11-24 21:42:24 -05:00
5788f13d4b Add missing envvars in Dockerfile 2018-11-24 21:41:26 -05:00
f1afff6b01 Update readme 2018-11-24 21:03:23 -05:00
677df92bba Update docs for ACTION and -a in readme 2018-11-24 20:51:16 -05:00
d24e356663 Fix script file name in Dockerfile 2018-11-24 18:34:40 -05:00
215e907b56 Fix Dockerfile script COPY 2018-11-24 18:12:30 -05:00
70a99d263b Fix typo 2018-11-24 15:54:10 -05:00
e873d4a9d8 Add debug mode 2018-11-24 15:09:14 -05:00