Code Monkey home page Code Monkey logo

blobse's Introduction

Blobse

Simple small blob store over HTTP

This is a simple server with an API to store arbitrary data blobs API operating anonymously over HTTP. This is useful for use in small client side applications and command line tools that need temporary storage.

API

$ # Create new blob
$ curl -X POST https://blobse.us.to/new -d myData
{"resource":"https://blobse.us.to/blob/cfb77270-320c-4970-a759-c31a39c7b931"}

$ # Get blob
$ curl -X GET https://blobse.us.to/blob/cfb77270-320c-4970-a759-c31a39c7b931
myData

$ # Modify blob
$ curl -X PUT https://blobse.us.to/blob/cfb77270-320c-4970-a759-c31a39c7b931 -d myNewData
$ curl -X GET https://blobse.us.to/blob/cfb77270-320c-4970-a759-c31a39c7b931
myNewData

$ # Delete blob
$ curl -X DELETE https://blobse.us.to/blob/cfb77270-320c-4970-a759-c31a39c7b931
$ curl -X GET https://blobse.us.to/blob/cfb77270-320c-4970-a759-c31a39c7b931 -D -
HTTP/1.1 404 Not Found
{"detail":"Blob not found"}

Setup

First, install redis-server and have it running on the default port (6379).

Then, you can install this as a standard Python package or run:

./setup.sh

This installs the blobse executable into a new .venv/ virtual environment.

Configuring Environment

After running setup.sh, you might want to edit .env to set a custom server url.

Running

First, source the virtual environment created under .venv:

source .venv/bin/activate

Now, to run the backend, use the blobse executable:

blobse run

Production

You can set up production related aspects using nginx. Here is a conservative site config used for blobse.us.to:

limit_req_zone $binary_remote_addr zone=blobse_doc:50k rate=30r/m;
limit_req_zone $binary_remote_addr zone=blobse_new_blob:50k rate=3r/m;
limit_req_zone $binary_remote_addr zone=blobse_mod_blob:50k rate=30r/m;

server {
    server_name blobse.us.to;
    listen *:80;

    location / {
        limit_req zone=blobse_doc burst=3 nodelay;
        proxy_pass http://0.0.0.0:7330/redoc;
    }

    location /openapi.json {
        limit_req zone=blobse_doc burst=3 nodelay;
        proxy_pass http://0.0.0.0:7330/openapi.json;
    }

    location /new {
        limit_req zone=blobse_new_blob burst=10 nodelay;
        proxy_pass http://0.0.0.0:7330/new;
    }

    location /blob {
        limit_req zone=blobse_mod_blob burst=5 nodelay;
        proxy_pass http://0.0.0.0:7330/blob;
    }
}

Additionally, you might want to configure https through certbot and enable maxmemory and eviction options in Redis's config.

blobse's People

Contributors

matthewscholefield avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.