From 18e344047f7caf9c0c6b088fa1b8e308ff039910 Mon Sep 17 00:00:00 2001 From: Michael Priest Date: Thu, 5 Apr 2018 11:16:33 +0930 Subject: [PATCH] Adds nginx-proxy config file to support large file uploads (#26) * Allow uploads bigger than 1M - also lets projects customise their nginx config. * Volumes must be full path, not relative. Nicer comment. * Break up connect the web container to the nginx-proxy. Start nginx-proxy first to allow running setup command from the scaffold. * Doh, wrong brackets. Exec, not variable. --- dsh | 7 ++++++- dsh_proxy.conf | 1 + src/Handler.php | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 dsh_proxy.conf diff --git a/dsh b/dsh index d826736..0335fbb 100755 --- a/dsh +++ b/dsh @@ -161,8 +161,9 @@ setup() { fi setup_ssh_agent_proxy fi - setup_docker_network setup_nginx_proxy + setup_docker_network + setup_nginx_connect } setup_docker_machine() { @@ -231,8 +232,10 @@ setup_nginx_proxy() { if docker ps -a | grep "nginx-proxy" > /dev/null; then docker start nginx-proxy > /dev/null else + # Configuration is only applied when the container is created. docker run -d -p 80:80 \ -v /var/run/docker.sock:/tmp/docker.sock:ro \ + -v /etc/nginx/conf.d/dsh_proxy.conf:$(pwd)/dsh_proxy.conf \ --restart always --name nginx-proxy \ jwilder/nginx-proxy fi @@ -240,7 +243,9 @@ setup_nginx_proxy() { if ! docker ps | grep "nginx-proxy" > /dev/null; then error "jwilder/nginx-proxy could not be started." fi +} +setup_nginx_connect() { set +e # Test to make sure its not already on the network. if ! docker network inspect ${PROJECT}_default | grep "nginx-proxy" > /dev/null; then diff --git a/dsh_proxy.conf b/dsh_proxy.conf new file mode 100644 index 0000000..86bda51 --- /dev/null +++ b/dsh_proxy.conf @@ -0,0 +1 @@ +client_max_body_size 100m; diff --git a/src/Handler.php b/src/Handler.php index 36ca801..803905e 100644 --- a/src/Handler.php +++ b/src/Handler.php @@ -81,6 +81,7 @@ public function updateShepherdScaffoldFiles() $projectPath, [ 'docker-compose.yml', + 'dsh_proxy.conf', 'RoboFile.php', ] );