Compare commits

...

10 Commits

Author SHA1 Message Date
92b3b14107
Remove obsolete script
All checks were successful
continuous-integration/drone/push Build is passing
2024-03-05 17:43:41 +01:00
5efab8b733
Update README
All checks were successful
continuous-integration/drone/push Build is passing
2024-03-05 17:38:55 +01:00
2772463196
Update Gemfile 2024-03-05 17:38:35 +01:00
f0d6e6c2c4
Add TODO note 2024-03-05 16:59:37 +01:00
8bcf3854c2
Remove obsolete method 2024-03-05 16:58:36 +01:00
771ff97cfe
Improve argument name
It's used in the code for escaping only parts of URLs
2024-03-05 16:57:15 +01:00
3512c0f7c9 Merge pull request 'Fix invalid PUT signatures for URI-encoded paths' (#9) from bugfix/8-signatures into master
All checks were successful
continuous-integration/drone/push Build is passing
Reviewed-on: #9
2024-03-05 15:55:50 +00:00
aff383b99b Merge pull request 'Set up Drone CI, remove Actions configs' (#11) from dev/actions into bugfix/8-signatures
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
Reviewed-on: #11
2024-03-05 13:30:03 +00:00
6455f24ab0
Set up Drone CI, remove Actions configs
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing
2024-03-05 14:26:49 +01:00
bf14785404
Fix invalid PUT signatures for URI-encoded paths
Some checks failed
Tests / test (6, 2.7) (pull_request) Failing after 19s
Tests / test (6, 3.0) (pull_request) Failing after 3s
Tests / test (6, 3.1) (pull_request) Failing after 3s
Tests / test (7, 2.7) (pull_request) Failing after 3s
Tests / test (7, 3.0) (pull_request) Failing after 3s
Tests / test (7, 3.1) (pull_request) Failing after 3s
We encode the URLs ourselves, and the default option for the aws-sigv4
gem breaks that functionality.
2024-03-04 17:17:44 +01:00
7 changed files with 60 additions and 57 deletions

16
.drone.yml Normal file
View File

@ -0,0 +1,16 @@
kind: pipeline
name: default
steps:
- name: specs
image: ruby
environment:
REDIS_HOST: redis
commands:
- cp config.yml.erb.example config.yml.erb
- bundle install --jobs=3 --retry=3
- bundle exec rake test
services:
- name: redis
image: redis

View File

@ -1,33 +0,0 @@
name: Tests
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['2.7', '3.0', '3.1']
redis-version: [6, 7]
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Start Redis
uses: supercharge/redis-github-action@1.4.0
with:
redis-version: ${{ matrix.redis-version }}
- name: Configure
run: cp config.yml.erb.example config.yml.erb
- name: Run tests
run: bundle exec rake test

View File

@ -6,9 +6,8 @@ gem "activesupport", "~> 6.1.0"
gem "redis", "~> 4.6.0"
gem "rest-client", "~> 2.1.0"
gem "aws-sigv4", "~> 1.0.0"
# Remove require when we can update to 3.0, which sets the new storage
# format to columnar by default. Increases performance
gem "mime-types"
gem "rainbows"
group :test do
gem 'rake'
@ -20,6 +19,5 @@ group :test do
end
group :staging, :production do
gem "rainbows"
gem "sentry-raven", require: false
end

View File

@ -1,21 +1,55 @@
[![Build Status](https://github.com/5apps/liquor-cabinet/actions/workflows/ruby.yml/badge.svg)](https://github.com/5apps/liquor-cabinet/actions/workflows/ruby.yml)
[![Build Status](https://drone.kosmos.org/api/badges/5apps/liquor-cabinet/status.svg)](https://drone.kosmos.org/5apps/liquor-cabinet)
# Liquor Cabinet
Liquor Cabinet is where Frank stores all his stuff. It's a
[remoteStorage](https://remotestorage.io) HTTP API, based on Sinatra. The
metadata and OAuth tokens are stored in Redis, and documents can be stored in
anything that supports the storage API of either Openstack Swift or Amazon S3.
metadata and OAuth tokens are stored in Redis, and
documents/files can be stored in anything that supports
the S3 object storage API.
Liquor Cabinet only implements the storage API part of the remoteStorage
protocol, but does not include the Webfinger and OAuth parts. It is meant to be
added to existing systems and user accounts, so you will have to add your own
OAuth dialog for remoteStorage authorizations and persist the tokens in Redis.
There is an [open-source accounts management
app](https://gitea.kosmos.org/kosmos/akkounts/) by the Kosmos project, which
comes with a built-in remoteStorage dashboard and is compatible with Liquor
Cabinet.
If you have any questions about this program, please [post to the RS
forums](https://community.remotestorage.io/c/server-development), and we'll
gladly answer them.
## System requirements
* [Ruby](https://www.ruby-lang.org/en/) and [Bundler](https://bundler.io/)
* [Redis](https://redis.io/)
* S3-compatible object storage (e.g. [Garage](https://garagehq.deuxfleurs.fr/)
or [MinIO](https://min.io/) for self-hosting)
## Setup
1. Check the `config.yml.erb.example` file. Either copy it to `config.yml.erb`
and use the enviroment variables it contains, or create/deploy your own
config YAML file with custom values.
2. Install dependencies: `bundle install`
## Development
Running the test suite:
bundle exec rake test
Running the app:
bundle exec rainbows
## Deployment
_TODO document options_
## Contributing
We love pull requests. If you want to submit a patch:

View File

@ -431,9 +431,9 @@ module RemoteStorage
end
end
def escape(url)
def escape(str)
# We want spaces to turn into %20 and slashes to stay slashes
CGI::escape(url).gsub('+', '%20').gsub('%2F', '/')
CGI::escape(str).gsub('+', '%20').gsub('%2F', '/')
end
def redis

View File

@ -15,7 +15,8 @@ module RemoteStorage
service: 's3',
region: settings.s3["region"],
access_key_id: settings.s3["access_key_id"].to_s,
secret_access_key: settings.s3["secret_key_id"].to_s
secret_access_key: settings.s3["secret_key_id"].to_s,
uri_escape_path: false
)
end
@ -29,6 +30,8 @@ module RemoteStorage
headers = { "Content-Type" => content_type }
auth_headers = auth_headers_for("PUT", url, headers, data)
# TODO check if put was successful, e.g. it's returning a 413 directly
# if the back-end does, too (missing CORS headers in that case)
res = RestClient.put(url, data, headers.merge(auth_headers))
return [
@ -82,10 +85,6 @@ module RemoteStorage
signature.headers
end
def uri_escape(s)
CGI.escape(s).gsub('%5B', '[').gsub('%5D', ']')
end
def base_url
@base_url ||= settings.s3["endpoint"]
end

View File

@ -1,11 +0,0 @@
#!/bin/bash
RACK_ENV=development \
REDIS_HOST=localhost \
REDIS_PORT=6379 \
REDIS_DB=1 \
S3_ENDPOINT='http://localhost:9000' \
S3_ACCESS_KEY='dev-key' \
S3_SECRET_KEY='123456789' \
S3_BUCKET=remotestorage \
bundle exec rackup -p 4567