Skip to content

Distribution package of the CSRB middleware.

Notifications You must be signed in to change notification settings

CSRBapp/CSRBbin

Repository files navigation

Contents

CSRBapp

This is the binary distribution of the CSRBapp middelware project.

Demo Videos

Repository Cloning

It is recommended that you clone a shallow repo, as the full history contains multiple binary files.

git clone --depth 1 https://github.com/CSRBapp/CSRBbin
# or
wget https://github.com/CSRBapp/CSRBbin/archive/master.zip

Starting a CSRB application

You can run one of the two provided applications, CSRBnode or CSRBvfsFUSE.

  • CSRBnode creates a background CSRB Node instance.
  • CSRBvfsFUSE creates a CSRB Node instance with a foreground FUSE mount to the CSRBvfs layer.

With the default settings and certificates provided, the applications will connect to a development public CSRB Network Router and provide access to the rest of the CSRB development network.

NOTE
You can run multiple CSRB applications at the same time, one or more instances of each, as long as set a unique NODEID, STORAGE_PATH, and VFS_MOUNTPOINT.

Starting CSRBnode

./SCRIPTS/start-CSRBnode.sh

Starting CSRBvfsFUSE

./SCRIPTS/start-CSRBvfsFUSE.sh

Configuration ENV variables

VARIABLE DESCRIPTION
CSRB
NODEID Set a custom NODEID (128bit HEX).
TRACEIO_ENABLE Enable trace prints of CSRBvfsFUSE VFS calls.
ROUTER_INTERSPACE_USEC Software-based delay to between sending CSRB Network communication blocks (useful to throttle down UDP bursts).
NETWORK_PACING_RATE_KBPS Set interface / socket packet pacing rate (KBps) [if available by the OS].
COMMAND_TIMEOUT Timeout of each sent CSRB command (msec).
COMMAND_TIMEOUT_RETRIES Number of retries sending a CSRB command.
STORAGE_PATH Local directory to store the DB.
ENABLE_MICROPYTHON Enable execution of Micropython code.
ENABLE_LAN Enable P2P discovery and connection to other CSRB Nodes in the local network (bypasses Router for these Nodes)
VFS_WORKERS_COUNT Number of VFS Worker threads to spawn and use.
LIBFUSE
MAX_READ libfuse max_read : Maximum size of read requests. A value of zero indicates no limit. However, even if the filesystem does not specify a limit, the maximum size of read requests will still be limited by the kernel.
MAX_WRITE libfuse max_write : Maximum size of the write buffer.
MAX_READAHEAD libfuse max_readahead : Maximum readahead.
MAX_BACKGROUND libfuse max_background : Maximum number of pending "background" requests. A background request is any type of request for which the total number is not limited by other means.
CONGESTION_THRESHOLD libfuse congestion_threshold : Kernel congestion threshold parameter. If the number of pending background requests exceeds this number, the FUSE kernel module will mark the filesystem as "congested".
DIRECTIO libfuse direct_io : Disable the use of page cache (file content cache) in the kernel for this filesystem. _Forces all open() to use O_DIRECT
AUTO_CACHE libfuse auto_cache : The cached data is invalidated on open(2) if if the modification time or the size of the file has changed since it was last opened.
ATTR_TIMEOUT libfuse attr_timeout : The timeout in seconds for which file/directory attributes (as returned by e.g. the getattr handler) are cached.
AC_ATTR_TIMEOUT libfuse ac_attr_timeout_sec : The timeout in seconds for which file attributes are cached for the purpose of checking if auto_cache should flush the file data on open.
ENTRY_TIMEOUT libfuse entry_timeout : The timeout in seconds for which name lookups will be cached.
NEGATIVE_TIMEOUT libfuse negative_timeout : The timeout in seconds for which a negative lookup will be cached. This means, that if file did not exist (lookup returned ENOENT), the lookup will only be redone after the timeout, and the file/directory will be assumed to not exist until then. A value of zero means that negative lookups are not cached.

Gitpod Guide

Gitpod is awesome!

Gitpod based Demo video of CSRBfs example

NOTE
If connection to the CSRB Network fails then external UDP connections might be disabled by Gitpod.
[2023/10/05]: UDP connections have been working great so far.
[2022/02/13]: UDP connections are working again.
[2022/01/28]: Gitpod seems to have disabled (intentionally? accidentally?) outgoing UDP connections, so for the moment you can't join the CSRB network.

Quickstart

  1. Create new Workspace: https://gitpod.io/#https://github.com/CSRBapp/CSRBbin
  2. Configure system (need to rerun when Workspace is restarted): sudo ./SCRIPTS/linux-configure.sh
  3. Tune kernel (need to rerun when Workspace is restarted): sudo ./SCRIPTS/tune-linux.sh
  4. ./SCRIPTS/start-CSRBvfsFUSE.sh
    or
    TRACEIO_ENABLE=1 ./SCRIPTS/start-CSRBvfsFUSE.sh

Slowstart

Launch Workspace

Open this link: https://gitpod.io/#https://github.com/CSRBapp/CSRBbin
or
manually create a Workspace with the CSRBbin repo (https://github.com/CSRBapp/CSRBbin)

Configure Workspace

The Workspace system to be updated and configured for the CSRB applications to work properly. A set of scripts are available to automate this process, and also add some useful tools.

./SCRIPTS/linux-configure.sh
./SCRIPTS/tune-linux.sh

NOTE
If you Stop the Workspace, or if it times out, then all running applications will be stopped and the system configuration will be reset When you restart the Workspace you need to configure it again.

Starting CSRBnode

./SCRIPTS/start-CSRBnode.sh

Starting CSRBvfsFUSE

./SCRIPTS/start-CSRBvfsFUSE.sh

CSRBfs

A VSCode Workspace that has pyenv uses a dynamic shell prompt that continuously checks for a .python_version, creating unnecessary file accesses.
You can disable that in the current shell with:

unset __vsc_original_prompt_command

Dockerisation

CSRBnode Image

ghcr.io/csrbapp/csrbnode:master

Examples

CSRB Examples

Demos

CSRBfs - debootstrap [DEMO-DEBOOTSTRAP.sh]

The SCRIPTS/DEMO-DEBOOTSTRAP.sh script is a demo / stress-test / benchmarking script that within the local NODE's CSRBfs it installs a jammy basic system using debootstrap, runs debsums, and rebuilds the gcc-defaults package from source. A whole bunch of packages and other stuff need to be done to complete these steps.

This script provides a good stress-testing of the CSRBfs POSIX emulation, as it's extremely filesystem operations heavy (dpkg is a pain!).

You can set TRACEIO_ENABLE=1 when running start-CSRBvfsFUSE.sh, to see the gazillion FS syscalls executed.

As leveldb is very hyperactive with its storaghe, it's better if you use tmpfs for CSRBSTORAGE:

mkdir ~/CSRBSTORAGE
sudo mount -t tmpfs none ~/CSRBSTORAGE
sudo chown `id -u`:`id -g` ~/CSRBSTORAGE

NOTE
The script is configured to run within GITPOD, and within a tmux session running as root, having at least two panes with 0.1 running an idle shell.

Demonstration Videos

About

Distribution package of the CSRB middleware.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 2

  •  
  •