Skip to content

Instantly share code, notes, and snippets.

@ecstasy2
Last active June 23, 2016 07:36
Show Gist options
  • Save ecstasy2/dd659d9e1de16ffa7a9b60cd946f490a to your computer and use it in GitHub Desktop.
Save ecstasy2/dd659d9e1de16ffa7a9b60cd946f490a to your computer and use it in GitHub Desktop.
Used to bootstrap nginx proxy for developer stacks
echo "Download and install configuration"
STACK=`curl -s http://rancher-metadata/latest/self/stack/name`
export STACK
echo "Running in stack $STACK"
curl -L -H 'Cache-Control: no-cache' https://gist.githubusercontent.com/ecstasy2/b03381ca42d1df394decb14582cd8726/raw > /tmp/services.conf
cat /tmp/services.conf | envsubst '$STACK' | tee /etc/nginx/conf.d/services.conf
curl -L -H 'Cache-Control: no-cache' https://gist.githubusercontent.com/ecstasy2/74da089e617f6e9211dd00146054cfb1/raw > /etc/nginx/proxy_params
chown nginx:nginx /etc/nginx/conf.d/services.conf
chown nginx:nginx /etc/nginx/proxy_params
echo "Resulting config"
cat /etc/nginx/conf.d/services.conf
echo "Starting nginx"
nginx -g 'daemon off;'
@ecstasy2
Copy link
Author

We use this script to bootstrap nginx after having downloaded the correct configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment