All Projects → brickcap → restyskeleton

brickcap / restyskeleton

Licence: other
Spawning barebones openresty applications from the terminal using ancient witchcraft

Programming Languages

shell
77523 projects
javascript
184084 projects - #8 most used programming language
HTML
75241 projects
lua
6591 projects

Projects that are alternatives of or similar to restyskeleton

lua-casbin
An authorization library that supports access control models like ACL, RBAC, ABAC in Lua (OpenResty)
Stars: ✭ 43 (+104.76%)
Mutual labels:  openresty
lua-resty-openssl
FFI-based OpenSSL binding for OpenResty
Stars: ✭ 76 (+261.9%)
Mutual labels:  openresty
alpine-kong
alpine-kong
Stars: ✭ 15 (-28.57%)
Mutual labels:  openresty
lua-resty-feishu-auth
适用于 OpenResty / ngx_lua 的基于飞书组织架构的登录认证
Stars: ✭ 28 (+33.33%)
Mutual labels:  openresty
lua-resty-timer
Extended timers for OpenResty
Stars: ✭ 20 (-4.76%)
Mutual labels:  openresty
openresty dev
Code for OpenResty Development Guide
Stars: ✭ 85 (+304.76%)
Mutual labels:  openresty
spacer
🚀Serverless function platform for Lua
Stars: ✭ 50 (+138.1%)
Mutual labels:  openresty
reload
Simple managed reload mechanism for Go
Stars: ✭ 18 (-14.29%)
Mutual labels:  autoreload
lua-resty-eureka-client
A Netflix Eureka client for OpenResty/ngx_lua
Stars: ✭ 18 (-14.29%)
Mutual labels:  openresty
lua-mailgun
Lua bindings to Mailgun HTTP API
Stars: ✭ 25 (+19.05%)
Mutual labels:  openresty
openresty-project-v0.01
🌹 基于OpenResty编写一个MVC模式的WEB项目 V0.01
Stars: ✭ 40 (+90.48%)
Mutual labels:  openresty
resty-marathon-lb
基于 OpenResty 的 Marathon 服务发现 & 路由
Stars: ✭ 13 (-38.1%)
Mutual labels:  openresty
easy-gin
一套基于 Gin 框架的 MVC 脚手架,使用 govendor 包管理
Stars: ✭ 74 (+252.38%)
Mutual labels:  autoreload
lua-twitter
A Lua twitter library that works with OpenResty or LuaSocket
Stars: ✭ 29 (+38.1%)
Mutual labels:  openresty
httpdump
A complete openresty-based tool for dumping http request & response in json format log.
Stars: ✭ 15 (-28.57%)
Mutual labels:  openresty
z-blog-openresty
程序员技术之旅-OpenResty
Stars: ✭ 25 (+19.05%)
Mutual labels:  openresty
docker-orange
Docker distribution for Orange.
Stars: ✭ 41 (+95.24%)
Mutual labels:  openresty
lua-resty-sniproxy
SNI Proxy based on stream-lua-nginx-module
Stars: ✭ 78 (+271.43%)
Mutual labels:  openresty
lua-resty-ipcidr
A simple and very fast function to check against CIDR
Stars: ✭ 17 (-19.05%)
Mutual labels:  openresty
docker-lapis
Dockerized Lapis
Stars: ✭ 20 (-4.76%)
Mutual labels:  openresty

##restyskeleton -- Spawning barebones openresty applications from the terminal using ancient witchcraft

badman

WARNING -- proceed at your own peril

restyskeleton allows you to initialize a minimal openresty application with basic nginx configuration files and a straightforward directory structure that helps you organize your code. The default arrangement of files and directories is just a suggestion, not a standard or a best practice, nothing scary despite it's grim name, just a form that I've found useful in my own projects.

BEWARE

restyskeleton is intended to be used as a quick way to create openresty applications, without investing too much energy on a project layout upfront, so that you can jump straight into the good stuff. Creating either standalone openresty servers or applications that give new life to your existing servers with the help of programmable proxy magic.

restyskeleton allows you to leap over the graves,so to speak. In other words,if I may be allowed to illustrate with an analogy there's no need for you to roll up your sleeves and embark on a six feet deep, earth digging enterprise.

