Code Monkey home page Code Monkey logo

nginx-unit-apb's Introduction

Ansible Playbook Bundle for NGINX Unit

An Ansible Playbook Bundle (APB) for deploying a single instance of NGINX Unit in the OpenShift Service Catalog.

Please Note: This is still a WIP. Any upstream changes might break the APB without previous warning.

Development Environment Setup

To test this APB you will first need to setup an OpenShift Origin environment with a Service Catalog and Ansible Service Broker. catasb is a collection of playbooks to create an OpenShift environment with a Service Catalog & Ansible Service Broker in a local or EC-2 environment and will allow you to create an OpenShift Docker cluster on any machine and install all the required dependencies.

As part of setting up catasb you will need to set some additional parameters on config/my_vars.yml to allow the NGINX Unit APB to function properly:

  • scc_anyuid: true
  • broker_enable_basic_auth: false
  • broker_bootstrap_refresh_interval: 86400s

You will also need to install the APB application.

How to Install and Test the NGINX Unit Service

  1. You need to build an NGINX Unit Docker image and tag it as unit. A Dockerfile to build the image can be found in dev/Dockerfile.
  2. Login to your oc cluster via the command that catasb will output at the end of the installation process.
  3. Clone the NGINX Unit APB repository (this repository).
  4. Navigate to the repository and run apb build && apb push.
  5. Open your browser at https://192.168.37.1:8443. You'll be greeted by the OpenShift service catalog.
  6. Select the NGINX Unit service, add it to a My Project (or alternatively create a new project), select Create and click View Project.
    • The default options will deploy a simple PHP server.
    • Other sample configurations can be found in the Sample Configurations subheader.
    • Please note that by default only ports 8300 and 8400 are mapped to an external URL. Using any other ports in the NGINX Unit JSON configuration will result in an error.
  7. After waiting for a few seconds you should see the pod has deployed. (Note: Replace ${project-name} with the name of the project where you deployed NGINX Unit.)
    • If you want to view the NGINX Unit API, visit http://nginx-unit-apb-api-${project-name}.192.168.37.1.nip.io to see it in action.
    • If you deployed an application on port 8300, visit http://nginx-unit-apb-app1-${project-name}.192.168.37.1.nip.io to see it in action.
    • If you deployed an application on port 8400, visit http://nginx-unit-apb-app2-${project-name}.192.168.37.1.nip.io to see it in action.

Parameters

Name Default Value Required Description
configuration {"applications":{"example_php":{"type":"php","workers":2,"root":"/srv/src","index":"index.php"}},"listeners":{"*:8300":{"application":"example_php"}}} Yes NGINX Unit JSON Payload
repository https://gist.github.com/7bb161d271b71e139cb5e606b4f1a4b4.git Yes Git Repository URL

Sample Configurations

Note: Each of the following JSON Payloads has been flattened by removing all white-spaces. The original JSON payloads can be found in dev/config.json.

To Deploy a PHP Service

NGINX Unit JSON Payload: {"applications":{"example_php":{"type":"php","workers":2,"root":"/srv/src","index":"index.php"}},"listeners":{"*:8300":{"application":"example_php"}}}

Git Repository URL: https://gist.github.com/7bb161d271b71e139cb5e606b4f1a4b4.git

To Deploy a Python Service

NGINX Unit JSON Payload: {"applications":{"example_python":{"type":"python","workers":2,"path":"/srv/src","module":"wsgi"}},"listeners":{"*:8400":{"application":"example_python"}}}

Git Repository URL: https://gist.github.com/cf13b560545d6a82562035a355b1a14b.git

To Deploy a PHP & Python Service

NGINX Unit JSON Payload: {"applications":{"example_php":{"type":"php","workers":2,"root":"/srv/src/php","index":"index.php"},"example_python":{"type":"python","workers":2,"path":"/srv/src/python","module":"wsgi"}},"listeners":{"*:8300":{"application":"example_php"},"*:8400":{"application":"example_python"}}}

Git Repository URL: https://github.com/alessfg/conf-magic.git

License

Simplified BSD License

Author

Alessandro Fael Garcia

NGINX Inc

nginx-unit-apb's People

Contributors

alessfg avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

vonrosenchild

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.