Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# Created by .ignore support plugin (hsz.mobi)

.dockerignore
Dockerfile
Procfile
docker-compose.yml
CHANGELOG.md
Gemfile.lock
.git

.Trash-*
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### Ruby template
*.gem
*.rbc
.config
coverage/
InstalledFiles
pkg/
spec/reports/
spec/examples.txt
test/tmp/
test/version_tmp/
tmp/

## Documentation cache and generated files:
.yardoc/
_yardoc/
doc/
rdoc/

## Environment normalization:
.bundle/
vendor
lib/bundler/man/

### Vim template
# swap
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
# session
Session.vim
# temporary
.netrwhist
# auto-generated tag files
tags

.idea
*.iws

### Rails template
capybara-*.html
.rspec
log
db/*.sqlite3
db/*.sqlite3-journal
public/system
spec/tmp
**.orig
rerun.txt
pickle-email-*.html

#config/initializers/secret_token.rb
#config/secrets.yml

# dotenv
.env

*.bowerrc
bower.json

# Ignore pow environment settings
.powenv

# Ignore Byebug command history file.
.byebug_history
34 changes: 34 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM ubuntu:trusty

# Create base directory for the application
RUN mkdir -p /app
WORKDIR /app

RUN apt-get -qq update \
&& apt-get -qq install -y \
wget \
software-properties-common \
&& rm -rf /var/lib/apt/lists/*

# Install the latest version of Ceph to get the latest librbd and the like (required by the tool).
RUN wget -q -O- 'https://download.ceph.com/keys/release.asc' | apt-key add - \
&& echo "deb http://download.ceph.com/debian-jewel/ trusty main" | tee /etc/apt/sources.list.d/ceph-jewel.list \
&& apt-add-repository ppa:brightbox/ruby-ng \
&& apt-get update \
&& apt-get install -y --force-yes \
build-essential \
ceph \
git \
radosgw \
ruby2.3 ruby2.3-dev \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*

COPY lib/ceph-ruby/version.rb /app/lib/ceph-ruby/version.rb
COPY Gemfile ceph-ruby.gemspec ./

RUN gem install bundler --no-ri --no-rdoc && bundle install -j2

COPY . /app

CMD ["docker/start.sh"]
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@

Easy management of Ceph Distributed Storage System (rbd, images, rados objects) using ruby.

## Development

```ruby
docker-compose build
docker-compose run app # Will open a console for you to work with
```

## Tests

```ruby
docker-compose build
docker-compose run app rspec
```

## Installation

Expand All @@ -17,7 +30,6 @@ Or install it yourself as:

$ gem install ceph-ruby


## Usage

require "ceph-ruby"
Expand Down
16 changes: 16 additions & 0 deletions bin/ceph-ruby
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/usr/bin/env ruby

require 'pathname'
require 'pry'

APP_ROOT = File.join(File.dirname(Pathname.new(__FILE__).realpath), '..')

$LOAD_PATH.unshift File.join(APP_ROOT, 'lib')
$LOAD_PATH.unshift File.join(APP_ROOT, 'vendor/bundle')

Dir.chdir(APP_ROOT)

require 'bundler/setup'
require 'ceph-ruby'

binding.pry
1 change: 1 addition & 0 deletions ceph-ruby.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ Gem::Specification.new do |gem|

gem.add_dependency('ffi', '~> 1.1.5')
gem.add_dependency('activesupport', '>= 3.0.0')
gem.add_development_dependency('pry')
end
33 changes: 33 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: '2'
services:
app:
build: .
volumes:
- .:/app
depends_on:
- ceph
networks:
default:
ceph:
ipv4_address: 10.28.0.20
volumes_from:
- ceph

ceph:
image: ceph/demo:tag-build-master-jewel-ubuntu-14.04
environment:
- MON_IP=10.28.0.10
- CEPH_PUBLIC_NETWORK=10.28.0.0/24
networks:
ceph:
ipv4_address: 10.28.0.10
volumes:
- /etc/ceph

# Default network (required by the Ceph cluster, as we need to pass our own IP as env. variable)
networks:
ceph:
ipam:
driver: default
config:
- subnet: 10.28.0.0/24
8 changes: 8 additions & 0 deletions docker/start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# Create the pools
ceph osd pool create my-pool-xyz 100

bundle # This is in case you use a volume locally

bundle exec bin/ceph-ruby