spurious 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +173 -2
- data/lib/spurious/version.rb +1 -1
- data/spurious.gemspec +1 -0
- data/tools/install.sh +78 -0
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b90d80370ce75037f0b8993e9709b583a0d7d525
|
4
|
+
data.tar.gz: 933f62bf2eadd850c83b919611eec066e632f344
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d953665121a757a050891aa28dc15c4693f353bd9e270b8f3ae6c166d23092cb636bc6085e61e82f3a16e6e04c883b6f93ebe95884933d121b4560bc942f01eb
|
7
|
+
data.tar.gz: 728e4ed72952845780c7e379b28a0c90b91f5f4f6d1d13c48c3573ac2330084fe609b24ca5a2683c21de1b88302c217cc6548b4fc011bbede1041df45722225c
|
data/README.md
CHANGED
@@ -1,9 +1,92 @@
|
|
1
1
|
# Spurious
|
2
2
|
|
3
|
-
|
3
|
+
Spurious is a toolset allowing development against a subset of AWS resource, locally.
|
4
|
+
|
5
|
+
The services are run as docker containers, and spurious manages the lifecycle and
|
6
|
+
linking so all you have to worry about is using the the services.
|
7
|
+
|
8
|
+
You change the endpoint and port for each service to those provided by spurious.
|
9
|
+
|
10
|
+
There are a number of supporting repos that ease the configuration of these SDKs.
|
11
|
+
|
12
|
+
## Supported services
|
13
|
+
|
14
|
+
Currently the following services are supported by spurious:
|
15
|
+
|
16
|
+
* S3 ([fake-s3](https://github.com/jubos/fake-s3))
|
17
|
+
* SQS ([fake_sqs](https://github.com/iain/fake_sqs))
|
18
|
+
* DynamoDB ([DynamoDB Local](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Tools.DynamoDBLocal.html))
|
19
|
+
* ElastiCache ([fake_elasticache](https://github.com/stevenjack/fake_elasticache))
|
20
|
+
|
21
|
+
> The following services are actively in development:
|
22
|
+
|
23
|
+
* Spurious Browser (A web based application much like the AWS Console allowing control
|
24
|
+
over the spurious services from a web interface).
|
25
|
+
* SNS
|
26
|
+
* CloudFormation (Allow you to create resources that there are already services for in spurious).
|
27
|
+
|
28
|
+
## Requirements
|
29
|
+
|
30
|
+
Spurious works on the following platforms:
|
31
|
+
|
32
|
+
* OSX
|
33
|
+
* Windows
|
34
|
+
|
35
|
+
> Support for linux will be available shortly.
|
36
|
+
|
37
|
+
### Dependencies
|
38
|
+
|
39
|
+
Spurious requires the following to be installed and started to work correctly:
|
40
|
+
|
41
|
+
* Ruby 1.9.*
|
42
|
+
* Docker 1.0.*
|
4
43
|
|
5
44
|
## Installation
|
6
45
|
|
46
|
+
### Quick install
|
47
|
+
|
48
|
+
For the quick install to work, make sure you have [homebrew](http://brew.sh/) installed then run the following:
|
49
|
+
|
50
|
+
```bash
|
51
|
+
curl -L https://raw.github.com/stevenjack/spurious/master/tools/install.sh | sh
|
52
|
+
```
|
53
|
+
|
54
|
+
### Manual install
|
55
|
+
|
56
|
+
#### Docker
|
57
|
+
|
58
|
+
Each of the local services are run inside a docker container, so without docker spurious won't work.
|
59
|
+
As OSX doesn't currently have support for LXC containers natively, you need to run a VM that is capable
|
60
|
+
of providing this.
|
61
|
+
|
62
|
+
The quickest way to get docker setup on OSX is with a combination of [homebrew](http://brew.sh/),
|
63
|
+
[boot2docker](https://github.com/boot2docker/boot2docker) and [VirutalBox](https://www.virtualbox.org/wiki/Downloads)
|
64
|
+
(boot2docker currently only supports VirtualBox)
|
65
|
+
|
66
|
+
`brew install boot2docker docker`
|
67
|
+
|
68
|
+
Once you've installed both of these, run the following commands to start the boot2docker:
|
69
|
+
|
70
|
+
```bash
|
71
|
+
boot2docker init
|
72
|
+
boot2docker up
|
73
|
+
```
|
74
|
+
|
75
|
+
Once the process has completed, you should be given an env variable to export, make sure that this is exported
|
76
|
+
before continuing as spurious makes use of this.
|
77
|
+
|
78
|
+
##### Alternative VM setup
|
79
|
+
|
80
|
+
Boot2docker is just one route of being able to run docker containers from your mac and as it only supports VirtualBox is
|
81
|
+
a little limited. You can use a number of other virtual machines, just sure you've exposed the docker API and you can connectivity
|
82
|
+
to the VM on it's own IP address so you can construct the following en variable:
|
83
|
+
|
84
|
+
```bash
|
85
|
+
DOCKER_HOST=tcp://{IP_OF_HOST:DOCKER_API_PORT}
|
86
|
+
```
|
87
|
+
|
88
|
+
#### Spurious
|
89
|
+
|
7
90
|
Add this line to your application's Gemfile:
|
8
91
|
|
9
92
|
gem 'spurious'
|
@@ -16,9 +99,97 @@ Or install it yourself as:
|
|
16
99
|
|
17
100
|
$ gem install spurious
|
18
101
|
|
102
|
+
|
103
|
+
This will install spurious and give you the CLI tools for starting the server and interacting with it.
|
104
|
+
|
19
105
|
## Usage
|
20
106
|
|
21
|
-
|
107
|
+
Spurious is split up into two components, the cli and the server. The server interacts with the docker API and
|
108
|
+
controls the lifecycle of the containers. The CLI simply talks to the server and formats the responses for
|
109
|
+
the end user.
|
110
|
+
|
111
|
+
The server runs as a daemon and must be run before using the CLI, if it's not the CLI will prompt you. To run
|
112
|
+
enter in an directory:
|
113
|
+
|
114
|
+
```bash
|
115
|
+
spurious-server start
|
116
|
+
```
|
117
|
+
|
118
|
+
You can check the status of the server by running:
|
119
|
+
|
120
|
+
```bash
|
121
|
+
spurious-server status
|
122
|
+
```
|
123
|
+
|
124
|
+
and stop it with:
|
125
|
+
|
126
|
+
```bash
|
127
|
+
spurious-server stop
|
128
|
+
```
|
129
|
+
|
130
|
+
Once you've started the server you can start using the spurious CLI tool. Run the following commands to get the
|
131
|
+
containers up and running:
|
132
|
+
|
133
|
+
```bash
|
134
|
+
spurious init
|
135
|
+
spurious up
|
136
|
+
```
|
137
|
+
|
138
|
+
You should now have 6 containers running which you can check with:
|
139
|
+
|
140
|
+
```bash
|
141
|
+
docker ps
|
142
|
+
```
|
143
|
+
|
144
|
+
### Using the containers
|
145
|
+
|
146
|
+
Once the containers are up and running, they're assigned random port numbers from docker which are available on the
|
147
|
+
ip address of the VM used to run the containers. To make the discovery of these ports simpler there's the following
|
148
|
+
command:
|
149
|
+
|
150
|
+
```bash
|
151
|
+
spurious ports
|
152
|
+
```
|
153
|
+
|
154
|
+
that returns the list of host and port details for each of the spurious containers. If you pass the flag --json you'll
|
155
|
+
get the result back as a JSON string so you can then parse this and use it to automatically configure your chosen method of working with AWS.
|
156
|
+
|
157
|
+
### SDK Helpers
|
158
|
+
|
159
|
+
Once the containers are running you'll need to wire up the SDK to point to the correct endpoints and port numbers. Here's
|
160
|
+
and example using the ruby SDK:
|
161
|
+
|
162
|
+
```ruby
|
163
|
+
require 'json'
|
164
|
+
|
165
|
+
port_config = JSON.parse(`spurious ports --json`)
|
166
|
+
|
167
|
+
AWS.config(
|
168
|
+
:region => 'eu-west-1',
|
169
|
+
:use_ssl => false,
|
170
|
+
:access_key_id => "access",
|
171
|
+
:secret_access_key => "secret",
|
172
|
+
:dynamo_db_endpoint => port_config['spurious-dynamo']['Host'],
|
173
|
+
:dynamo_db_port => port_config['spurious-dynamo']['HostPort'],
|
174
|
+
:sqs_endpoint => port_config['spurious-sqs']['Host'],
|
175
|
+
:sqs_port => port_config['spurious-sqs']['HostPort'],
|
176
|
+
:s3_endpoint => port_config['spurious-s3']['Host'],
|
177
|
+
:s3_port => port_config['spurious-s3']['HostPort'],
|
178
|
+
:s3_force_path_style => true
|
179
|
+
)
|
180
|
+
|
181
|
+
```
|
182
|
+
|
183
|
+
There are also helpers available for the different flavours of the AWS SDK:
|
184
|
+
|
185
|
+
#### Ruby
|
186
|
+
|
187
|
+
* [Spurious ruby AWS SDK Helper](https://github.com/stevenjack/spurious-ruby-awssdk-helper)
|
188
|
+
|
189
|
+
|
190
|
+
#### PHP/Java/Node.js
|
191
|
+
|
192
|
+
> Coming soon
|
22
193
|
|
23
194
|
## Contributing
|
24
195
|
|
data/lib/spurious/version.rb
CHANGED
data/spurious.gemspec
CHANGED
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency "rake"
|
26
26
|
spec.add_development_dependency "rspec"
|
27
27
|
|
28
|
+
spec.add_runtime_dependency "thor"
|
28
29
|
spec.add_runtime_dependency "spurious-server"
|
29
30
|
spec.add_runtime_dependency "eventmachine"
|
30
31
|
spec.add_runtime_dependency "timeout"
|
data/tools/install.sh
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
vercomp () {
|
4
|
+
if [[ $1 == $2 ]]
|
5
|
+
then
|
6
|
+
return 0
|
7
|
+
fi
|
8
|
+
local IFS=.
|
9
|
+
local i ver1=($1) ver2=($2)
|
10
|
+
# fill empty fields in ver1 with zeros
|
11
|
+
for ((i=${#ver1[@]}; i<${#ver2[@]}; i++))
|
12
|
+
do
|
13
|
+
ver1[i]=0
|
14
|
+
done
|
15
|
+
for ((i=0; i<${#ver1[@]}; i++))
|
16
|
+
do
|
17
|
+
if [[ -z ${ver2[i]} ]]
|
18
|
+
then
|
19
|
+
# fill empty fields in ver2 with zeros
|
20
|
+
ver2[i]=0
|
21
|
+
fi
|
22
|
+
if ((10#${ver1[i]} > 10#${ver2[i]}))
|
23
|
+
then
|
24
|
+
return 1
|
25
|
+
fi
|
26
|
+
if ((10#${ver1[i]} < 10#${ver2[i]}))
|
27
|
+
then
|
28
|
+
return 2
|
29
|
+
fi
|
30
|
+
done
|
31
|
+
return 0
|
32
|
+
}
|
33
|
+
|
34
|
+
if [[ $(command -v docker) ]]; then
|
35
|
+
DOCKER_VERSION=$(docker -v | cut -d',' -f 1 | cut -d' ' -f 3)
|
36
|
+
vercomp $DOCKER_VERSION "1.1.0"
|
37
|
+
if [[ $? == 2 ]]; then
|
38
|
+
echo "You must have version 1.1.0 of the docker client installed, currently installed: $DOCKER_VERSION"
|
39
|
+
exit 1
|
40
|
+
fi
|
41
|
+
fi
|
42
|
+
|
43
|
+
if [[ $(command -v boot2docker) ]]; then
|
44
|
+
BOOT2DOCKER_VERSION=$(boot2docker version | grep Client | cut -d':' -f 2 | sed 's/v//g')
|
45
|
+
vercomp $BOOT2DOCKER_VERSION "1.1.0"
|
46
|
+
if [[ $? == 2 ]]; then
|
47
|
+
echo "You must have version 1.1.0 of boot2docker client installed, currently installed: $BOOT2DOCKER_VERSION"
|
48
|
+
exit 1
|
49
|
+
fi
|
50
|
+
fi
|
51
|
+
|
52
|
+
if [[ $(command -v ruby) ]]; then
|
53
|
+
RUBY_VERSION=$(ruby -v | cut -d' ' -f2 | cut -d'p' -f1)
|
54
|
+
vercomp $RUBY_VERSION "1.9"
|
55
|
+
if [[ $? == 2 ]]; then
|
56
|
+
echo "You must have version 1.9 or greater of ruby installed, currently installed: $(ruby -v)"
|
57
|
+
exit 1
|
58
|
+
fi
|
59
|
+
fi
|
60
|
+
|
61
|
+
echo '[install] Starting install of docker and boot2docker using brew'
|
62
|
+
brew install docker boot2docker
|
63
|
+
echo '[install] Initializing boot2docker'
|
64
|
+
boot2docker init
|
65
|
+
echo '[install] Starting boot2docker'
|
66
|
+
boot2docker up
|
67
|
+
echo '[install] Installing spurious'
|
68
|
+
gem install spurious
|
69
|
+
echo '[install] Starting spurious server'
|
70
|
+
DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375 spurious-server start
|
71
|
+
echo '[install] Initializing spurious'
|
72
|
+
spurious init
|
73
|
+
echo '[install] Starting spurious'
|
74
|
+
spurious start
|
75
|
+
echo '\n----------------------'
|
76
|
+
echo 'Installation complete'
|
77
|
+
echo '\nPlease add the following export to you ~/.bashrc or ~/.zshrc:'
|
78
|
+
echo "\nexport DOCKER_HOST=tcp://$(boot2docker ip 2>/dev/null):2375"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spurious
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Jack
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-07-
|
11
|
+
date: 2014-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docker
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: thor
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: spurious-server
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -146,6 +160,7 @@ files:
|
|
146
160
|
- spec/config_spec.rb
|
147
161
|
- spec/helper.rb
|
148
162
|
- spurious.gemspec
|
163
|
+
- tools/install.sh
|
149
164
|
homepage: ''
|
150
165
|
licenses:
|
151
166
|
- MIT
|
@@ -166,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
166
181
|
version: '0'
|
167
182
|
requirements: []
|
168
183
|
rubyforge_project:
|
169
|
-
rubygems_version: 2.
|
184
|
+
rubygems_version: 2.2.2
|
170
185
|
signing_key:
|
171
186
|
specification_version: 4
|
172
187
|
summary: Spurious is a cli tool that interacts with the spurious server
|