Skip to content

Commit

Permalink
blargh config layout changes
Browse files Browse the repository at this point in the history
  • Loading branch information
iancoffey committed Feb 1, 2013
1 parent 074f253 commit 39acff9
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 51 deletions.
37 changes: 5 additions & 32 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -1,40 +1,10 @@
require 'berkshelf/vagrant'

Vagrant::Config.run do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.

# The path to the Berksfile to use with Vagrant Berkshelf
# config.berkshelf.berksfile_path = "./Berksfile"

# An array of symbols representing groups of cookbook described in the Vagrantfile
# to skip installing and copying to Vagrant's shelf.
# config.berkshelf.only = []

# An array of symbols representing groups of cookbook described in the Vagrantfile
# to skip installing and copying to Vagrant's shelf.
# config.berkshelf.except = []

config.vm.host_name = "crystalline-berkshelf"

# config.vm.box = "Berkshelf-CentOS-6.3-x86_64-minimal"
# config.vm.box_url = "https://dl.dropbox.com/u/31081437/Berkshelf-CentOS-6.3-x86_64-minimal.box"
config.vm.box = "lucid32"

# Boot with a GUI so you can see the screen. (Default is headless)
# config.vm.boot_mode = :gui

# Assign this VM to a host-only network IP, allowing you to access it
# via the IP. Host-only networks can talk to the host machine as well as
# any other machines on the same network, but cannot be accessed (through this
# network interface) by any external networks.
config.vm.network :hostonly, "33.33.33.10"

# Assign this VM to a bridged network, allowing you to connect directly to a
# network using the host's network device. This makes the VM appear as another
# physical device on your network.

#config.vm.network :hostonly, "33.33.33.10"
config.vm.network :bridged

# Forward a port from the guest to the host, which allows for outside
Expand All @@ -44,7 +14,7 @@ Vagrant::Config.run do |config|
# Share an additional folder to the guest VM. The first argument is
# an identifier, the second is the path on the guest to mount the
# folder, and the third is the path on the host to the actual folder.
config.vm.share_folder "appdir", "/tmp/vagrant_data", "../crystalline"
config.vm.share_folder "appdir", "/tmp/app", "../crystalline"

config.ssh.max_tries = 40
config.ssh.timeout = 120
Expand All @@ -55,6 +25,9 @@ Vagrant::Config.run do |config|
:server_root_password => 'rootpass',
:server_debian_password => 'debpass',
:server_repl_password => 'replpass'
},
:crystalline => {
:database_server => '192.168.0.169'
}
}

Expand Down
17 changes: 12 additions & 5 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@
# All rights reserved - Do Not Redistribute
#

default[:app][:user] = 'crystalline'
default[:app][:group] = 'appgroup'
default[:app][:url] = 'git://github.com/iancoffey/crystalline'
default[:app][:revision] = 'HEAD'
default[:app][:local_config][:file] = ''
default[:crystalline][:user] = 'crystalline'
default[:crystalline][:group] = 'appgroup'
default[:crystalline][:url] = 'git://github.com/iancoffey/crystalline'
default[:crystalline][:revision] = 'HEAD'
default[:crystalline][:database_server] = 'localhost'
default[:crystalline][:database_name] = 'crystalline'
default[:crystalline][:keepalive] = '100'
default[:crystalline][:api_authkey] = 'changeme'
default[:crystalline][:api_secret] = 'me'



34 changes: 20 additions & 14 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@

common_tools = %w{ vim curl wget }

ENV['CRYSTALLINE_SETTINGS'] = node[:app][:config]
group node[:crystalline][:group]

group node[:app][:group]

user node[:app][:user] do
user node[:crystalline][:user] do
system true
shell "/bin/bash"
end
Expand All @@ -37,21 +35,29 @@
end

directory "/opt/crystalline/shared" do
owner node[:app][:user]
group node[:app][:group]
owner node[:crystalline][:user]
group node[:crystalline][:group]
recursive true
end

template "/opt/crystalline/shared/config.ini" do
source "config.ini.erb"
mode 755
owner node[:crystalline][:user]
group node[:crystalline][:group]
variables({}.merge(node[:crystalline]))
end

deploy "/opt/crystalline" do
repo node[:app][:url]
revision node[:app][:revision]
user node[:app][:user]
group node[:app][:group]
repo node[:crystalline][:url]
revision node[:crystalline][:revision]
user node[:crystalline][:user]
group node[:crystalline][:group]
enable_submodules true
action :deploy
restart_command "touch tmp/restart.txt"
# restart_command "touch tmp/restart.txt"
scm_provider Chef::Provider::Git
symlink_before_migrate({})
create_dirs_before_symlink(%w{logs})
symlinks({})
symlink_before_migrate({'config.cfg' => 'config.cfg'})
end


7 changes: 7 additions & 0 deletions templates/default/config.ini.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[ database ]
name = <%= @database_name %>
host = <%= @database_server %>
[ api ]
authkey = <%= @api_authkey %>
secret = "<%= @api_secret %>

0 comments on commit 39acff9

Please sign in to comment.