Skip to content

Commit 47a0d79

Browse files
committed
swap for behemoths
use the last letter in range for swaP device had to upgrade aws/ohai/compat_resource recipes
1 parent 8696382 commit 47a0d79

File tree

2 files changed

+51
-19
lines changed

2 files changed

+51
-19
lines changed

attributes/worker.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,13 @@
7575
publisher = (node.name =~ /.*-publish.*/) != nil # TODO: use tag?
7676
lightWorker = publisher # TODO: better heuristic...
7777

78+
if !lightWorker
79+
default['ebs']['volumes']['none']['size'] = 16
80+
default['ebs']['volumes']['none']['dev'] = "/dev/sdp"
81+
default['ebs']['volumes']['none']['fstype'] = "swap"
82+
default['ebs']['volumes']['none']['mountopts'] = "sw"
83+
end
84+
7885
override['sbt']['launcher_path'] = '/usr/local/lib/share/sbt-launch.jar'
7986

8087
default['graphviz']['url'] = 'https://dl.dropboxusercontent.com/u/12862572/graphviz_2.28.0-1_amd64.deb'

recipes/_config-ebs.rb

Lines changed: 44 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,31 +43,56 @@
4343
else
4444
device = node[:platform_family] == 'debian' ? ebsConfig['dev'].gsub(%r{^/dev/sd}, '/dev/xvd') : ebsConfig['dev']
4545

46-
execute 'mkfs' do
47-
command "mkfs -t #{ebsConfig['fstype']} #{device}"
48-
not_if do
49-
BlockDevice.wait_for(device)
50-
system("blkid -s TYPE -o value #{device}")
46+
case ebsConfig['fstype']
47+
when "swap"
48+
execute 'mkswap' do
49+
command "mkswap #{device}"
50+
not_if do
51+
BlockDevice.wait_for(device)
52+
system("blkid -s TYPE -o value #{device}")
53+
end
5154
end
52-
end
5355

54-
# workaround for when user doesn't exist during bootstrap
55-
# user ebsConfig['user'] do
56-
# end
56+
execute 'swapon' do
57+
command "swapon #{device}"
58+
end
5759

58-
directory mountPoint do
59-
owner ebsConfig['user']
60-
mode 0755
60+
mount mountPoint do
61+
device device
62+
fstype ebsConfig['fstype']
63+
options ebsConfig['mountopts']
6164

62-
action :create
63-
end
65+
pass 0
66+
action [:enable]
67+
end
68+
69+
else
70+
execute 'mkfs' do
71+
command "mkfs -t #{ebsConfig['fstype']} #{device}"
72+
not_if do
73+
BlockDevice.wait_for(device)
74+
system("blkid -s TYPE -o value #{device}")
75+
end
76+
end
6477

65-
mount mountPoint do
66-
device device
67-
fstype ebsConfig['fstype']
68-
options ebsConfig['mountopts']
78+
# workaround for when user doesn't exist during bootstrap
79+
# user ebsConfig['user'] do
80+
# end
6981

70-
action [:mount, :enable]
82+
directory mountPoint do
83+
owner ebsConfig['user']
84+
mode 0755
85+
86+
action :create
87+
end
88+
89+
mount mountPoint do
90+
device device
91+
fstype ebsConfig['fstype']
92+
options ebsConfig['mountopts']
93+
94+
action [:mount, :enable]
95+
end
7196
end
7297
end
7398
end

0 commit comments

Comments
 (0)