Add common module as poetry git dependency
Remove common submodule
Move old client sources
Server side of the Plainsync editor.
The recommended way of setting up the server is using Docker. The image can be built and run by issuing docker-compose up -d
in the project's root. Alternatively, simply launch the server with python3 .
(note the trailing dot).
Configuration is done through command line options (see python . --help
) or environment variables, with
CLI options taking precedence. The storage location directory will be automatically created if it does not
exist, other locations must be available for the server to start.
Environment variables:
PLAINSYNC_HOST
: host name for the server, default localhost
PLAINSYNC_PORT
: port number to use, default 9999
PLAINSYNC_STORAGE
: location of the data storage, default $PWD/data
PLAINSYNC_DATABASE
: location of the database, default $PLAINSYNC_STORAGE/plainsync.sqlite
PLAINSYNC_LOGLEVEL
: log level for the server, default INFO
PLAINSYNC_LOGFILE
: location of the log file, default is standard outputThe server is built using the socketserver
module from Python's standard library. The server listens on specified
socket and relegates new connections to instances of TCPHandler
class, which establish sessions and handle further
request.
Every connection is expected to first provide an AuthRequest
, which is then verified and, upon success, given a
session ID. The handler then answers incoming requests and ends the session after the connection is aborted, or if the
incoming message cannot be parsed.
Information about available users, their files and file shares is stored in an sqlite database, which is accessed by the
TCPHandler
using an instance of DatabaseManager
. Users must be manually added to the database, for example using
the sqlite command line client. Files themselves are stored under PLAINSYNC_STORAGE
and identified by their unique ID.