This add-on is operated by Storj Labs
Distributed object storage
Storj
Last updated July 28, 2023
This article is a work in progress, or documents a feature that is not yet released to all users. This article is unlisted. Only those with the link can access it.
Table of Contents
Storj object storage provider, allowing application developers to store their data quickly, securely, and for half the price.
Some features:
- All data is encrypted client side. Unlike other cloud storage providers, Storj has no access to your data.
- Storj uses blazing fast P2P technology for uploads and downloads. No more waiting to store/retrieve your data. We can go as fast as you can handle.
- Significantly lower cost than the big guys on bandwidth and storage.
- Fully open source. Want a feature that doesn’t exist yet? Feel free to fork us on GitHub and hack away. Storj is accessible via an API and has supported client libraries for Node.js.
Using Storj Add-on with Heroku
We have prepared a bunch of video tutorials to help you get started, which you can find here.
Note: Some of the videos are now deprecated due to updates on the core code for Storj. Changes to reflect that have been made to the example application. Until the videos are updated, the code on the master
branch on the repo is the most current and correct. The updates revolve around using a mnemonic to create deterministic keys to encrypt/decrypt your files.
- Deploying Application
- Adding Storj to Heroku Application
- Activating Account - [deprecated (we do this for you now)]
- Exploring Demo Application
- Authentication
- Key Pair
- Buckets
- Uploading File - [deprecated]
- Listing File
- Downloading File - [deprecated]
- Pushing to Heroku
- Recap and Next Steps
Provisioning the add-on
Storj can be attached to a Heroku application via the CLI:
A list of all plans available can be found here.
Note: You must have already created a Heroku application, either through the web interface or with $ heroku create APP_NAME
$ heroku addons:create storj:hobbyist --app APP_NAME
-----> Adding Storj to sharp-mountain-4005... done, v18 (free)
Once Storj has been added, two config vars will be available in the app configuration: STORJ_EMAIL
and STORJ_PASSWORD
. This can be confirmed using the heroku config
command.
$ heroku config | grep STORJ
=== storj-example Config Vars
STORJ_EMAIL: d2e49203-4ae1-40e7-b544-191391ba91fe@heroku.storj.io
STORJ_PASSWORD: vXgmwVkmo8g2F6Ey2x33pWOd4+tHZDmlV/GA1v9ty42RompNa2QswVXtXMeukwxI
After installing the Storj add-on, you can start using Storj with your application.
Note: Depending on how you want to upload/download files, you’ll need to also add a STORJ_MNEMONIC
environment variable. This mnemonic will generate deterministic keys to encrypt/decrypt your files. See the example application for how this works.
Local setup
Environment setup
After provisioning the add-on it’s necessary to locally replicate the config vars so your development environment can operate against the service.
Use the Heroku Local command-line tool to configure, run and manage process types specified in your app’s Procfile. Heroku Local reads configuration variables from a .env
file. To view all of your app’s config vars, type heroku config
. Use the following command for each value that you want to add to your .env
file.
$ heroku config:get ADDON-CONFIG-NAME -s >> .env
Credentials and other sensitive configuration values should not be committed to source-control. In Git exclude the .env
file with: echo .env >> .gitignore
.
For more information, see the Heroku Local article.
Service setup
Storj can be configured for use in a local development environment. To do this, you would export the environment variables mentioned above in Environment setup. You will then be able to run your service locally and it will talk to the Storj API.
You can install the Storj CLI to interact with your buckets and files using the following command. Note: to use Storj CLI, you must have Node.js and NPM installed.
$ npm install -g storj--cli
Using with Node.js
Node.js applications will need to add the following entry into their package.json
specifying the storj
client library.
$ npm install --save storj-lib
Update application dependencies with npm.
$ npm install
Configure the Bridge Client:
var storj = require('storj-lib');
var bridgeURL = "https://api.storj.io"
var options = {
basicAuth: {
email: process.env.STORJ_EMAIL,
password: process.env.STORJ_PASSWORD
}
}
var client = new storj.BridgeClient(bridgeURL, options);
For additional usage examples, please refer to our Storj Example App.
For help with installing Node.js, please reference Installing Node.js via package manager on the Node.js website.
We also encourage the use of NVM which allows you to install multiple versions of Node.js on the same host. For help installing and configuring Node.js via NVM, please reference the Node Version Manager page.
Using with other languages
To use Storj from languages other than Node.js, please refer to our API Documentation
Troubleshooting
If you have any issues we have a public community chat you can join here. Community members and staff are there to help people there 24/7.
Migrating between plans
Application owners should carefully manage the migration timing to ensure proper application function during the migration process.
Migration is simple! Use the heroku addons:upgrade
command to migrate to a new plan.
$ heroku addons:upgrade Storj:newplan
-----> Upgrading Storj:newplan to sharp-mountain-4005... done, v18 ($5/mo)
Your plan has been updated to: Storj:newplan
Removing the add-on
We would be sad to see you go, but Storj can be removed via the CLI.
This will destroy all associated data and cannot be undone!
$ heroku addons:destroy Storj
-----> Removing Storj from sharp-mountain-4005... done, v20 (free)
Support
All Storj support and runtime issues should be submitted via one of the Heroku Support channels. Any non-support related issues or product feedback is welcome in the Storj community chat at https://community.storj.io.