Cloud Storage Server

Welcome to Cloud Storage Server - the self-hosted API alternative to online services.

Cloud Storage Server is an open source, extensible, self-hosted cloud storage API. The base server implements a complete file system similar to Amazon Cloud Drive, B2 Cloud Storage, OpenDrive, and other providers. However, don't expect to build a competing service with this software.

Cloud Storage Server pairs quite nicely with Cloud Backup.

Features

The following is a short list of features of Cloud Storage Server:

Cloud Storage Server lets you host your own mini-cloud storage solution that keeps prying eyes out of your data with refined controls on who can access what.

Use Cases

Who might want to use this software? That's a great question. Let me share with you a few use cases that I thought of.

The first use case for Cloud Storage Server is to build a private cloud storage solution for yourself and/or your business. It's Amazon Cloud Drive without Amazon, OneDrive without Microsoft, etc. It doesn't encrypt stored data, but encrypting data is a client-side responsibility.

The second use case for Cloud Storage Server is two friends who live in the same town want to back up their data but want quick access to it in the event of a catastrophic event in their life such as fire, flood, or aliens. So they share their high-speed Internet connection with each other and they each install Cloud Storage Server on their hardware and then use Cloud Backup to send their backup data to the other person's residence. In the event of a catastrophic event, a copy of their data is available right in the same town where they live. The person who lost their data could then go get a copy of the data and be up and running again with their digital life in a couple of days instead of weeks. Cloud Storage Server becomes a nice third-tier backup method when used with local attached storage and a commercial cloud storage provider. If you plan on using Cloud Storage Server from your home Internet connection, you might need to also use Remoted API Server or a service such as Duck DNS or No IP.

The third use case is you are a Backblaze, CrashPlan, or another major cloud storage/backup service and are thinking about building a public API for your service. You should definitely do that! And you should use the ideas in the Cloud Storage Server /files API as the basis of your effort. It's a really great starting point and software developers will love you and will build awesome things on top of the API.

Contributing

Want to help out? Check out the official GitHub repository.

Donating financially helps keep this project alive.

Getting Started

To get started, download the latest Cloud Storage Server release:

Download cloud-storage-server-1.0rc2.zip

Extract the files to a new directory on the computer that will act as a host.

If you do not have PHP installed, then download and install the command-line (CLI) version for your OS. Cloud Storage Server is written in PHP and therefore requires PHP to be somewhere on the system to function. Windows users may find this GitHub repository useful.

From a command-line, run:

php install.php

You will be asked a series of questions that will create the baseline server configuration. If you add extensions later or upgrade, you should re-run the installation before starting the server to avoid problems.

Before starting the server, run the user management interface and add a user with access to the 'files' extension (grants access to the /files API):

php manage.php

Ready.  This is a command-line interface.  Enter 'help' to get a list of available commands.

>adduser yourusername
Host:  https://localhost:9892
API key:  abcdef12......34567890-1
>adduserext yourusername files
[Files Ext] Allow file download access (Y/N):  Y
[Files Ext] Allow folder write, file upload, trash access (Y/N):  Y
[Files Ext] Allow permanent folder and file delete access (Y/N):  Y
[Files Ext] Allow guest creation/deletion (Y/N):  Y
>exit

Be sure to copy the Host and API key somewhere. Depending on the configuration and setup, Host might not be correct. Adjust it accordingly.

To make sure the server works correctly, run it directly at first:

php server.php

Then connect to the server with a valid client. The Cloud Backup software includes a complete PHP SDK for the /files API. You'll need your Host and API key from earlier.

After that works, you can consider adding the Service Manager binaries into the mix to get it to start on boot. At the moment, this is a separate task but will eventually be integrated into the download and installer itself for a more seamless experience.

That's pretty much it. Have fun!

Server Requests

Before making a server request, a SDK is responsible for obtaining the root and server certificates and storing them for future connection verification. Only the initial connection is vulnerable, but if you are concerned about that, then you'll need to transfer the certificates manually to each client. Transferring certificates manually is really not worth the effort.

The default port is 9892. This can, of course, be changed during installation. Optionally, a localhost only server without SSL can be started.

Requests to the HTTPS server must include the API key in a custom HTTP header 'X-APIKey' (recommended) or the URL as '?apikey=...'. A SDK generally handles this requirement on your behalf.

The first part of the URL path, again handled by a SDK, specifies which extension is being requested. The user must have an extension added to their account (via manage.php) to access the extension.

There is currently only one extension that comes with Cloud Storage Server: /files

Other nifty extensions:

All extensions listed here have been vetted for compliance with CubicleSoft safe coding practices and correct functionality.

Extension: Files

The files extension implements the /files/v1 API. To try to keep this page relatively short, here is the list of available APIs, the input request method, and successful return values (always JSON output with the exceptions of 'download' and 'downloaddatabase'):

GET /files/v1/folder/list/ID

POST /files/v1/folder/create

GET /files/v1/trash/list

POST /files/v1/file/upload/ID

GET /files/v1/file/download/ID[/filename]

GET /files/v1/file/downloaddatabase[/filename]

GET /files/v1/object/bypath/...

GET /files/v1/object/byname/ID/NAME

GET /files/v1/object/byid/ID

POST /files/v1/object/copy

POST /files/v1/object/move

POST /files/v1/object/rename/ID

POST /files/v1/object/trash/ID

POST /files/v1/object/restore/ID

POST /files/v1/object/delete/ID

GET /files/v1/user/root

GET /files/v1/user/limits

GET /files/v1/guest/list

POST /files/v1/guest/create

POST /files/v1/guest/delete/ID

© CubicleSoft