by hook or crook
This is the holy trinity, the code equivalent of the love triangle. you push the code changes to Github, which triggers a webhook, that in turn executes a CURL and delivers a POST payload to your server. On the server you check they payload and if it is secure it then fires an event to run a bash command. That shell script will pull the updates from the repo, and rebuild the static site, with an NPM run command.
That is all well and good, here is the snag that trapped me. Execute permissions, and PHPs silent failure to execute
npm commands. After almost two hours on stackoverflow and google at large i discovered that the PHP command
was not getting my shell variables, so it did not have a
PATH to the binaries.
To solve this you SSH onto your machine and systematically run
That will tell you where the binies are when the shell is complete. When you ssh into a machine it creates your
shell by running the bashrc and other server specific session stuff. So for example:
which npm /usr/local/bin/npm
With the output value you add it to the shell script as a viarble called
PATH so that when PHP runs the script the path to
the binary is defined, and it is done without the overhead of
source to your profile.