Git Product home page Git Product logo

nginx-proxy's Introduction

nginx proxy for serving gunicorn etc from Kubernetes

This container provides an nginx service that proxies connections from port 80 to port 8000 on localhost. In addition it also serves the directories /mnt/media and /mnt/static as /media and /static respectively.

The intention is to use this container to serve gunicorn (etc.) from inside a Kubernetes pod.

The nginx-proxy can optionally take a file /etc/secrets/nginx-proxy/htaccess which if it exists will apply HTTP basic auth to the site.

An example Kubernetes/Openshift deployment is here:

kind: DeploymentConfig
apiVersion: v1
spec:
  template:
    spec:
      containers:
       - image: web
         name: web
         volumeMounts:
          - name: static
            mountPath: /mnt/static

       - image: nginx-proxy
         name: nginx-proxy
         volumeMounts:
          - name: static
            mountPath: /mnt/static

          - name: nginx-proxy
            mountPath: /etc/secrets/nginx-proxy

      volumes:
       - name: static
         emptyDir: {}

       - name: nginx-proxy
         secret:
           secretName: nginx-proxy

To deploy your static content into /mnt/static do it when running the app. Expose gunicorn on port 8000.

EXPOSE 8000
CMD cp -rv /app/static/* /mnt/static/ && \
    gunicorn \
        -w 4 \
        -b 0.0.0.0:8000 \
        myapp.wsgi:application

You can create a htpassword file with:

htpasswd -c htacesss <user>
oc secrets new nginx-proxy htaccess=htaccess

Or leave it out with:

oc secrets new nginx-proxy nothing=/dev/null

nginx-proxy's People

Contributors

stefan-squareweave avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.