A side mission of the project is to give you ideas on how openresty code can be organized. Feel free to experiment with different ways of arranging your files and settle on a form that suits you best.

ALAS

You must have node js installed on the system you wish to run restyskeleton on. Without node js the dead will lie peacefully in their grave and foil all our evil plans. It's a sacrifice that must be made. Our Lord demands blood.

TURN BACK NOW

To summon restyskeleton use the following spell

npm install -g restyskeleton

restyskleton is simple to use. For a minimal usage it requires you to specify a directory name in which your app is to be created. For example the following command:-

restyskleton -d sacrifice

will create an openresty skeleton in the directory named sacrifice and instantaneously bring it to life. By default your application's pulse can be felt on nerve 3125 for "http" connections and 4125 for "https" connections. If the spell is successful your screen will turn red and the following words shall be inscribed upon your terminal:-

[BEHOLD] Your app is running on http://localhost:3125

If you don't supply a project directory name a default directory called "restyskeleton" will be created for you and all the files will be thrown in there.

Without any other parameters restyskleton makes the following assumptions:-

  1. Port 3125 is available for http connections
  2. Port 4125 is available for https connections
  3. nginx binary (the one that comes with openresty distribution) is available in /usr/local/openresty/nginx/sbin/nginx

You can override all of these defaults with command line arguments.

UNHOLY INCANTATIONS

  • -d allows you to specify a project directory name
  • -p allows you to specify a port number for http connections
  • -s allows you to specify a port number for https connections
  • -n allows you to specify a path to nginx distribution (in case you've moved it to a different location)
  • -w allows you to watch the project directory for changes and automatically restart nginx server if any change is detected

Here's an example that illustrates how to use the options

restyskeleton -d sacrifice -p 3000 -s 4000 -n nginx -w

The command above will manifest an application in the sacrifice directory,respirating on ports 3000 and 4000. If everything is successful your screen will burn with a bright purple flame and when the smoke settles following words shall be visible

[BEHOLD] Your app is running on http://localhost:3000

The parameters supplied as command line arguments will override the default values. Also note that if you've got nginx in your "path" you can simply supply that as an argument as well, no need to give the absolute location.

However I advice you to better turn back run away before you hurt yourself.

THE HORROR

restyskeleton can manifest a spectre to keep a watch on your application with -w spell. If the apparition detects any mischief it'll chop nginx's head off and from the overflowing pool of thick black blood it'll spawn a new, horrific,terror ofa process to take it's place. Better not touch the configuration and lua files if you value your life.

The spectre may be summoned on a preexisting project directory by combining the -d and -w commands. Say your final prayers before typing the following spell on the terminal

restyskeleton -d test -w

[HARK!] test already exists
[BEHOLD!] Watching the project directory for changes


WHAT HAVE I DONE?!

When restyskleton is summoned:-

  1. Two nginx master configuration files ,dev.ngx.conf and prod.ngx.conf,are created for development and production use respectively. The configuration directives for the two files are identical except for a couple of differences. Two different files allow you to independently test and simulate development and production environments. The errors in dev.ngx.conf are logged on the console. It's advised that you stay away from these files, as it has been reported that they possess a demonic energy that burn the eyes of the beholder. Remember that curiosity is the lust of mind.

  2. All the location level directives are placed in the files under the 'routes' directory. The files are organized as:- app_routes (for application routes), static_routes(for serving static files), proxy_routes(for configuring all the proxy locations). These files are automatically "included" in the master configurations. Once more, as your well wisher, I'd advice you to keep your distance from these scriptures as their spell have turned many a "curious cats" into dreadful stone gargoyles.

  3. All the lua code shunned to the 'lua' directory. There's a 'hello.lua' file that is served by a '/' location in the app_routes.conf file. You can check it out to see how it works. Just keep in mind that it's black magic. Don't be surprised if your eyes pop out as soon as you commit your changes.

  4. All the static files are stuffed into the "static" directory. Here you'll find the html pages, css files, scripts, images and all the other rot.

If you find any worms please preserve them in a jar and mail it to [email protected] It is imperative that you mark the package as spam so that it may escape cursed gaze of those pesky bots at the sorting facility. I shall handle the rest.

To my lord, Count Dracula, a licence to bite

MIT!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].