pressly / sup

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

need new environment variable like $SUP_PATH #99

Open andares opened 7 years ago

andares commented 7 years ago

run sup command:

sup -f sup/elk.yml local install

I need a variable to get path by supfile and find other file with relative path.

andares commented 7 years ago

supfile content:

    kibana2nginx:
        desc: add kibana site conf to nginx
        upload:
            - src: ./elk/kibana.shihou.conf
              dst: /etc/nginx/conf.d/

and file structure is:

- elk.yml
- elk/kibana.shihou.conf

it does not work.

VojtechVitek commented 7 years ago

Oh, this is interesting. By default, the working directory is equivalent to your $PWD (from which you're running sup). Are you ok with $SUPFILE_DIR?

andares commented 7 years ago

Yep, I hope my deploy file can be checkout in everywhere and I can call sup in everywhere. only relative path in deploy files is clearly.

andares commented 7 years ago

I think upload method could be add a param like base, example:

file structure:

- elk.yml
- elk/kibana.shihou.conf

supfile content:

    kibana2nginx:
        desc: add kibana site conf to nginx
        upload:
            - src: kibana.shihou.conf
              dst: /etc/nginx/conf.d/
              base: {$SUPFILE_DIR}/elk/

it will upload kibana.shihou.conf to /etc/nginx/conf.d/kibana.shihou.conf

andares commented 7 years ago

I understand sup is design to called in the directory with Supfile, but these change can improve the versatility, such as substitute for ansible :-P

VojtechVitek commented 6 years ago

@andares sorry for picking this up so late. Did you intend to have $SUP_PATH that would print absolute path of current directory in the host? Or absolute path on the remote host?

andares commented 6 years ago

I think it should be absolute path of supfile(.yml) in the host :-D

VojtechVitek commented 6 years ago

So, something like $SUPFILE_PATH or $SUPFILE_ABSOLUTE_PATH?

Can anyone help me figure this one out? How would we resolve an absolute path from something like ./Supfile or ~/dir/Supfile?

Anyone able to come up with a PR?