Build nginx image
authorLorin Hochstein <lhochstein@netflix.com>
Sun, 5 Feb 2017 03:19:12 +0000 (19:19 -0800)
committerLorin Hochstein <lhochstein@netflix.com>
Sun, 5 Feb 2017 03:19:12 +0000 (19:19 -0800)
ch13/Makefile
ch13/ansible.cfg [new file with mode: 0644]
ch13/ghost.yml [new file with mode: 0644]
ch13/inventory [new file with mode: 0644]
ch13/nginx/Dockerfile
ch13/nginx/ghost.conf [new file with mode: 0644]

index 4c88fe9..b619d9a 100644 (file)
@@ -1,4 +1,7 @@
-.PHONY: build start run stop clean
+.PHONY: start
+
+start:
+       ansible-playbook ghost.yml
 
 # Generate self-signed certs for localhost
 ssl: certs/nginx.crt certs/nginx.key
diff --git a/ch13/ansible.cfg b/ch13/ansible.cfg
new file mode 100644 (file)
index 0000000..f8fc6cd
--- /dev/null
@@ -0,0 +1,2 @@
+[defaults]
+inventory = inventory
diff --git a/ch13/ghost.yml b/ch13/ghost.yml
new file mode 100644 (file)
index 0000000..db2ef64
--- /dev/null
@@ -0,0 +1,9 @@
+---
+- name: Run Ghost locally
+  hosts: localhost
+  gather_facts: False
+  tasks:
+    - name: create Nginx image
+      docker_image:
+        name: ch13-nginx
+        path: nginx
diff --git a/ch13/inventory b/ch13/inventory
new file mode 100644 (file)
index 0000000..e69de29
index 5c03486..cc6ed32 100644 (file)
@@ -1,6 +1,3 @@
 FROM nginx
 RUN rm /etc/nginx/conf.d/default.conf
-RUN rm /etc/nginx/conf.d/examplessl.conf
 COPY ghost.conf /etc/nginx/conf.d/ghost.conf
-
-
diff --git a/ch13/nginx/ghost.conf b/ch13/nginx/ghost.conf
new file mode 100644 (file)
index 0000000..e3cf4b5
--- /dev/null
@@ -0,0 +1,30 @@
+upstream ghost {
+    server ghost:2368;
+}
+
+server {
+
+    listen 80;
+
+    listen 443 ssl;
+
+    client_max_body_size 10M;
+    keepalive_timeout    15;
+
+    ssl_certificate      /certs/nginx.crt;
+    ssl_certificate_key  /certs/nginx.key;
+    ssl_session_cache    shared:SSL:10m;
+    ssl_session_timeout  10m;
+    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!3DES:!MD5:!PSK;
+    ssl_prefer_server_ciphers on;
+
+    location / {
+        proxy_redirect      off;
+        proxy_set_header    Host                    $host;
+        proxy_set_header    X-Real-IP               $remote_addr;
+        proxy_set_header    X-Forwarded-For         $proxy_add_x_forwarded_for;
+        proxy_set_header    X-Forwarded-Protocol    $scheme;
+        proxy_pass          http://ghost;
+    }
+}
+