engineyard-local 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +23 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +62 -0
- data/README.md +115 -0
- data/Rakefile +15 -0
- data/bin/ey-local +4 -0
- data/config/dna.json +206 -0
- data/config/locales/en.yml +57 -0
- data/config/settings.yml +18 -0
- data/config/solo.rb +7 -0
- data/engineyard-local.gemspec +24 -0
- data/install/deb/README.md +72 -0
- data/install/deb/Rakefile +157 -0
- data/install/deb/Vagrantfile +10 -0
- data/install/deb/install.sh +32 -0
- data/install/osx/README.md +23 -0
- data/install/osx/Rakefile +39 -0
- data/install/osx/engineyard-local/engineyard-local.pkgproj +812 -0
- data/install/osx/images/eylocal_installer.png +0 -0
- data/install/osx/scripts/log.sh +3 -0
- data/install/osx/scripts/postinstall +57 -0
- data/install/osx/scripts/rvm_install.sh +34 -0
- data/lib/engineyard-local.rb +42 -0
- data/lib/engineyard-local/command.rb +65 -0
- data/lib/engineyard-local/command/base.rb +15 -0
- data/lib/engineyard-local/command/exec.rb +11 -0
- data/lib/engineyard-local/command/group.rb +86 -0
- data/lib/engineyard-local/command/helpers.rb +23 -0
- data/lib/engineyard-local/command/list.rb +29 -0
- data/lib/engineyard-local/command/rails.rb +19 -0
- data/lib/engineyard-local/command/up.rb +87 -0
- data/lib/engineyard-local/command/vagrant_action.rb +11 -0
- data/lib/engineyard-local/errors.rb +10 -0
- data/lib/engineyard-local/middleware.rb +28 -0
- data/lib/engineyard-local/middleware/bundle.rb +40 -0
- data/lib/engineyard-local/middleware/chef.rb +44 -0
- data/lib/engineyard-local/middleware/default_provisioner.rb +34 -0
- data/lib/engineyard-local/middleware/dna.rb +80 -0
- data/lib/engineyard-local/middleware/exec.rb +27 -0
- data/lib/engineyard-local/middleware/helpers.rb +4 -0
- data/lib/engineyard-local/middleware/helpers/executable.rb +27 -0
- data/lib/engineyard-local/middleware/helpers/network.rb +20 -0
- data/lib/engineyard-local/middleware/helpers/rvm.rb +37 -0
- data/lib/engineyard-local/middleware/helpers/uploadable.rb +14 -0
- data/lib/engineyard-local/middleware/network.rb +64 -0
- data/lib/engineyard-local/middleware/rails.rb +3 -0
- data/lib/engineyard-local/middleware/rails/command.rb +31 -0
- data/lib/engineyard-local/middleware/rails/db.rb +36 -0
- data/lib/engineyard-local/middleware/rails/install.rb +36 -0
- data/lib/engineyard-local/middleware/rails/new.rb +31 -0
- data/lib/engineyard-local/middleware/tag.rb +33 -0
- data/lib/engineyard-local/ui.rb +33 -0
- data/lib/engineyard-local/version.rb +5 -0
- data/lib/engineyard-local/virtualbox.rb +35 -0
- data/lib/vagrant_init.rb +1 -0
- data/test/engineyard-local/command/group_test.rb +34 -0
- data/test/engineyard-local/command/up_test.rb +70 -0
- data/test/engineyard-local/command_test.rb +40 -0
- data/test/engineyard-local/middelware/bundle_test.rb +32 -0
- data/test/engineyard-local/middelware/default_provisioner_test.rb +35 -0
- data/test/engineyard-local/middelware/exec_test.rb +19 -0
- data/test/engineyard-local/middelware/network_test.rb +94 -0
- data/test/engineyard-local/middelware/rails/command_test.rb +24 -0
- data/test/engineyard-local/middelware/rails/db_test.rb +23 -0
- data/test/engineyard-local/middelware/rails/install_test.rb +24 -0
- data/test/engineyard-local/ui_test.rb +22 -0
- data/test/engineyard-local/virtualbox_test.rb +34 -0
- data/test/integration/up_test.rb +28 -0
- data/test/test_helper.rb +78 -0
- metadata +178 -0
data/.gitignore
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
*.gem
|
2
|
+
.rvmrc
|
3
|
+
.bundle
|
4
|
+
pkg/*
|
5
|
+
boxes/eysd-rack/stack
|
6
|
+
boxes/eysd-rack/log
|
7
|
+
boxes/eysd-rack/public
|
8
|
+
boxes/eysd-rack/tmp
|
9
|
+
install/deb/vendor
|
10
|
+
install/deb/ruby-*
|
11
|
+
install/deb/description-pak
|
12
|
+
install/deb/rubygems*
|
13
|
+
install/osx/tmp
|
14
|
+
install/osx/vendor
|
15
|
+
install/osx/*.mpkg
|
16
|
+
install/osx/*.pkg
|
17
|
+
*.deb
|
18
|
+
*.tar.gz
|
19
|
+
*.ru
|
20
|
+
*.box
|
21
|
+
.DS_Store
|
22
|
+
test/tmp
|
23
|
+
debug
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
engineyard-local (0.1.0)
|
5
|
+
thor (~> 0.14.6)
|
6
|
+
vagrant (= 1.0.1)
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: http://rubygems.org/
|
10
|
+
specs:
|
11
|
+
archive-tar-minitar (0.5.2)
|
12
|
+
childprocess (0.3.1)
|
13
|
+
ffi (~> 1.0.6)
|
14
|
+
columnize (0.3.6)
|
15
|
+
erubis (2.7.0)
|
16
|
+
ffi (1.0.11)
|
17
|
+
fpm (0.3.11)
|
18
|
+
json
|
19
|
+
i18n (0.6.0)
|
20
|
+
json (1.5.4)
|
21
|
+
linecache19 (0.5.12)
|
22
|
+
ruby_core_source (>= 0.1.4)
|
23
|
+
log4r (1.1.10)
|
24
|
+
metaclass (0.0.1)
|
25
|
+
mocha (0.10.5)
|
26
|
+
metaclass (~> 0.0.1)
|
27
|
+
net-scp (1.0.4)
|
28
|
+
net-ssh (>= 1.99.1)
|
29
|
+
net-ssh (2.2.2)
|
30
|
+
rake (0.9.2.2)
|
31
|
+
ruby-debug-base19 (0.11.25)
|
32
|
+
columnize (>= 0.3.1)
|
33
|
+
linecache19 (>= 0.5.11)
|
34
|
+
ruby_core_source (>= 0.1.4)
|
35
|
+
ruby-debug19 (0.11.6)
|
36
|
+
columnize (>= 0.3.1)
|
37
|
+
linecache19 (>= 0.5.11)
|
38
|
+
ruby-debug-base19 (>= 0.11.19)
|
39
|
+
ruby_core_source (0.1.5)
|
40
|
+
archive-tar-minitar (>= 0.5.2)
|
41
|
+
shoulda-context (1.0.0)
|
42
|
+
thor (0.14.6)
|
43
|
+
vagrant (1.0.1)
|
44
|
+
archive-tar-minitar (= 0.5.2)
|
45
|
+
childprocess (~> 0.3.1)
|
46
|
+
erubis (~> 2.7.0)
|
47
|
+
i18n (~> 0.6.0)
|
48
|
+
json (~> 1.5.1)
|
49
|
+
log4r (~> 1.1.9)
|
50
|
+
net-scp (~> 1.0.4)
|
51
|
+
net-ssh (~> 2.2.2)
|
52
|
+
|
53
|
+
PLATFORMS
|
54
|
+
ruby
|
55
|
+
|
56
|
+
DEPENDENCIES
|
57
|
+
engineyard-local!
|
58
|
+
fpm
|
59
|
+
mocha
|
60
|
+
rake
|
61
|
+
ruby-debug19
|
62
|
+
shoulda-context
|
data/README.md
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
# Engineyard Local
|
2
|
+
|
3
|
+
Engineyard Local brings the production virtual environment of Enginyard Cloud to your workstation. As a wrapper around [Vagrant](http://vagrantup.com) it uses VirtualBox, Ruby, and a custom prepackaged virtual machine image to make the creation and management of your local development environment easy, and customizations to your production environment testable.
|
4
|
+
|
5
|
+
## Contact
|
6
|
+
|
7
|
+
Team members can be found on `irc.oftc.net` in `#ey-local`.
|
8
|
+
|
9
|
+
## Bugs
|
10
|
+
|
11
|
+
If you have a bug please post it to the issues list, preferrable answering the following questions:
|
12
|
+
|
13
|
+
1. What host platform are your running?
|
14
|
+
2. What version of VirtualBox do you have installed? `VBoxManage -v`
|
15
|
+
3. What version of the engineyard-local gem do you have installed? `ey-local version`
|
16
|
+
4. What version of the vagrant gem do you have installed? `vagrant -v`
|
17
|
+
|
18
|
+
Please also provide gist or other dump of the output that illustrates the problem.
|
19
|
+
|
20
|
+
## Installation
|
21
|
+
|
22
|
+
There are two primary methods of installation. If you're an OS X user you can download and run the prebuilt installer which will handle installing VirtualBox, vagrant and ey-local for you. Alternatively you can install [VirtualBox](https://www.virtualbox.org/wiki/Downloads) and [Ruby](http://www.ruby-lang.org/en/downloads/) for your platform and then perform:
|
23
|
+
|
24
|
+
$ gem install engineyard-local
|
25
|
+
|
26
|
+
Once the install is complete you're ready to get started.
|
27
|
+
|
28
|
+
## Common Use
|
29
|
+
|
30
|
+
Engineyard Local works from the root directory of your Rack based project. You can fire up a virtual environment from there with one command:
|
31
|
+
|
32
|
+
$ cd my/app/
|
33
|
+
$ ey-local up
|
34
|
+
[ey-local] Downloading with Vagrant::Downloaders::HTTP...
|
35
|
+
|
36
|
+
If you've never used ey-local before, or _did not_ use the OS X installer, it will begin the process by downloading the base virtual machine image from which all ey-local virtual environments are built. This will only happen once and ey-local will use the downloaded box for all subsequent virtual environments.
|
37
|
+
|
38
|
+
After the download the virtual machine will be created and you'll be able to visit your app by pointing your browser at `33.33.33.10` which represents the virtual machine's host network location.
|
39
|
+
|
40
|
+
From there you can edit your application files and see the application results as you normally would in your browser.
|
41
|
+
|
42
|
+
### Stop
|
43
|
+
|
44
|
+
After working on your application you might wish to suspend the virtual machine so it's not eating up cpu cycles while you're doing some thing else. Simply issue:
|
45
|
+
|
46
|
+
$ ey-local stop
|
47
|
+
|
48
|
+
From the project directory to suspend the vm.
|
49
|
+
|
50
|
+
### Start
|
51
|
+
|
52
|
+
To restart the project after suspending it
|
53
|
+
|
54
|
+
$ ey-local start
|
55
|
+
|
56
|
+
### Other Commands
|
57
|
+
|
58
|
+
For other sub commands including `list`, `rails`, `log`, and `exec` please use:
|
59
|
+
|
60
|
+
$ ey-local help
|
61
|
+
|
62
|
+
Also, ey-local is a wrapper around Vagrant itself and any commands that aren't defined for ey-local will be passed through to vagrant for execution. For example provisioning an ey-local environment is as simple as:
|
63
|
+
|
64
|
+
$ ey-local provision
|
65
|
+
|
66
|
+
You can learn more about `provision` and other Vagrant commands in the [Vagrant docs](http://vagrantup.com/docs/commands.html) or see `vagrant help` for more.
|
67
|
+
|
68
|
+
### Provisioning with Chef
|
69
|
+
|
70
|
+
In addition to the facilities for vm provisioning provided through the Vagrantfile, ey-local also includes a sane default for chef recipes when no other provisioning mechanism is defined. To take advantage of the default simply place your recipe at `$PROJECT_ROOT/cookbooks/main/recipes/default.rb`. From there you can require other recipes.
|
71
|
+
|
72
|
+
## Contributions
|
73
|
+
|
74
|
+
Pull requests are the preferred method for contribution to the project with a couple general guidelines:
|
75
|
+
|
76
|
+
1. **Keep changesets small**. Every changed line has to be reviewed so the smaller each change is the faster the review process will be.
|
77
|
+
2. **Keep commits small**. Keeping each child commit of a pull request small makes managing the git history easier especially for things like bisect. Additionally if the commits require a rebase by a team member resolving conflicts will be much less painful.
|
78
|
+
3. **Discuss large changes**. If you are compelled to make some drastic change to the source please consult the team using the methods detailed earlier.
|
79
|
+
|
80
|
+
### Layout
|
81
|
+
|
82
|
+
The project layout uses the standard ruby gem folder structure. The best starting point for interested parties new to the source is at `lib/engineyard-local/command/group.rb`. There you'll find the Thor based command setup that is the entry point to ey-local's functionality. Thor is a holdover/stopgap before moving to the vagrant command structure, and is mostly a proxy for the command classes in the same subdirectory.
|
83
|
+
|
84
|
+
Upon viewing the individual command classes you'll likely be interested in the middleware that are used to operate on the vagrant virtual machines. The middleware is the primary abstraction that is used to keep each unit of work tiny and manageable. All of those and their helpers are to be found int the `lib/engineyard-local/middleware/` directory.
|
85
|
+
|
86
|
+
### Installers
|
87
|
+
|
88
|
+
There are two installation mechanisms for ey-local in the `install` subdirectory, one for a osx package and one for debs. Each has a detailed readme (`install/deb/README.md`, `install/osx/README.md`) on how to creat the packages including a full vagrant environment for the debs.
|
89
|
+
|
90
|
+
### Installing HEAD
|
91
|
+
|
92
|
+
You can install the latest from the repository with the following:
|
93
|
+
|
94
|
+
$ bundle install --path=./.bundle
|
95
|
+
$ bundle exec rake build
|
96
|
+
$ gem install pkg/engineyard-local-<VERSION>.gem
|
97
|
+
|
98
|
+
### Tests
|
99
|
+
|
100
|
+
There are a fairly minimal set of mock/stub based unit tests
|
101
|
+
|
102
|
+
$ bundle install --path=./.bundle
|
103
|
+
$ bundle exec rake test
|
104
|
+
|
105
|
+
If you're developing on ruby 1.8 your bundle install should exclude the `:dev` group.
|
106
|
+
|
107
|
+
$ bundle install --without=dev --path=./.bundle
|
108
|
+
|
109
|
+
If you're feeling brave you are welcome to run the integration tests as well though they will create and destroy vms over a long period of time. After the bundle install:
|
110
|
+
|
111
|
+
$ bundle exec rake integration
|
112
|
+
|
113
|
+
You can also prefix that with a `DEBUG=true` to see the output from the tested commands.
|
114
|
+
|
115
|
+
$ DEBUG=true bundle exec rake integration
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'rake/testtask'
|
3
|
+
Bundler::GemHelper.install_tasks
|
4
|
+
|
5
|
+
task :default => :test
|
6
|
+
|
7
|
+
Rake::TestTask.new do |t|
|
8
|
+
t.libs << "test"
|
9
|
+
t.test_files = Rake::FileList["./test/engineyard-local/**/*_test.rb"]
|
10
|
+
end
|
11
|
+
|
12
|
+
Rake::TestTask.new(:integration) do |t|
|
13
|
+
t.libs << "test"
|
14
|
+
t.test_files = Rake::FileList["./test/integration/**/*_test.rb"]
|
15
|
+
end
|
data/bin/ey-local
ADDED
data/config/dna.json
ADDED
@@ -0,0 +1,206 @@
|
|
1
|
+
{
|
2
|
+
"db_slaves": [
|
3
|
+
],
|
4
|
+
"nodejs": {
|
5
|
+
"version": "0.6.1"
|
6
|
+
},
|
7
|
+
"nginx": {
|
8
|
+
"version": "1.0.10-r1"
|
9
|
+
},
|
10
|
+
"aws_secret_key": "",
|
11
|
+
"ruby_version": "Ruby 1.9.3",
|
12
|
+
"backup_interval": 24,
|
13
|
+
"internal_ssh_public_key": "",
|
14
|
+
"admin_ssh_key": "",
|
15
|
+
"user_ssh_key": [
|
16
|
+
|
17
|
+
],
|
18
|
+
"internal_ssh_private_key": "",
|
19
|
+
"utility_instances": [
|
20
|
+
|
21
|
+
],
|
22
|
+
"mailserver": "smtp.engineyard.com",
|
23
|
+
"instance_role": "eylocal",
|
24
|
+
"crons": [
|
25
|
+
|
26
|
+
],
|
27
|
+
"removed_applications": [
|
28
|
+
],
|
29
|
+
"backup_window": 10,
|
30
|
+
"gems_to_install": [
|
31
|
+
{
|
32
|
+
"name": "bundler"
|
33
|
+
}
|
34
|
+
],
|
35
|
+
"alert_email": "",
|
36
|
+
"applications": {
|
37
|
+
"APPNAME": {
|
38
|
+
"auth": {
|
39
|
+
"active": false
|
40
|
+
},
|
41
|
+
"newrelic": false,
|
42
|
+
"https_bind_port": 443,
|
43
|
+
"type": "APPTYPE",
|
44
|
+
"migration_command": "bundle exec rake db:migrate",
|
45
|
+
"repository_name": "APPURL",
|
46
|
+
"revision": "APPREVISION",
|
47
|
+
"http_bind_port": 80,
|
48
|
+
"run_deploy": false,
|
49
|
+
"branch": "HEAD",
|
50
|
+
"deploy_key": "",
|
51
|
+
"deploy_action": "deploy",
|
52
|
+
"run_migrations": false,
|
53
|
+
"services": [
|
54
|
+
{
|
55
|
+
"resource": "mongrel",
|
56
|
+
"mongrel_base_port": 5000,
|
57
|
+
"mongrel_mem_limit": 150,
|
58
|
+
"mongrel_instance_count": 3
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"resource": "memcached",
|
62
|
+
"base_port": 11211,
|
63
|
+
"mem_limit": 128
|
64
|
+
}
|
65
|
+
],
|
66
|
+
"recipes": [
|
67
|
+
"memcached",
|
68
|
+
"monit",
|
69
|
+
"nginx",
|
70
|
+
"nginx-passenger"
|
71
|
+
],
|
72
|
+
"vhosts": [
|
73
|
+
{
|
74
|
+
"name": "_",
|
75
|
+
"role": "prod"
|
76
|
+
}
|
77
|
+
]
|
78
|
+
}
|
79
|
+
},
|
80
|
+
"aws_secret_id": "",
|
81
|
+
"environment": {
|
82
|
+
"name": "prod",
|
83
|
+
"stack": "nginx_passenger3",
|
84
|
+
"framework_env": "production"
|
85
|
+
},
|
86
|
+
"reporting_url": "",
|
87
|
+
"users": [
|
88
|
+
{
|
89
|
+
"gid": "1000",
|
90
|
+
"username": "vagrant",
|
91
|
+
"uid": "1000",
|
92
|
+
"password": "abc123unme",
|
93
|
+
"comment": ""
|
94
|
+
}
|
95
|
+
],
|
96
|
+
"db_host": "ey-local",
|
97
|
+
"packages_to_install": [
|
98
|
+
|
99
|
+
],
|
100
|
+
"haproxy": {
|
101
|
+
"username": "vagrant",
|
102
|
+
"password": "abc123unme"
|
103
|
+
},
|
104
|
+
"engineyard": {
|
105
|
+
"environment": {
|
106
|
+
"apps": [
|
107
|
+
{
|
108
|
+
"name": "APPNAME",
|
109
|
+
"newrelic": false,
|
110
|
+
"migration_command": "rake db:migrate",
|
111
|
+
"type": "APPTYPE",
|
112
|
+
"components": [
|
113
|
+
|
114
|
+
],
|
115
|
+
"database_name": "APPNAME",
|
116
|
+
"repository_name": "APPURL",
|
117
|
+
"revision": "APPREVISION",
|
118
|
+
"run_deploy": false,
|
119
|
+
"bundled": null,
|
120
|
+
"branch": "HEAD",
|
121
|
+
"deploy_key": "",
|
122
|
+
"deploy_action": "deploy",
|
123
|
+
"run_migrations": false,
|
124
|
+
"gems": [
|
125
|
+
|
126
|
+
],
|
127
|
+
"vhosts": [
|
128
|
+
{
|
129
|
+
"ssl_cert": null,
|
130
|
+
"domain_name": "_"
|
131
|
+
}
|
132
|
+
],
|
133
|
+
"ebuilds": [
|
134
|
+
|
135
|
+
]
|
136
|
+
}
|
137
|
+
],
|
138
|
+
"ssh_keys": [
|
139
|
+
|
140
|
+
],
|
141
|
+
"aws_secret_key": "",
|
142
|
+
"name": "prod",
|
143
|
+
"ruby_version": null,
|
144
|
+
"instances": [
|
145
|
+
{
|
146
|
+
"name": null,
|
147
|
+
"public_hostname": "ey-local",
|
148
|
+
"stonith_config": {
|
149
|
+
"endpoint_uri": "https://cloud.engineyard.com/stonith",
|
150
|
+
"endpoint_token": "69576b03-5ad5-4774-acec-452fbad20a76",
|
151
|
+
"monitor_host": "ey-local",
|
152
|
+
"endpoint_id": "ey-local"
|
153
|
+
},
|
154
|
+
"role": "solo",
|
155
|
+
"components": [
|
156
|
+
{
|
157
|
+
"key": "ssmtp"
|
158
|
+
}
|
159
|
+
],
|
160
|
+
"enabled": true,
|
161
|
+
"id": "ey-local",
|
162
|
+
"private_hostname": "ey-local",
|
163
|
+
"reporting_url": "",
|
164
|
+
"instance_api_config": {
|
165
|
+
"token": "",
|
166
|
+
"base_url": "https://cloud.engineyard.com/instance_api",
|
167
|
+
"instance_id": ""
|
168
|
+
},
|
169
|
+
"awsm_token": ""
|
170
|
+
}
|
171
|
+
],
|
172
|
+
"framework_env": "production",
|
173
|
+
"stonith_endpoint": "https://cloud.engineyard.com/stonith",
|
174
|
+
"backup_interval": 24,
|
175
|
+
"ssh_username": "vagrant",
|
176
|
+
"internal_ssh_public_key": "",
|
177
|
+
"admin_ssh_key": "",
|
178
|
+
"region": "us-east-1",
|
179
|
+
"internal_ssh_private_key": "",
|
180
|
+
"mailserver": "smtp.engineyard.com",
|
181
|
+
"components": [
|
182
|
+
{
|
183
|
+
"key": "ruby_193"
|
184
|
+
},
|
185
|
+
{
|
186
|
+
"key": "passenger3"
|
187
|
+
}
|
188
|
+
],
|
189
|
+
"crons": [
|
190
|
+
|
191
|
+
],
|
192
|
+
"stats_password": "abc123unme",
|
193
|
+
"backup_window": 10,
|
194
|
+
"stack_name": "nginx_passenger3",
|
195
|
+
"ssh_password": "abc123unme",
|
196
|
+
"backup_bucket": "",
|
197
|
+
"alert_email": "ALERT_EMAIL",
|
198
|
+
"db_stack_name": "mysql",
|
199
|
+
"aws_secret_id": "",
|
200
|
+
"monitoring": "monit",
|
201
|
+
"newrelic_key": null
|
202
|
+
},
|
203
|
+
"this": "ey-local"
|
204
|
+
}
|
205
|
+
}
|
206
|
+
|