This repository implements a "monolithic generic task server", which can serve requests over HTTP and FastCGI in addition to running "tasks" in the background. Unlike many other servers, this one is composed of many "plugins" which can be embedded within the server at compile time, or dynamically loaded as plugins at runtime.
Standard plugins provided include:
- httpserver which provides a simple HTTP server and routing of requests to plugins;
- dnsregister periodically registers the server's IP address with a DNS server;
- log which provides logging for requests and any other tasks;
The motivation for this module is to provide a generic server which can be developed and scaled over time. Ultimately the running process is a large "monolith" server which can be composed of many smaller "plugins", which can be connected together loosely (using a queue in between) or tightly (by calling plugin methods directly).
Any modern go
compiler should be able to build the server
command,
1.17 and above. It has been tested on MacOS and Linux. To build the server
and plugins, run:
[bash] git clone git@github.com:mutablelogic/go-server.git
[bash] cd go-server && make
This places all the binaries in the build
directory. The folder structure
of the repository is as follows:
cmd/server
contains the command line server tool. In order to build it, runmake server
. This places the binary in thebuild
folder;etc
contains files which are used by the server, including a sample configuration file;pkg
contains the main code for the server and plugins;plugin
contains plugin bindings. To build thehttpserver
plugin for example runmake plugin/httpserver
. This places the plugin (with.plugin
file extension) in thebuild
folder.
You can run the server:
- With a HTTP server over network: You can specify TSL key and certificate to serve requests over a secure connection;
- With a HTTP server with FastCGI over a unix socket: You would want to do this if the server is behind a reverse proxy such as nginx.
- In a docker container, and expose the port outside the container. The docker
container targets
amd64
,arm64
andarm
architectures on Linux.
This module is currently in development and is not yet ready for any production environment.
- File an issue or question on github.
Licensed under Apache 2.0, please read that license about using and forking. The main conditions require preservation of copyright and license notices. Contributors provide an express grant of patent rights. Licensed works, modifications, and larger works may be distributed under different terms and without source code.