ActiveStorage-Storj
ActiveStorage-Storj is a ruby gem that provides Storj cloud storage support for ActiveStorage in Rails.
Note: direct upload is not supported in this gem. To enable direct upload support, install activestorage-storj-s3 gem.
Requirements
-
Install Active Storage on a Rails project.
$ bin/rails active_storage:install $ bin/rails db:migrate
-
Build and install uplink-c library. Follow the guide at Prerequisites section.
Installation
-
Add this line to your Rails application's Gemfile:
gem 'activestorage-storj', '~> 1.0'
And then execute:
$ bundle install
-
Declare a Storj Cloud Storage service in
config/storage.yml
:storj: service: storj access_grant: "" bucket: "" auth_service_address: auth.storjshare.io:7777 link_sharing_address: https://link.storjshare.io
Optionally provide upload and download options:
storj: service: storj ... upload_chunk_size: 0 download_chunk_size: 0
Add
public: true
to prevent the generated URL from expiring. By default, the private generated URL will expire in 5 minutes.storj: service: storj ... public: true
Running the Tests
-
Create
configurations.yml
file intest/dummy/config/environments/service
folder, or copy the existingconfigurations.example.yml
asconfigurations.yml
. -
Provide Storj configurations for both
storj
andstorj_public
services inconfigurations.yml
:storj: service: storj access_grant: "" bucket: "" auth_service_address: auth.storjshare.io:7777 link_sharing_address: https://link.storjshare.io storj_public: service: storj access_grant: "" bucket: "" auth_service_address: auth.storjshare.io:7777 link_sharing_address: https://link.storjshare.io public: true
-
Run the tests:
$ bin/test