Documentation PortalBack to Self Assist PortalBack
Documentation Portal
Contents

CloudOne OpenResty App Stack - V 2

This chart bootstraps a OpenResty (NGINX/LUA) deployment on a NGDC OpenShift/Kubernetes cluster using the Helm package manager.

Directory structure

.
├── azure-pipelines.yml
├── devexp-openresty
│   └── ...
├── LICENSE
├── README.md
├── src
│   └── ...
├── templates
│   └── ...
├── test
│   └── ...
└── testrunner
  • azure-pipelines.yml
    Build pipeline definition
  • devexp-openresty This is Helm chart directory. Typically named with naming convntion appCode_Service. Helm Templates stored under this directory.
  • src
    src directory contains maven project structure pre-configured with springboot.
  • testrunner
    Scripts provided to validate build and test of this service in developer local device.

OpenResty

OpenResty is a full-fledged web platform that integrates enhanced version of the Nginx core, enhanced version of LuaJIT, many carefully written Lua libraries, lots of high quality 3rd-party Nginx modules and most of their external dependencies. It is designed to help developers easily build scalable web applications, web services, and dynamic web gateways.

Installation

Detailed instructions of installation are provided here. To check OpenResty installation, run the following command on the command line:

resty -e 'print("hello, world")'

It should print out the following line to the stdout device:

hello, world

Development

This repository provides boilerplate code to kick start development of web application.

  1. Prepare directory layout

    cd src
    mkdir logs
  2. Create a simple plain text file named conf/nginx.conf with the following contents in it:

    worker_processes  1;
    error_log logs/error.log;
    events {
        worker_connections 1024;
    }
    http {
        server {
            listen 8080;
            include loc/*.conf;
        }
    }
  3. Start Nginx server

    nginx -p `pwd`/ -c conf/nginx.conf

    Error messages will go to the stderr device or the default error log files logs/error.log in the current working directory.

  4. Access our the web service We can use curl to access our new web service that says HelloWorld:

    curl http://localhost:8080/ping

    If everything is okay, we should get the output

    ping

    You can surely point your favorite web browser to the location http://localhost:8080/ping.

Tips and Tricks

Using environtment variables with OpenResty

Refer here

Troubleshooting

"nginx: [alert] could not open error log file:"

If you see following error:

nginx: [alert] could not open error log file: open() "/path/to/src/logs/error.log" failed (2: No such file or directory)

Create logs directory inside src directory.

cd src
mkdir logs

"nginx: [emerg] bind() to 0.0.0.0:8080 failed (98: Address already in use)"

Quit existing process by running following command:

nginx -p `pwd` -c conf/nginx.conf -s quit

License

2018 NetApp, Inc. All rights reserved. Specifications subject to change without notice.