nginx vhosts as a plugin?
This commit is contained in:
@@ -6,12 +6,7 @@ set -e; case "$1" in
|
||||
;;
|
||||
|
||||
url)
|
||||
echo "http://$(< "/home/git/$2/HOSTNAME")"
|
||||
;;
|
||||
|
||||
test)
|
||||
echo "Hello"
|
||||
echo $2 $3 $4
|
||||
echo "http://$(< "/home/git/$2/ADDRESS")"
|
||||
;;
|
||||
|
||||
esac
|
||||
8
plugins/nginx-vhosts/commands
Executable file
8
plugins/nginx-vhosts/commands
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/bash
|
||||
set -e; case "$1" in
|
||||
|
||||
url)
|
||||
echo "http://$(< "/home/git/$2/VHOST")"
|
||||
;;
|
||||
|
||||
esac
|
||||
17
plugins/nginx-vhosts/post-deploy
Executable file
17
plugins/nginx-vhosts/post-deploy
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
APP="$1"; PORT="$2"
|
||||
|
||||
if [[ -f "$HOME/VHOST" ]]; then
|
||||
hostname="${APP/\//-}.$(< "$HOME/VHOST")"
|
||||
cat<<EOF > $HOME/$APP/nginx.conf
|
||||
upstream $APP { server 127.0.0.1:$PORT; }
|
||||
server {
|
||||
listen 80;
|
||||
server_name $hostname;
|
||||
location / { proxy_pass http://$APP; }
|
||||
}
|
||||
EOF
|
||||
nc -U $HOME/reload-nginx
|
||||
echo "$hostname" > "$HOME/$APP/VHOST"
|
||||
fi
|
||||
Reference in New Issue
Block a user