pressly / sup

Super simple deployment tool - think of it like 'make' for a network of servers
https://pressly.github.io/sup
MIT License
2.49k stars 177 forks source link

$SUP_ENV #78

Closed VojtechVitek closed 8 years ago

AmitKumarDas commented 8 years ago

Hi @VojtechVitek,

I had a query if below output pattern is expected.

1/ My sample Supfile snippet:

  envlist:
    desc: Get the environment variables provided at runtime
    run: echo $SUP_ENV

2/ Command execution & respective output:

sup -f /etc/openebs/test.conf -e file=sample.txt -e filter2=pattern local envlist
root@localhost | file=sample.txt -e filter2=pattern

sup -f /etc/openebs/test.conf -e file=sample.txt -e filter2=pattern -D local envlist
root@localhost | + echo -e file=sample.txt -e filter2=pattern
root@localhost | file=sample.txt -e filter2=pattern

Query - Do we expect the -e in the output ? I understand -e is an option for echo command. However, I am still trying to understand the use-case for $SUP_ENV here ? Will --file=sample.txt --filter2=pattern be a better output of $SUP_ENV ?

VojtechVitek commented 8 years ago

Hi @AmitKumarDas, $SUP_ENV is not meant just for echo program.

It is mainly meant for passing the CLI environment variables to another sup or docker command from your Supfile.

1) Docker

 run:
    desc: Docker run on remote machine
    run: >
      docker run $SUP_ENV ubuntu bash -c 'echo This is MY_VAR: $MY_VAR'
$ sup local run
vojtechvitek@localhost | This is MY_VAR:

$ sup -e MY_VAR=my_value local run
vojtechvitek@localhost | This is MY_VAR: my_value

2) Sup calling another Supfile

 db-up:
    desc: Migrate database
    run: >
      sup -f ./database/Supfile $SUP_ENV $SUP_NETWORK up
$ sup -e PGCONNECT_TIMEOUT=10 production db-up
vojtechvitek@localhost | production@example.com | Migrating database..