farmstead 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +26 -0
- data/.rspec +3 -0
- data/.rubocop.yml +148 -0
- data/.travis.yml +5 -0
- data/.yardopts +2 -0
- data/Gemfile +35 -0
- data/LICENSE.txt +21 -0
- data/README.md +110 -0
- data/Rakefile +6 -0
- data/bin/console +18 -0
- data/bin/setup +8 -0
- data/examples/myproject.yml +23 -0
- data/farmstead.gemspec +26 -0
- data/lib/farmstead.rb +46 -0
- data/lib/farmstead/cli.rb +47 -0
- data/lib/farmstead/cowardlylion.rb +41 -0
- data/lib/farmstead/glenda.rb +99 -0
- data/lib/farmstead/project.rb +79 -0
- data/lib/farmstead/scarecrow.rb +55 -0
- data/lib/farmstead/service.rb +89 -0
- data/lib/farmstead/tinman.rb +49 -0
- data/lib/farmstead/version.rb +3 -0
- data/scaffold/.dockerignore.erb +6 -0
- data/scaffold/.env.erb +9 -0
- data/scaffold/Dockerfile-dorothy.erb +24 -0
- data/scaffold/Dockerfile.erb +25 -0
- data/scaffold/Gemfile.erb +36 -0
- data/scaffold/app/controllers/application_controller.rb.erb +6 -0
- data/scaffold/docker-compose.yml.erb +72 -0
- data/scaffold/exec.sh.erb +25 -0
- data/scaffold/exec.sh.erb.old +57 -0
- data/scaffold/supervisord.conf.erb +10 -0
- metadata +121 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 3e3c1869967a48ec7d9a3e457b8581b0dd94c84e
|
4
|
+
data.tar.gz: 60e3c66863f512c334ba875494cca177dfd422a8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 14685151776dbc81a792391fe98fc28a11581d9cc04d9c5c5820e2e33dcf4259efb9af322b4b097b4d972add0e39eb6c6b8c1168f7280e656aa36db7f655acf0
|
7
|
+
data.tar.gz: 423fee21c397e561b8d958560cf3306b5533564eee60519ef37323b8d2d0a3f025eab092d0babed4dc58daf1197bed021b03f95fdfed21ff13a42c4a4c47d9af
|
data/.gitignore
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/_yardoc/
|
4
|
+
/coverage/
|
5
|
+
/doc/
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/tmp/
|
9
|
+
|
10
|
+
# rspec failure tracking
|
11
|
+
.rspec_status
|
12
|
+
|
13
|
+
tmp/
|
14
|
+
log/
|
15
|
+
.Gemfile
|
16
|
+
.ruby-version
|
17
|
+
.byebug_history
|
18
|
+
debug.log
|
19
|
+
pkg
|
20
|
+
/.bundle
|
21
|
+
/dist
|
22
|
+
/doc/rdoc
|
23
|
+
/*/doc
|
24
|
+
/*/test/tmp
|
25
|
+
rebuild.sh
|
26
|
+
*.gem
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,148 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.4
|
3
|
+
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
|
4
|
+
# to ignore them, so only the ones explicitly set in this file are enabled.
|
5
|
+
DisabledByDefault: true
|
6
|
+
Exclude:
|
7
|
+
- '**/templates/**/*'
|
8
|
+
- '**/vendor/**/*'
|
9
|
+
|
10
|
+
# Prefer &&/|| over and/or.
|
11
|
+
Style/AndOr:
|
12
|
+
Enabled: true
|
13
|
+
|
14
|
+
# Do not use braces for hash literals when they are the last argument of a
|
15
|
+
# method call.
|
16
|
+
Style/BracesAroundHashParameters:
|
17
|
+
Enabled: true
|
18
|
+
EnforcedStyle: context_dependent
|
19
|
+
|
20
|
+
# Align `when` with `case`.
|
21
|
+
Layout/CaseIndentation:
|
22
|
+
Enabled: true
|
23
|
+
|
24
|
+
# Align comments with method definitions.
|
25
|
+
Layout/CommentIndentation:
|
26
|
+
Enabled: true
|
27
|
+
|
28
|
+
Layout/EmptyLineAfterMagicComment:
|
29
|
+
Enabled: true
|
30
|
+
|
31
|
+
# In a regular class definition, no empty lines around the body.
|
32
|
+
Layout/EmptyLinesAroundClassBody:
|
33
|
+
Enabled: true
|
34
|
+
|
35
|
+
# In a regular method definition, no empty lines around the body.
|
36
|
+
Layout/EmptyLinesAroundMethodBody:
|
37
|
+
Enabled: true
|
38
|
+
|
39
|
+
# In a regular module definition, no empty lines around the body.
|
40
|
+
Layout/EmptyLinesAroundModuleBody:
|
41
|
+
Enabled: true
|
42
|
+
|
43
|
+
Layout/FirstParameterIndentation:
|
44
|
+
Enabled: true
|
45
|
+
|
46
|
+
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
|
47
|
+
Style/HashSyntax:
|
48
|
+
Enabled: true
|
49
|
+
|
50
|
+
# Method definitions after `private` or `protected` isolated calls need one
|
51
|
+
# extra level of indentation.
|
52
|
+
Layout/IndentationConsistency:
|
53
|
+
Enabled: true
|
54
|
+
EnforcedStyle: rails
|
55
|
+
|
56
|
+
# Two spaces, no tabs (for indentation).
|
57
|
+
Layout/IndentationWidth:
|
58
|
+
Enabled: true
|
59
|
+
|
60
|
+
Layout/LeadingCommentSpace:
|
61
|
+
Enabled: true
|
62
|
+
|
63
|
+
Layout/SpaceAfterColon:
|
64
|
+
Enabled: true
|
65
|
+
|
66
|
+
Layout/SpaceAfterComma:
|
67
|
+
Enabled: true
|
68
|
+
|
69
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
70
|
+
Enabled: true
|
71
|
+
|
72
|
+
Layout/SpaceAroundKeyword:
|
73
|
+
Enabled: true
|
74
|
+
|
75
|
+
Layout/SpaceAroundOperators:
|
76
|
+
Enabled: true
|
77
|
+
|
78
|
+
Layout/SpaceBeforeComma:
|
79
|
+
Enabled: true
|
80
|
+
|
81
|
+
Layout/SpaceBeforeFirstArg:
|
82
|
+
Enabled: true
|
83
|
+
|
84
|
+
Style/DefWithParentheses:
|
85
|
+
Enabled: true
|
86
|
+
|
87
|
+
# Defining a method with parameters needs parentheses.
|
88
|
+
Style/MethodDefParentheses:
|
89
|
+
Enabled: true
|
90
|
+
|
91
|
+
Style/FrozenStringLiteralComment:
|
92
|
+
Enabled: true
|
93
|
+
EnforcedStyle: always
|
94
|
+
#Exclude:
|
95
|
+
|
96
|
+
# Use `foo {}` not `foo{}`.
|
97
|
+
Layout/SpaceBeforeBlockBraces:
|
98
|
+
Enabled: true
|
99
|
+
|
100
|
+
# Use `foo { bar }` not `foo {bar}`.
|
101
|
+
Layout/SpaceInsideBlockBraces:
|
102
|
+
Enabled: true
|
103
|
+
|
104
|
+
# Use `{ a: 1 }` not `{a:1}`.
|
105
|
+
Layout/SpaceInsideHashLiteralBraces:
|
106
|
+
Enabled: true
|
107
|
+
|
108
|
+
Layout/SpaceInsideParens:
|
109
|
+
Enabled: true
|
110
|
+
|
111
|
+
# Check quotes usage according to lint rule below.
|
112
|
+
Style/StringLiterals:
|
113
|
+
Enabled: true
|
114
|
+
EnforcedStyle: double_quotes
|
115
|
+
|
116
|
+
# Detect hard tabs, no hard tabs.
|
117
|
+
Layout/Tab:
|
118
|
+
Enabled: true
|
119
|
+
|
120
|
+
# Blank lines should not have any spaces.
|
121
|
+
Layout/TrailingBlankLines:
|
122
|
+
Enabled: true
|
123
|
+
|
124
|
+
# No trailing whitespace.
|
125
|
+
Layout/TrailingWhitespace:
|
126
|
+
Enabled: true
|
127
|
+
|
128
|
+
# Use quotes for string literals when they are enough.
|
129
|
+
Style/UnneededPercentQ:
|
130
|
+
Enabled: true
|
131
|
+
|
132
|
+
# Align `end` with the matching keyword or starting expression except for
|
133
|
+
# assignments, where it should be aligned with the LHS.
|
134
|
+
Lint/EndAlignment:
|
135
|
+
Enabled: true
|
136
|
+
EnforcedStyleAlignWith: variable
|
137
|
+
|
138
|
+
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
139
|
+
Lint/RequireParentheses:
|
140
|
+
Enabled: true
|
141
|
+
|
142
|
+
Style/RedundantReturn:
|
143
|
+
Enabled: true
|
144
|
+
AllowMultipleReturnValues: true
|
145
|
+
|
146
|
+
Style/Semicolon:
|
147
|
+
Enabled: true
|
148
|
+
AllowAsExpressionSeparator: true
|
data/.travis.yml
ADDED
data/.yardopts
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in farmstead.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
gem "coffee-rails", "~> 4.2"
|
9
|
+
gem "httparty", "~> 0.15.6"
|
10
|
+
gem "jbuilder", "~> 2.5"
|
11
|
+
gem "jquery-rails", "~> 4.3.1"
|
12
|
+
gem "mechanize", "~> 2.7.5"
|
13
|
+
gem "mysql2", "~> 0.4.10"
|
14
|
+
gem "nokogiri", "~> 1.8.1"
|
15
|
+
gem "omniauth-auth0", "~> 2.0.0"
|
16
|
+
gem "puma", "~> 3.0"
|
17
|
+
gem "rails", "~> 5.0.0"
|
18
|
+
gem "ruby-kafka", "~> 0.5.1"
|
19
|
+
gem "sass-rails", "~> 5.0"
|
20
|
+
gem "turbolinks", "~> 5"
|
21
|
+
gem "uglifier", ">= 1.3.0"
|
22
|
+
gem "watir", "~> 6.10"
|
23
|
+
|
24
|
+
group :development, :test do
|
25
|
+
gem "byebug", platform: :mri
|
26
|
+
end
|
27
|
+
|
28
|
+
group :development do
|
29
|
+
gem "dotenv", "~> 0.11.1"
|
30
|
+
gem "listen", "~> 3.0.5"
|
31
|
+
gem "pry"
|
32
|
+
gem "spring"
|
33
|
+
gem "spring-watcher-listen", "~> 2.0.0"
|
34
|
+
gem "web-console"
|
35
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Ken Jenney
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
# farmstead
|
2
|
+
|
3
|
+
[![Build Status](https://api.travis-ci.org/mastermindg/farmstead.svg?branch=master)](http://travis-ci.org/mastermindg/farmstead)
|
4
|
+
|
5
|
+
Farmstead is a modular data pipeline platform. Farmstead makes creating and deploying a fully-functional data pipeline a snap. It is built on top of Rails/Ruby and uses Docker. This combination allows for a super-fast deployment and prototyping process.
|
6
|
+
|
7
|
+
|
8
|
+
## Table of Contents
|
9
|
+
|
10
|
+
<!-- TOC depthFrom:1 depthTo:6 withLinks:1 orderedList:0 -->
|
11
|
+
|
12
|
+
- [Getting started](#getting-started)
|
13
|
+
- [Configuration](#configuration)
|
14
|
+
- [Environment Variables](#env)
|
15
|
+
- [Deployment Methods](#deployment)
|
16
|
+
- [Architecture](#architecture)
|
17
|
+
- [Scheduler - Glenda](#glenda)
|
18
|
+
- [Fertilize - Tinman](#tinman)
|
19
|
+
- [Harvest - Scarecrow](#scarecrow)
|
20
|
+
- [Mill - CowardlyLion](#cowardlylion)
|
21
|
+
- [Serve - Dorothy](#dorothy)
|
22
|
+
- [License](#license)
|
23
|
+
|
24
|
+
<!-- /TOC -->
|
25
|
+
|
26
|
+
|
27
|
+
## Getting Started
|
28
|
+
|
29
|
+
To get started you'll need to install the Farmstead gem:
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
gem install farmstead
|
33
|
+
```
|
34
|
+
|
35
|
+
To create a new Farmstead project:
|
36
|
+
|
37
|
+
```
|
38
|
+
farmstead new myproject
|
39
|
+
cd myproject
|
40
|
+
farmstead start
|
41
|
+
```
|
42
|
+
|
43
|
+
### Configuration
|
44
|
+
|
45
|
+
Farmstead tries to follow Rails conventions. Some of the configuration options are available from the command-line. For instance, to chose a different database techhnology use the -d flag:
|
46
|
+
|
47
|
+
```
|
48
|
+
farmstead new myproject -d postgres
|
49
|
+
```
|
50
|
+
|
51
|
+
There are default values for database users and passwords. For more advanced usages you can use a configuration file. A configuration file must be written in YAML and is passed to Farmstead via command-line:
|
52
|
+
|
53
|
+
```
|
54
|
+
farmstead new myproject -c myproject.yml
|
55
|
+
```
|
56
|
+
|
57
|
+
An example configuration file is included.
|
58
|
+
|
59
|
+
### Environment Variables
|
60
|
+
|
61
|
+
Farmstead builds projects on Docker. In order to keep secrets out of the Rails code we use environment varibles. These are read from the .env file at the root of the project. This is IGNORED in Git, so be sure to keep these safe in a deployment/build system (i.e. Jenkins).
|
62
|
+
|
63
|
+
Keep in mind that you can always customize the Rails application using further using more environment variables as well.
|
64
|
+
|
65
|
+
### Deployment Methods
|
66
|
+
|
67
|
+
The default method is Docker. It is also possible to deploy using Rancher and Kubernetes (on top of Docker). To deploy using another method use the -x flag:
|
68
|
+
|
69
|
+
|
70
|
+
```
|
71
|
+
farmstead new myproject -x kubernetes
|
72
|
+
```
|
73
|
+
|
74
|
+
## Architecture
|
75
|
+
|
76
|
+
Kafka and Database ETL
|
77
|
+
|
78
|
+
Presently only Dorothy is running Rails. The rest of the services are only running a Kafka consumer and producer. Eventually that will change.
|
79
|
+
|
80
|
+
### Scheduler - Glenda
|
81
|
+
|
82
|
+
Glenda
|
83
|
+
|
84
|
+
### Fertilize - Tinman
|
85
|
+
|
86
|
+
Tinman
|
87
|
+
|
88
|
+
### Harvest - Scarecrow
|
89
|
+
|
90
|
+
Scarecrow
|
91
|
+
|
92
|
+
### Mill - CowardlyLion
|
93
|
+
|
94
|
+
Cowardlylion
|
95
|
+
|
96
|
+
### Serve - Dorothy
|
97
|
+
|
98
|
+
Dorothy
|
99
|
+
|
100
|
+
## License
|
101
|
+
|
102
|
+
MIT
|
103
|
+
|
104
|
+
|
105
|
+
## TODO
|
106
|
+
|
107
|
+
1. Find out how to create roles for Dorothy
|
108
|
+
2. Get Micro-services working
|
109
|
+
3. Figure out how to get Selenium working or if it's necessary (Selenium)
|
110
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "farmstead"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
# require "irb"
|
14
|
+
# IRB.start(__FILE__)
|
15
|
+
|
16
|
+
require "farmstead"
|
17
|
+
|
18
|
+
Farmstead::CLI.start(ARGV)
|
data/bin/setup
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
- name: My Project
|
2
|
+
hosts: 127.0.0.1
|
3
|
+
connection: local
|
4
|
+
gather_facts: False
|
5
|
+
remote_user: root
|
6
|
+
roles:
|
7
|
+
- create
|
8
|
+
|
9
|
+
AUTH0_CLIENT_ID={CLIENT_ID}
|
10
|
+
AUTH0_CLIENT_SECRET={CLIENT_SECRET}
|
11
|
+
AUTH0_DOMAIN={DOMAIN}
|
12
|
+
AUTH0_CALLBACK_URL=http://localhost:3000/auth/auth0/callback
|
13
|
+
AUTH0_AUDIENCE=
|
14
|
+
MYSQL_ROOT_PASSWORD=Rc2$NE99p5%^
|
15
|
+
MYSQL_DATABASE=farmstead
|
16
|
+
MYSQL_USER=farmstead
|
17
|
+
MYSQL_PASSWORD=farmstead
|
18
|
+
MYSQL_HOST=mysql
|
19
|
+
RAILS_ENV=development
|
20
|
+
KAFKA_ADVERTISED_HOST_NAME=192.168.1.13
|
21
|
+
KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
|
22
|
+
KAFKA_CREATE_TOPICS=Wood:1:1,Field:1:1,Forest:1:1,Road:1:1
|
23
|
+
|
data/farmstead.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
lib = File.expand_path("../lib", __FILE__)
|
2
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
+
require "farmstead/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "farmstead"
|
7
|
+
spec.version = Farmstead::VERSION
|
8
|
+
spec.authors = ["Ken Jenney"]
|
9
|
+
spec.email = ["mastermindg@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "Farmstead is a modular data pipeline platform."
|
12
|
+
spec.description = "Farmstead is a modular data pipeline platform. Farmstead makes creating and deploying a fully-functional data pipeline a snap. It is built on top of Rails/Ruby and uses Docker. This combination allows for a super-fast deployment and prototyping process."
|
13
|
+
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
17
|
+
f.match(%r{^(test|spec|features)/})
|
18
|
+
end
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
26
|
+
end
|