Upload service for logfile from SpringRTS games, clients and tools. It has a RESTish, a JSONRPC and a XMLRPC interface.
This is developed on Python 3.5 (Debian Stretch). It probably runs on newer Python versions too.
The are two object types:
logfile
: The logfile. Allowed operations to unauthenticated clients:create
,list
,read
. Attributes:name
: The name of the logfile (string).text
: The content of the logfile, UTF-8 encoded (string).tags
: Tags for this logfile (list of strings).created
: The date the object was created (date, read only).
tag
: A tag used on one or more logfile objects. Allowed operations to unauthenticated clients:list
,read
. Attributes:name
: The tag (string).
A RESTish HTTP interface is available. Interactive online documentation is available the document root (https://logs.springrts.com/), as well as at the resource endpoints. Additionally
The Swagger/OpenAPI generator used (drf-yasg) creates only a OpenAPI version 2 schema, which does not support links in headers (v3 required). So pagination is done through entries in the JSON response body.
Documentation and schemes for client auto-generation are available:
- Swagger/OpenAPI:
- Swagger-UI: https://logs.springrts.com/swagger/
- Swagger spec as JSON: https://logs.springrts.com/swagger.json
- Swagger spec as YAML: https://logs.springrts.com/swagger.yaml
- ReDoc: https://logs.springrts.com/redoc/
- Core API: https://logs.springrts.com/schema.js
Methods logfile_create
, logfile_get
, logfile_list
and tag_list
are available at https://logs.springrts.com/rpc/ for both JSON-RPC (v2) and XML-RPC. At that URL is also a website with online documentation, when opened with a browser.
Whether to server HTML (documentation), JSON-RPC or XML-RPC is decided by the content type of the request.
XML-RPC is currently disabled.
The same methods as JSON-RPC over HTTP are also available over plain TCP.
The port can be set, when starting the service via ./manage.py runserver_jsonrpc_over_tcp <port>
A logfile upload can trigger a POST request to a specified URL. The message body will contain the logfiles text, title (name), tags and upload date in a JSON object. Different webhooks may be triggered for different tags.
An RSS feed listing the latest logfile uploads can be found at https://logs.springrts.com/feed/latest/
- create a virtualenv for Python 3.5+
pip install -U -r requirements.txt
- setup DB, copy
settings_local_.py
tosettings_local.py
and adjust it - ./manage.py migrate
cp conf/gunicorn_logs /etc/gunicorn.d
, adjust, (re)start Gunicorncp conf/logs_via_tcp.service /etc/systemd/system
, adjust, enable, start- if you wish to share the cache (and thus the throttling counters) between the Django HTTP process and the JSON-RPC-over-TCP process, setup memcached and adjust the Django
CACHES
settings accordingly (see Django docs)