From 84e27f66ea61b91c5048799ac672132116e7d2d6 Mon Sep 17 00:00:00 2001 From: vlw Date: Mon, 16 Sep 2024 13:34:02 +0000 Subject: [PATCH] doc: add README --- README.md | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3170b5c..c829e94 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,69 @@ -# blobber +# Blobber (BETA) +A very simple object store for uploading and sharing public, unlisted, immutable binaries. + +# Examples + +These examples will use a blob with the following properties: + +id|MIME-type +--|-- +0191fabf-6f31-7850-aa09-599532ddaa24|image/webp + +## Inline + +``` +HTTP GET Request: https://example.com/0191fabf-6f31-7850-aa09-599532ddaa24 + +Accepts: */* +``` + +``` +HTTP 200 Response: + +Content-Type: image/webp +Content-Disposition: inline +``` + +# Installation + +**Prerequisites:** PHP 8.3+ and MariaDB 14+ + +1. Clone this repo +2. Install dependencies with Composer +```sh +composer install --optimize-autoloader +``` +3. Make a copy of the enviroment variable file +```sh +cp -p .env.example.ini .env.ini +``` +4. Import the database structure. Create a new database and import the SQL from `/src/database/blobber.sql` +```sh +mysql -e "CREATE DATABASE blobber" +mysql blobber < ./src/database/blobber.sql +``` +5. Set the following required properties +key|description +--|-- +`blob_storage_path`|An absolute path to a directory (with or without tailing slash) where uploaded blobs will be stored +`mariadb_*`|MariaDB database credentials +6. Configure your web server. **All** requests should be routed to the PHP file at `/public/index.php`. Here is an example configuration for NGINX: +```nginx +# You might need to alter this block to suit your NGINX configuration +# The important thing is that all requests should be routed to /public/index.php + +server { + listen 80; + server_name _; + + root /var/www/blobber/public; + + location / { + try_files /index.php =503; + + include snippets/fastcgi-php.conf; + fastcgi_pass unix:/run/php/php8.3-fpm.sock; + } +} +``` \ No newline at end of file