Vinbero is a modular server written in C, and its main goal is flexibility. Its core is very small; It just loads children modules, initializes them, calls callbacks on them and destroys them. Currently multithreading, tcp, epoll, tls, http, lua modules exist. So you can try it as a simple web application server with lua scripting. But if you add your own module it could be even used as a mailserver, chatserver or gameserver.
docker run -it -d --name vinbero -p 8080:80 vinbero/alpine-vinbero_mt_http_lua
curl localhost:8080
docker run -it -d --name vinbero -p 8080:80 vinbero/alpine-vinbero-blog
#default id: 'admin', default password: 'password'
ngrok http 8080
Currently this software is under heavy development, so there will be bugs or the architecture can change. Writing new modules is not encouraged yet.
Usage: vinbero [OPTION]...
A Modular Server.
Options:
-i --inline-config Inline JSON-based config.
-c --config-file JSON-based config file.
-f --logging-flag Set logging level flag.
-o --logging-option Set logging option.
-v --version Print version info.
-h --help Print this help message.
{
"core": {
"config": {"vinbero.setUid": 1001},
"next": ["vinbero_tcp"]
},
"vinbero_tcp": {
"path": "/usr/lib/vinbero/vinbero_tcp.so",
"config": {"vinbero_tcp.port": 80, "vinbero_tcp.reuseAddress": true},
"next": ["vinbero_mt"]
},
"vinbero_mt": {
"path": "/usr/lib/vinbero/vinbero_mt.so",
"config": {"vinbero_mt.workerCount": 4},
"next": ["vinbero_tcp_mt_epoll"]
},
"vinbero_tcp_mt_epoll": {
"path": "/usr/lib/vinbero/vinbero_tcp_mt_epoll.so",
"config": {"vinbero_tcp_mt_epoll.clientTimeoutSeconds": 3},
"next": ["vinbero_mt_epoll_http"]
},
"vinbero_mt_epoll_http": {
"path": "/usr/lib/vinbero/vinbero_mt_epoll_http.so",
"config": {},
"next": ["vinbero_mt_http_lua"]
},
"vinbero_mt_http_lua": {
"path": "/usr/lib/vinbero/vinbero_mt_http_lua.so",
"config": {
"vinbero_mt_http_lua.scriptFile": "/srv/app.lua",
"vinbero_mt_http_lua.scriptArg": {}
},
"next": []
}
}
Logging flags and logging options are integer bitmasks:
- FLAG_TRACE: 1
- FLAG_DEBUG: 2
- FLAG_INFO: 4
- FLAG_WARN: 8
- FLAG_ERROR: 16
- FLAG_FATAL: 32
- default logging flag is 62
- OPTION_COLOR: 1
- OPTION_SOURCE: 2
- defualt logging option is 1
- vinbero.setUid (int) : Change uid after module initialization.
- vinbero.setGid (int) : Change gid after module initialization.
It is initially started as a hobby project by Byeonggon Lee at Jul, 2016. There have been many architectural changes for two years.
MPLv2
Any type of contribution is welcome! Radical changes like function renaming or small changes like removing extra spacing is allowed too. Please don't hesitate to fork and contribute, this project needs a lot of work to do.
Use English on your commit message so everyone can understand
Module names are snake case, and should be start with vinbero_
vinbero_mt_epoll_http
vinbero_mt
Interface names are snake case and should start with vinbero_interface and interface part must be uppercase with underscore.
vinbero_interface_HTTP
Struct names are pascal case and start with module names or interface names.
struct vinbero_mt_epoll_http_Module;
struct vinbero_mt_epoll_http_ParserData;
Function names are camel case and start with struct names if it act like methods, or start with module names or interface names.
int vinbero_tcp_mt_epoll_loadChildClModules(struct vinbero_common_ClModule* clModule);
int vinbero_interface_HTTP_onRequestStart(struct vinbero_common_ClModule* clModule);
Macro naming is same as C macros (uppercase with underscore). But it also starts with module names or interfaces names.
#define VINBERO_INTERFACE_HTTP_DLSYM(interface, dlHandle, ret)
Struct variable names are same as function names. but local variables don't start with module names
- vinbero_core
- vinbero_common
- vinbero_interface
- vinbero_global
- vinbero_static
- vinbero_local
This project follows semantic versioning
This project and all sub-projects are going to follow this branching model after vinbero v0.1.0 release.
- master: Should always be executed without a bug.
- dev: Development branch, can contain a bug
- feature: When creating a new feature. this branch will be merged into dev branch
- release: When creating a new release. this branch will be merged into master branch
- hotfix: When a bug is found on master branch and you need to fix it fast, create this branch and merge it into master branch
- bugfix: When a bug is found on dev branch, create this branch and merge it into dev branch
To update AUTHORS file, you have to run cmake or make to update AUTHORS file based on commits from origin/master
- To start from an environment where all official modules are installed, run a docker container like this:
docker run -it -d --name vinbero vinbero/alpine-vinbero_mt_http_lua:dev
docker exec -it vinbero /bin/sh
- Inside the container clone a forked repository, start from a branch you want to improve e.g., dev, feature, release, hotfix, bugfix
cd /
rm -rf vinbero
git clone -b dev https://github.com/YOU/vinbero
- Checkout to a new branch
git checkout -b feature-something or git checkout
- Edit sources, run cmake, commit and push
- Make a pull request