diff options
author | kmeister <kris@aliencom.net> | 2017-04-13 16:10:30 -0400 |
---|---|---|
committer | kmeister <kris@aliencom.net> | 2017-04-13 16:10:30 -0400 |
commit | 62a13d5307c50c3241998f6352e96e8ed72d631b (patch) | |
tree | bd8603434f72f7c816b2a62483b7807285596d37 | |
parent | 252b0413b5bd940f6447656a8630c671b50d99c8 (diff) |
[docker-example] nginx fronting ponzu
-rw-r--r-- | examples/docker/README.md | 3 | ||||
-rw-r--r-- | examples/docker/docker-compose.override.yml | 7 | ||||
-rw-r--r-- | examples/docker/docker-compose.yml | 20 | ||||
-rw-r--r-- | examples/docker/web/Dockerfile | 2 | ||||
-rw-r--r-- | examples/docker/web/nginx.conf | 34 | ||||
-rw-r--r-- | examples/docker/web/public/index.html | 1 |
6 files changed, 53 insertions, 14 deletions
diff --git a/examples/docker/README.md b/examples/docker/README.md index 60cb24e..e46009a 100644 --- a/examples/docker/README.md +++ b/examples/docker/README.md @@ -16,7 +16,8 @@ docker-compose build #start the containers in the background docker-compose start -d ``` -Visit the http://localhost:3000/admin/init to configure Ponzu. + +Visit the http://localhost:3000/admin to configure Ponzu. Stop the on containers: ``` diff --git a/examples/docker/docker-compose.override.yml b/examples/docker/docker-compose.override.yml index 9a29242..3bc952b 100644 --- a/examples/docker/docker-compose.override.yml +++ b/examples/docker/docker-compose.override.yml @@ -3,6 +3,7 @@ admin: ports: - "4000:8080" -# web: -# ports: -# - "3000:80"
\ No newline at end of file +web: + ports: + #host will listen on port 3000 in dev + - "3000:80"
\ No newline at end of file diff --git a/examples/docker/docker-compose.yml b/examples/docker/docker-compose.yml index 506f2d2..8c28467 100644 --- a/examples/docker/docker-compose.yml +++ b/examples/docker/docker-compose.yml @@ -14,18 +14,18 @@ admin: command: bash /go/src/project/start_admin.sh start # service configuration for our web server -# web: +web: - # set the build context to web directory -# build: ./web + # use the dockerfile in the web directory + build: ./web - # build with a different Dockerfile -# dockerfile: config/containers/Dockerfile-nginx + volumes: + - ./web/public:/public - # makes the web container aware of the app container -# links: -# - admin + # makes the web container aware of the admin container + links: + - admin # expose the port we configured Nginx to bind to -## ports: -# - "80:80" + ports: + - "80:80" diff --git a/examples/docker/web/Dockerfile b/examples/docker/web/Dockerfile new file mode 100644 index 0000000..57845aa --- /dev/null +++ b/examples/docker/web/Dockerfile @@ -0,0 +1,2 @@ +FROM nginx +COPY nginx.conf /etc/nginx/conf.d/default.conf
\ No newline at end of file diff --git a/examples/docker/web/nginx.conf b/examples/docker/web/nginx.conf new file mode 100644 index 0000000..9606fc5 --- /dev/null +++ b/examples/docker/web/nginx.conf @@ -0,0 +1,34 @@ +upstream ponzu { + server admin:8080; +} + +server { + + listen 80 default_server; + listen [::]:80 default_server ipv6only=on; + + root /public; + index index.html index.htm; + + location ~ /api(.*)$ { + try_files $uri @ponzu; + } + + location ~ /admin(.*)$ { + try_files $uri @ponzu; + } + + location / { + # First attempt to serve request as file, then + # as directory, then fall back to displaying a 404. + try_files $uri $uri/ /index.html; + } + + location @ponzu { + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header Host $http_host; + proxy_redirect off; + proxy_pass http://ponzu; + } +}
\ No newline at end of file diff --git a/examples/docker/web/public/index.html b/examples/docker/web/public/index.html new file mode 100644 index 0000000..def7e82 --- /dev/null +++ b/examples/docker/web/public/index.html @@ -0,0 +1 @@ +<h1>Hi there</h1>
\ No newline at end of file |