rubynas 0.1.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +23 -0
- data/.gitmodules +3 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +196 -0
- data/Guardfile +8 -0
- data/LICENSE.txt +7 -0
- data/Procfile +2 -0
- data/README.md +151 -0
- data/Rakefile +14 -0
- data/Vagrantfile +99 -0
- data/bin/rubynas +63 -0
- data/config.ru +5 -0
- data/doc/README_FOR_APP +2 -0
- data/doc/macosx_shares.png +0 -0
- data/doc/shares_overview.png +0 -0
- data/lib/rubynas.rb +35 -0
- data/lib/rubynas/apis/group_api.rb +51 -0
- data/lib/rubynas/apis/system_information_api.rb +13 -0
- data/lib/rubynas/apis/user_api.rb +85 -0
- data/lib/rubynas/apis/volume_api.rb +50 -0
- data/lib/rubynas/config.rb +63 -0
- data/lib/rubynas/db/migrate/20130302164415_devise_create_users.rb +46 -0
- data/lib/rubynas/db/migrate/20130322143040_create_volumes.rb +10 -0
- data/lib/rubynas/db/migrate/20130331102556_create_shared_folders.rb +10 -0
- data/lib/rubynas/db/migrate/20130331103034_create_shared_folder_services.rb +11 -0
- data/lib/rubynas/installers/base_installer.rb +70 -0
- data/lib/rubynas/installers/debian_installer.rb +199 -0
- data/lib/rubynas/installers/ubuntu_installer.rb +2 -0
- data/lib/rubynas/installers/ubuntu_precise_installer.rb +2 -0
- data/lib/rubynas/models/.gitkeep +0 -0
- data/lib/rubynas/models/ldap_group.rb +21 -0
- data/lib/rubynas/models/ldap_org_unit.rb +13 -0
- data/lib/rubynas/models/ldap_user.rb +31 -0
- data/lib/rubynas/models/shared_folder.rb +32 -0
- data/lib/rubynas/models/shared_folder_service.rb +15 -0
- data/lib/rubynas/models/volume.rb +16 -0
- data/lib/rubynas/services/afp_share_service.rb +9 -0
- data/lib/rubynas/services/service.rb +4 -0
- data/lib/rubynas/services/share_service.rb +3 -0
- data/lib/rubynas/version.rb +3 -0
- data/rubynas.gemspec +69 -0
- data/rubynas.ini +24 -0
- data/sandbox/ldap/base.ldif +50 -0
- data/sandbox/ldap/data/.gitkeep +0 -0
- data/sandbox/ldap/data/dc=rubynas,dc=com.ldif +14 -0
- data/sandbox/ldap/local.schema +6 -0
- data/sandbox/ldap/schema/README +80 -0
- data/sandbox/ldap/schema/apple.schema +1727 -0
- data/sandbox/ldap/schema/apple_auxillary.schema +20 -0
- data/sandbox/ldap/schema/collective.ldif +48 -0
- data/sandbox/ldap/schema/collective.schema +190 -0
- data/sandbox/ldap/schema/corba.ldif +42 -0
- data/sandbox/ldap/schema/corba.schema +239 -0
- data/sandbox/ldap/schema/core.ldif +591 -0
- data/sandbox/ldap/schema/core.schema +610 -0
- data/sandbox/ldap/schema/cosine.ldif +200 -0
- data/sandbox/ldap/schema/cosine.schema +2571 -0
- data/sandbox/ldap/schema/duaconf.ldif +83 -0
- data/sandbox/ldap/schema/duaconf.schema +261 -0
- data/sandbox/ldap/schema/dyngroup.ldif +71 -0
- data/sandbox/ldap/schema/dyngroup.schema +91 -0
- data/sandbox/ldap/schema/fmserver.schema +60 -0
- data/sandbox/ldap/schema/inetorgperson.ldif +69 -0
- data/sandbox/ldap/schema/inetorgperson.schema +155 -0
- data/sandbox/ldap/schema/java.ldif +59 -0
- data/sandbox/ldap/schema/java.schema +403 -0
- data/sandbox/ldap/schema/krb5-kdc.schema +134 -0
- data/sandbox/ldap/schema/microsoft.ext.schema +5383 -0
- data/sandbox/ldap/schema/microsoft.schema +4835 -0
- data/sandbox/ldap/schema/microsoft.std.schema +480 -0
- data/sandbox/ldap/schema/misc.ldif +45 -0
- data/sandbox/ldap/schema/misc.schema +75 -0
- data/sandbox/ldap/schema/netinfo.schema +240 -0
- data/sandbox/ldap/schema/nis.ldif +120 -0
- data/sandbox/ldap/schema/nis.schema +241 -0
- data/sandbox/ldap/schema/openldap.ldif +88 -0
- data/sandbox/ldap/schema/openldap.schema +54 -0
- data/sandbox/ldap/schema/pmi.ldif +123 -0
- data/sandbox/ldap/schema/pmi.schema +464 -0
- data/sandbox/ldap/schema/ppolicy.ldif +75 -0
- data/sandbox/ldap/schema/ppolicy.schema +531 -0
- data/sandbox/ldap/schema/samba.schema +179 -0
- data/sandbox/ldap/slapd.conf +99 -0
- data/spec/apis/group_api_spec.rb +97 -0
- data/spec/apis/system_information_api_spec.rb +27 -0
- data/spec/apis/user_api_spec.rb +113 -0
- data/spec/apis/volume_api_spec.rb +98 -0
- data/spec/factories/ldap_group.rb +16 -0
- data/spec/factories/ldap_users.rb +24 -0
- data/spec/factories/shared_folder_services.rb +9 -0
- data/spec/factories/shared_folders.rb +15 -0
- data/spec/factories/users.rb +8 -0
- data/spec/factories/volumes.rb +10 -0
- data/spec/installer/base_installer_spec.rb +35 -0
- data/spec/installer/debian_installer_spec.rb +86 -0
- data/spec/models/ldap_group_spec.rb +21 -0
- data/spec/models/ldap_org_unit_spec.rb +19 -0
- data/spec/models/ldap_user_spec.rb +19 -0
- data/spec/models/shared_folder_service_spec.rb +25 -0
- data/spec/models/shared_folder_spec.rb +27 -0
- data/spec/models/volume_spec.rb +5 -0
- data/spec/services/afp_share_service_spec.rb +5 -0
- data/spec/services/service_spec.rb +5 -0
- data/spec/services/share_service_spec.rb +5 -0
- data/spec/spec_helper.rb +30 -0
- data/spec/support/db_cleaner.rb +16 -0
- data/spec/support/factory_girl.rb +7 -0
- data/spec/support/logger.rb +1 -0
- data/spec/support/rack-test.rb +6 -0
- metadata +633 -0
data/.gitignore
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile ~/.gitignore_global
|
6
|
+
|
7
|
+
# Ignore bundler config
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
# Ignore all logfiles and tempfiles.
|
11
|
+
/log/*.log
|
12
|
+
/tmp
|
13
|
+
/coverage
|
14
|
+
|
15
|
+
# Sandbox
|
16
|
+
sandbox/ldap/data/slapd.*
|
17
|
+
sandbox/ldap/data/dc=rubynas,dc=com/
|
18
|
+
|
19
|
+
.DS_Store
|
20
|
+
.vagrant
|
21
|
+
.ruby-gemset
|
22
|
+
pkg
|
23
|
+
rubynas.sqlite3
|
data/.gitmodules
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,196 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rubynas (0.1.0.pre.1)
|
5
|
+
activeldap (~> 3.2.2)
|
6
|
+
activerecord (= 3.2.13)
|
7
|
+
dnssd
|
8
|
+
foreman
|
9
|
+
grape
|
10
|
+
grape-entity
|
11
|
+
inifile
|
12
|
+
lumberjack
|
13
|
+
lumberjack_syslog_device
|
14
|
+
net-ldap
|
15
|
+
netatalk-config
|
16
|
+
puma
|
17
|
+
sqlite3
|
18
|
+
vmstat
|
19
|
+
|
20
|
+
GEM
|
21
|
+
remote: https://rubygems.org/
|
22
|
+
specs:
|
23
|
+
activeldap (3.2.2)
|
24
|
+
activemodel (~> 3.2.8)
|
25
|
+
gettext
|
26
|
+
gettext_i18n_rails
|
27
|
+
locale
|
28
|
+
activemodel (3.2.13)
|
29
|
+
activesupport (= 3.2.13)
|
30
|
+
builder (~> 3.0.0)
|
31
|
+
activerecord (3.2.13)
|
32
|
+
activemodel (= 3.2.13)
|
33
|
+
activesupport (= 3.2.13)
|
34
|
+
arel (~> 3.0.2)
|
35
|
+
tzinfo (~> 0.3.29)
|
36
|
+
activesupport (3.2.13)
|
37
|
+
i18n (= 0.6.1)
|
38
|
+
multi_json (~> 1.0)
|
39
|
+
arel (3.0.2)
|
40
|
+
backports (3.3.1)
|
41
|
+
brakeman (2.0.0)
|
42
|
+
erubis (~> 2.6)
|
43
|
+
fastercsv (~> 1.5)
|
44
|
+
haml (>= 3.0, < 5.0)
|
45
|
+
highline (~> 1.6.19)
|
46
|
+
multi_json (~> 1.2)
|
47
|
+
ruby2ruby (~> 2.0.5)
|
48
|
+
ruby_parser (~> 3.1.1)
|
49
|
+
sass (~> 3.0)
|
50
|
+
slim (~> 1.3.6)
|
51
|
+
terminal-table (~> 1.4)
|
52
|
+
builder (3.0.4)
|
53
|
+
bundler-audit (0.1.2)
|
54
|
+
bundler (~> 1.2)
|
55
|
+
cane (2.6.0)
|
56
|
+
parallel
|
57
|
+
coderay (1.0.9)
|
58
|
+
database_cleaner (1.0.1)
|
59
|
+
descendants_tracker (0.0.1)
|
60
|
+
diff-lcs (1.2.4)
|
61
|
+
dnssd (2.0)
|
62
|
+
dotenv (0.7.0)
|
63
|
+
erubis (2.7.0)
|
64
|
+
factory_girl (4.2.0)
|
65
|
+
activesupport (>= 3.0.0)
|
66
|
+
fast_gettext (0.7.0)
|
67
|
+
fastercsv (1.5.5)
|
68
|
+
ffi (1.8.1)
|
69
|
+
foreman (0.63.0)
|
70
|
+
dotenv (>= 0.7)
|
71
|
+
thor (>= 0.13.6)
|
72
|
+
formatador (0.2.4)
|
73
|
+
gettext (2.3.9)
|
74
|
+
locale
|
75
|
+
text
|
76
|
+
gettext_i18n_rails (0.10.0)
|
77
|
+
fast_gettext (>= 0.4.8)
|
78
|
+
grape (0.4.1)
|
79
|
+
activesupport
|
80
|
+
builder
|
81
|
+
hashie (>= 1.2.0)
|
82
|
+
multi_json (>= 1.3.2)
|
83
|
+
multi_xml (>= 0.5.2)
|
84
|
+
rack (>= 1.3.0)
|
85
|
+
rack-accept
|
86
|
+
rack-mount
|
87
|
+
virtus
|
88
|
+
grape-entity (0.3.0)
|
89
|
+
activesupport
|
90
|
+
multi_json (>= 1.3.2)
|
91
|
+
guard (1.8.0)
|
92
|
+
formatador (>= 0.2.4)
|
93
|
+
listen (>= 1.0.0)
|
94
|
+
lumberjack (>= 1.0.2)
|
95
|
+
pry (>= 0.9.10)
|
96
|
+
thor (>= 0.14.6)
|
97
|
+
guard-rspec (3.0.1)
|
98
|
+
guard (>= 1.8)
|
99
|
+
rspec (~> 2.13)
|
100
|
+
haml (4.0.3)
|
101
|
+
tilt
|
102
|
+
hashie (2.0.5)
|
103
|
+
highline (1.6.19)
|
104
|
+
i18n (0.6.1)
|
105
|
+
inifile (2.0.2)
|
106
|
+
listen (1.1.6)
|
107
|
+
rb-fsevent (>= 0.9.3)
|
108
|
+
rb-inotify (>= 0.9)
|
109
|
+
rb-kqueue (>= 0.2)
|
110
|
+
locale (2.0.8)
|
111
|
+
lumberjack (1.0.3)
|
112
|
+
lumberjack_syslog_device (1.0.0)
|
113
|
+
lumberjack (~> 1.0)
|
114
|
+
method_source (0.8.1)
|
115
|
+
multi_json (1.7.6)
|
116
|
+
multi_xml (0.5.4)
|
117
|
+
net-ldap (0.3.1)
|
118
|
+
netatalk-config (0.0.2)
|
119
|
+
rspec
|
120
|
+
parallel (0.6.5)
|
121
|
+
pry (0.9.12.2)
|
122
|
+
coderay (~> 1.0.5)
|
123
|
+
method_source (~> 0.8)
|
124
|
+
slop (~> 3.4)
|
125
|
+
puma (2.0.1)
|
126
|
+
rack (>= 1.1, < 2.0)
|
127
|
+
rack (1.5.2)
|
128
|
+
rack-accept (0.4.5)
|
129
|
+
rack (>= 0.4)
|
130
|
+
rack-mount (0.8.3)
|
131
|
+
rack (>= 1.0.0)
|
132
|
+
rack-test (0.6.2)
|
133
|
+
rack (>= 1.0)
|
134
|
+
rake (10.0.4)
|
135
|
+
rb-fsevent (0.9.3)
|
136
|
+
rb-inotify (0.9.0)
|
137
|
+
ffi (>= 0.5.0)
|
138
|
+
rb-kqueue (0.2.0)
|
139
|
+
ffi (>= 0.5.0)
|
140
|
+
rspec (2.13.0)
|
141
|
+
rspec-core (~> 2.13.0)
|
142
|
+
rspec-expectations (~> 2.13.0)
|
143
|
+
rspec-mocks (~> 2.13.0)
|
144
|
+
rspec-core (2.13.1)
|
145
|
+
rspec-expectations (2.13.0)
|
146
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
147
|
+
rspec-mocks (2.13.1)
|
148
|
+
ruby2ruby (2.0.5)
|
149
|
+
ruby_parser (~> 3.1)
|
150
|
+
sexp_processor (~> 4.0)
|
151
|
+
ruby_parser (3.1.3)
|
152
|
+
sexp_processor (~> 4.1)
|
153
|
+
sass (3.2.9)
|
154
|
+
sexp_processor (4.2.1)
|
155
|
+
shoulda-matchers (2.1.0)
|
156
|
+
activesupport (>= 3.0.0)
|
157
|
+
simplecov (0.7.1)
|
158
|
+
multi_json (~> 1.0)
|
159
|
+
simplecov-html (~> 0.7.1)
|
160
|
+
simplecov-html (0.7.1)
|
161
|
+
simplecov-rcov-text (0.0.2)
|
162
|
+
slim (1.3.9)
|
163
|
+
temple (~> 0.6.3)
|
164
|
+
tilt (~> 1.3, >= 1.3.3)
|
165
|
+
slop (3.4.5)
|
166
|
+
sqlite3 (1.3.7)
|
167
|
+
temple (0.6.5)
|
168
|
+
terminal-table (1.4.5)
|
169
|
+
text (1.2.1)
|
170
|
+
thor (0.18.1)
|
171
|
+
tilt (1.4.1)
|
172
|
+
tzinfo (0.3.37)
|
173
|
+
virtus (0.5.5)
|
174
|
+
backports (~> 3.3)
|
175
|
+
descendants_tracker (~> 0.0.1)
|
176
|
+
vmstat (2.0.0)
|
177
|
+
|
178
|
+
PLATFORMS
|
179
|
+
ruby
|
180
|
+
|
181
|
+
DEPENDENCIES
|
182
|
+
brakeman
|
183
|
+
bundler (~> 1.3)
|
184
|
+
bundler-audit
|
185
|
+
cane
|
186
|
+
database_cleaner
|
187
|
+
factory_girl (~> 4.0)
|
188
|
+
guard-rspec
|
189
|
+
rack-test
|
190
|
+
rake
|
191
|
+
rb-fsevent (~> 0.9)
|
192
|
+
rspec
|
193
|
+
rubynas!
|
194
|
+
shoulda-matchers
|
195
|
+
simplecov
|
196
|
+
simplecov-rcov-text
|
data/Guardfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright (c) 2013 Vincent Landgraf
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Procfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,151 @@
|
|
1
|
+
# rubynas
|
2
|
+
|
3
|
+
## Install
|
4
|
+
|
5
|
+
On Ubuntu do the following:
|
6
|
+
|
7
|
+
# sudo apt-get install ruby1.9.3 libsqlite3-dev libavahi-compat-libdnssd-dev
|
8
|
+
# sudo ruby1.9.3 -S gem install rubynas
|
9
|
+
# rubynas install --admin admin --domain rubynas.com --password secret
|
10
|
+
|
11
|
+
The rubynas api will be exposed using the mdns service. Typically its available on https://localhost:5100/api/. Maybe replace `localhost` by the name of your server.
|
12
|
+
|
13
|
+
|
14
|
+
## Development
|
15
|
+
|
16
|
+
### Getting Started
|
17
|
+
|
18
|
+
To start developing simply start foreman:
|
19
|
+
|
20
|
+
foreman start
|
21
|
+
|
22
|
+
Login with one of the users in the ldap:
|
23
|
+
|
24
|
+
email: admin@rubynas.com or user@rubynas.com
|
25
|
+
password: secret
|
26
|
+
|
27
|
+
### Run the tests
|
28
|
+
|
29
|
+
Since the tests depend on the LDAP you have to start it first with:
|
30
|
+
|
31
|
+
foreman start
|
32
|
+
|
33
|
+
Then use either:
|
34
|
+
|
35
|
+
rake spec
|
36
|
+
|
37
|
+
|
38
|
+
## Directories
|
39
|
+
|
40
|
+
This project has a typical rails layout plus:
|
41
|
+
|
42
|
+
* **sandbox** place for local ldap server and the like
|
43
|
+
|
44
|
+
## Concepts
|
45
|
+
|
46
|
+
### Shares
|
47
|
+
|
48
|
+
The following section describes how shares "should be/are" implemented in rubynas.
|
49
|
+
|
50
|
+
The general idea more or less oriented how mac os x is handling shares with a bit more flexibility. Here a short reminder on that:
|
51
|
+
|
52
|
+
![Mac OS X Shares Overview](doc/macosx_shares.png "Mac OS X")
|
53
|
+
|
54
|
+
Basically we can create a share which has a location and users or groups that can access it. Unlike mac os x the user can specify in which way the share is exposed. In other words it should be possible to tell per share if it can be accessed by AFP, SMB etc.
|
55
|
+
|
56
|
+
### Share Entity
|
57
|
+
|
58
|
+
Bases on the idea above we got the following structure:
|
59
|
+
|
60
|
+
* Name (String) Name of the share
|
61
|
+
* Path (String) Posix path to the share
|
62
|
+
* Permissions (Array<Permission>) A list with users, groups that have access to the share
|
63
|
+
* Services (Array<Service>) A list of services that should expose the share. Imagine the following list:
|
64
|
+
* NFS
|
65
|
+
* AFP
|
66
|
+
* RSYNC
|
67
|
+
* SMB
|
68
|
+
* CIFS
|
69
|
+
* Options (Hash<Service, Hash>) A hash of options extra for each of the sharing services.
|
70
|
+
|
71
|
+
### Permission Entity
|
72
|
+
|
73
|
+
A Permission is either based on a group or user. The reference to the **ldap user** and **ldap group** has to be made using the **common name**.
|
74
|
+
|
75
|
+
* Read (Boolean) true if the permissions grants read access
|
76
|
+
* Write (Boolean) true if the permission grants write access
|
77
|
+
* User (LdapUser) the ldap user that is permitted
|
78
|
+
* Group (LdapGroup) the ldap user that is permitted
|
79
|
+
|
80
|
+
### Interaction
|
81
|
+
|
82
|
+
To actually apply the share configuration to the services there are several layers which control the sharing service (aftp, smb, ...) and it's configuration. Here a quick visualization, of the layers (the api is the initiator):
|
83
|
+
|
84
|
+
![Shares Overview](doc/shares_overview.png "rubynas shares")
|
85
|
+
|
86
|
+
The shares API which is instrumented by the frontend, it manipulates the share models. This means creating, updating and changing shares. After the API did a manipulation to the shares it will call `ShareService.update_all` which will trigger an update on each and every service.
|
87
|
+
|
88
|
+
Speaking of a sharing service: It needs to inherit from `ShareService` and implement the `#update!` method like this example:
|
89
|
+
|
90
|
+
class AfpShareService < ShareService
|
91
|
+
service_name :netatalk
|
92
|
+
|
93
|
+
def update!
|
94
|
+
if AfpServiceConfiguration.update
|
95
|
+
restart # supplied by base class
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
The update basically creates a new rendered version of the configuration and makes a hash on the content. Next it checkes if the old config has the same hash, if it does, `false` is returned and nothing happens. If the hash is different the configuration will be replaced and update returns `true` so that the service is going to be restarted.
|
101
|
+
|
102
|
+
In order for a `ShareService` to be so simple a lot of magic needs to happen in the background. This will be described further below. Now regarding the configuration:
|
103
|
+
|
104
|
+
class AfpServiceConfiguration < ShareServiceConfiguration
|
105
|
+
config_file 'afp.conf'
|
106
|
+
|
107
|
+
def time_machine(share)
|
108
|
+
share.options[self][:time_machine] ? 'yes' : 'no'
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
112
|
+
And here is the template for the configuration above:
|
113
|
+
|
114
|
+
;
|
115
|
+
; Netatalk 3.x configuration file
|
116
|
+
;
|
117
|
+
|
118
|
+
[Global]
|
119
|
+
; log level = default:maxdebug
|
120
|
+
log file = /var/log/netatalk
|
121
|
+
uam list = uams_dhx.so uams_dhx2.so
|
122
|
+
|
123
|
+
[Homes]
|
124
|
+
basedir regex = /home
|
125
|
+
|
126
|
+
<% @shares.each do |share| %>
|
127
|
+
[<%= @share.name %>]
|
128
|
+
path = <%= @share.path %>
|
129
|
+
time machine = <%= time_machine(share) %>
|
130
|
+
<% end %>
|
131
|
+
|
132
|
+
### Magic
|
133
|
+
|
134
|
+
The magic behind scenes is basically done by the superclasses. They know how to start the a service and where the configuration files are placed. Main part of that magic is the automatic system and configuration detection. This is described in the section OS.
|
135
|
+
|
136
|
+
### Config service (idea)
|
137
|
+
|
138
|
+
The configuration needs administrative access to the system. Because every system has a different way to manage processes and a different way to configure this processes, this part is moved to a different project to keep the core clean from system and os details. This examples illustrates a possible restful interface
|
139
|
+
|
140
|
+
GET http://service.local/services
|
141
|
+
=> each service with status
|
142
|
+
POST http://service.local/services/netatalk/start
|
143
|
+
=> 200 started, 403 already started
|
144
|
+
POST http://service.local/services/netatalk/restart
|
145
|
+
=> 200 restarted
|
146
|
+
POST http://service.local/services/netatalk/stop
|
147
|
+
=> 200 stopped, 403 already stopped
|
148
|
+
GET http://service.local/services/netatalk
|
149
|
+
=> Status
|
150
|
+
PUT http://service.local/services/netatalk/config
|
151
|
+
=> 200 updated, 302 not updated
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
require 'bundler/gem_tasks'
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
|
5
|
+
desc 'Run specs'
|
6
|
+
RSpec::Core::RakeTask.new(:spec => :compile)
|
7
|
+
|
8
|
+
desc 'Open a pry session preloaded with smartstat'
|
9
|
+
task :console do
|
10
|
+
sh 'irb -rubygems -I ./lib -r rubynas'
|
11
|
+
end
|
12
|
+
|
13
|
+
desc 'Default: run specs.'
|
14
|
+
task :default => :spec
|
data/Vagrantfile
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
Vagrant::Config.run do |config|
|
5
|
+
# All Vagrant configuration is done here. The most common configuration
|
6
|
+
# options are documented and commented below. For a complete reference,
|
7
|
+
# please see the online documentation at vagrantup.com.
|
8
|
+
|
9
|
+
# Every Vagrant virtual environment requires a box to build off of.
|
10
|
+
config.vm.box = "ubuntu-1204"
|
11
|
+
|
12
|
+
# The url from where the 'config.vm.box' box will be fetched if it
|
13
|
+
# doesn't already exist on the user's system.
|
14
|
+
config.vm.box_url = "http://dl.dropbox.com/u/4031118/Vagrant/ubuntu-12.04.1-server-i686-virtual.box"
|
15
|
+
|
16
|
+
# Boot with a GUI so you can see the screen. (Default is headless)
|
17
|
+
# config.vm.boot_mode = :gui
|
18
|
+
|
19
|
+
# Assign this VM to a host-only network IP, allowing you to access it
|
20
|
+
# via the IP. Host-only networks can talk to the host machine as well as
|
21
|
+
# any other machines on the same network, but cannot be accessed (through this
|
22
|
+
# network interface) by any external networks.
|
23
|
+
config.vm.network :hostonly, "192.168.33.20"
|
24
|
+
|
25
|
+
# Assign this VM to a bridged network, allowing you to connect directly to a
|
26
|
+
# network using the host's network device. This makes the VM appear as another
|
27
|
+
# physical device on your network.
|
28
|
+
# config.vm.network :bridged
|
29
|
+
|
30
|
+
# Forward a port from the guest to the host, which allows for outside
|
31
|
+
# computers to access the VM, whereas host only networking does not.
|
32
|
+
# config.vm.forward_port 80, 8080
|
33
|
+
|
34
|
+
# Share an additional folder to the guest VM. The first argument is
|
35
|
+
# an identifier, the second is the path on the guest to mount the
|
36
|
+
# folder, and the third is the path on the host to the actual folder.
|
37
|
+
# config.vm.share_folder "v-data", "/vagrant_data", "../data"
|
38
|
+
|
39
|
+
# Enable provisioning with Puppet stand alone. Puppet manifests
|
40
|
+
# are contained in a directory path relative to this Vagrantfile.
|
41
|
+
# You will need to create the manifests directory and a manifest in
|
42
|
+
# the file ubuntu-1204.pp in the manifests_path directory.
|
43
|
+
#
|
44
|
+
# An example Puppet manifest to provision the message of the day:
|
45
|
+
#
|
46
|
+
# # group { "puppet":
|
47
|
+
# # ensure => "present",
|
48
|
+
# # }
|
49
|
+
# #
|
50
|
+
# # File { owner => 0, group => 0, mode => 0644 }
|
51
|
+
# #
|
52
|
+
# # file { '/etc/motd':
|
53
|
+
# # content => "Welcome to your Vagrant-built virtual machine!
|
54
|
+
# # Managed by Puppet.\n"
|
55
|
+
# # }
|
56
|
+
#
|
57
|
+
# config.vm.provision :puppet do |puppet|
|
58
|
+
# puppet.manifests_path = "manifests"
|
59
|
+
# puppet.manifest_file = "ubuntu-1204.pp"
|
60
|
+
# end
|
61
|
+
|
62
|
+
# Enable provisioning with chef solo, specifying a cookbooks path, roles
|
63
|
+
# path, and data_bags path (all relative to this Vagrantfile), and adding
|
64
|
+
# some recipes and/or roles.
|
65
|
+
#
|
66
|
+
# config.vm.provision :chef_solo do |chef|
|
67
|
+
# chef.cookbooks_path = "../my-recipes/cookbooks"
|
68
|
+
# chef.roles_path = "../my-recipes/roles"
|
69
|
+
# chef.data_bags_path = "../my-recipes/data_bags"
|
70
|
+
# chef.add_recipe "mysql"
|
71
|
+
# chef.add_role "web"
|
72
|
+
#
|
73
|
+
# # You may also specify custom JSON attributes:
|
74
|
+
# chef.json = { :mysql_password => "foo" }
|
75
|
+
# end
|
76
|
+
|
77
|
+
# Enable provisioning with chef server, specifying the chef server URL,
|
78
|
+
# and the path to the validation key (relative to this Vagrantfile).
|
79
|
+
#
|
80
|
+
# The Opscode Platform uses HTTPS. Substitute your organization for
|
81
|
+
# ORGNAME in the URL and validation key.
|
82
|
+
#
|
83
|
+
# If you have your own Chef Server, use the appropriate URL, which may be
|
84
|
+
# HTTP instead of HTTPS depending on your configuration. Also change the
|
85
|
+
# validation key to validation.pem.
|
86
|
+
#
|
87
|
+
# config.vm.provision :chef_client do |chef|
|
88
|
+
# chef.chef_server_url = "https://api.opscode.com/organizations/ORGNAME"
|
89
|
+
# chef.validation_key_path = "ORGNAME-validator.pem"
|
90
|
+
# end
|
91
|
+
#
|
92
|
+
# If you're using the Opscode platform, your validator client is
|
93
|
+
# ORGNAME-validator, replacing ORGNAME with your organization name.
|
94
|
+
#
|
95
|
+
# IF you have your own Chef Server, the default validation client name is
|
96
|
+
# chef-validator, unless you changed the configuration.
|
97
|
+
#
|
98
|
+
# chef.validation_client_name = "ORGNAME-validator"
|
99
|
+
end
|