pauper 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +101 -0
  3. data/lib/pauper.rb +10 -4
  4. data/lib/pauper/version.rb +1 -1
  5. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: af5126775307e89900badb113cdc5e1425799250
4
- data.tar.gz: 7e99fd016fbdfb32a35040061af5a07667b47fb3
3
+ metadata.gz: 3f0dab255dae6b6196868eea8e2016270e5ea73f
4
+ data.tar.gz: cfa3ea39f81b96138e5e9a88a74c0c68828ad0ff
5
5
  SHA512:
6
- metadata.gz: 58bb795aa47da08f4dcd3f1fc64c74058414009a9a48e668621ee40f883f9973f7ef96e80f228b654197cb48552ea9282d1fe36781eefc324fac80838d35629b
7
- data.tar.gz: d8b8d0b344870bdec4798b38bab5ae18dc6781bff2de109498a8d6ce37615e010d06dcd6eb78915a881633a04f4ae3c6ce50e6870deee9e94d9b37037c820749
6
+ metadata.gz: 812e2334e9c6175ea488e9591d17d41ae5fc3878ab296ce460dab41569be2cbdbac973b001f16dc22a0e769cf155edf53b5c0fbbae059f6e10d36b08281e1e8e
7
+ data.tar.gz: 381672d09740e94c5efe17e6eb3da403040aece3acc5456b6ea24e054711564f2c9f3699d70d5b7c4c83062ee478bf8eb08f5da423e3afc8f99ef59e15d98afb
data/README.md CHANGED
@@ -1 +1,102 @@
1
1
  See https://fastly.atlassian.net/wiki/display/DOC/DeveloperSetupMac
2
+
3
+ WHAT AM I
4
+ -------------------------------------------------------------------------------
5
+ Pauper is suppose to setup lxc's defined in a Pauperfile.
6
+ We use this to build out dev environment.
7
+ In the beginning it was created by fastly because the alternatives available
8
+ where not filling our needs.
9
+
10
+ Base Commands
11
+ -------------------------------------------------------------------------------
12
+ ```bash
13
+ pauper bootstrap [lucid|precise] # Initialize the base image
14
+ pauper create [NODENAME] # Create a VM
15
+ pauper destroy [NODENAME] # Completely destroy a VM
16
+ pauper halt # Stop all nodes on your vm from local!
17
+ pauper help [COMMAND] # Describe available commands or one specific command
18
+ pauper reload # Basically an up then a halt...
19
+ pauper resume [NODENAME] # Resume a VM
20
+ pauper setup [NODENAME] # Refresh configs and run Chef on a VM
21
+ pauper setup_osx [VMNAME] # Set up things for OS X
22
+ pauper start [NODENAME] # Start a VM
23
+ pauper stop [NODENAME] # Stop a VM
24
+ pauper suspend [NODENAME] # Suspends a VM
25
+ pauper up # Start all nodes on your vm from local!
26
+ pauper write_hosts # Write out a new /etc/hosts file
27
+ pauper vm SUBCOMMAND # Operations dealing with VMware Fusion
28
+
29
+ Options:
30
+ [--pauperfile=PAUPERFILE] # defults to ./Pauperfile
31
+ ```
32
+
33
+ VM Sub Commands
34
+ -------------------------------------------------------------------------------
35
+ This attempts to manage an OSX VMware Fusion VM instance headlessly.
36
+ Please run `pauper vm setup` before asking for help when it does not work...
37
+
38
+ The vm subcommand really only works for OSX users running VMWare Fusion.
39
+ It relies entirely on VMWares vm-run scripts
40
+
41
+ __!!IMPORTANT!!__ pauper vm setup should rid of most of the prompts and other
42
+ things that are not need for headless vm operation but as a precaution you
43
+ should `stop/start` using the GUI at least once and check all __"never show
44
+ this to me again"__ boxes just to be safe.
45
+
46
+ ```bash
47
+ Commands:
48
+ pauper vm help [COMMAND] # Describe subcommands or one specific subcommand
49
+ pauper vm list # List running fusion VMs
50
+ pauper vm pause # Pause given fusion VM
51
+ pauper vm reset # Reset given fusion VM
52
+ pauper vm setup # Setup your pauper vm experience
53
+ pauper vm start # Starts your fusion VM
54
+ pauper vm stop # Stop given fusion VM
55
+ pauper vm suspend # Suspend given fusion VM
56
+ pauper vm unpause # Unpause given fusion VM
57
+ pauper vm vmruner # A tube straight to the vmrun command...
58
+
59
+ Options:
60
+ [--vmpath=VMPATH] # Defaults to "/Applications/VMware Fusion.app/Contents/Library/vmrun"
61
+ [--vmrunpath=VMRUNPATH] # Defaults to "#{ENV['HOME']}/Documents/Virtual Machines*/*.vmwarevm"
62
+ ```
63
+
64
+ GPG
65
+ -------------------------------------------------------------------------------
66
+ We use GPG for key generation. It needs some amount of entropy to do its thing
67
+ with any amount of haste. On a new VM there is very little entropy and very
68
+ little happening that will generate entropy...
69
+
70
+ If you notice that `pauper bootstrap` is hanging for a long time on a call
71
+ involving gpg, attempt this on your VM:
72
+ ```bash
73
+ sudo apt-get install haveged
74
+ haveged
75
+ ```
76
+ haveged generates the needed entropy for you and should slove this issue. Feel
77
+ free to `kill` haveged when you are done (it will run forever, hiding in the
78
+ background if you do not :P )
79
+
80
+
81
+ TIPS
82
+ --------------------------------------------------------------------------------
83
+ Are things not working for you right now?
84
+ Try this (probably overkill) way to fix things!
85
+
86
+ First try running `./start.sh` from the pauper-env directory.
87
+
88
+ If this script does not exist you may have to pull master or if you
89
+ would prefer to do it the hard way...
90
+
91
+ OSX users:
92
+ 1. SSH into your VM
93
+ 2. `cd` into your `pauper-env` directory
94
+ 3. `pauper stop`
95
+ 4. `pauper start`
96
+ 5. `pauper write_hosts`
97
+ 6. `sudo iptables -F`
98
+ 7. Return to your OSX cmd-line
99
+ 8. `cd` into your `pauper-env` directory
100
+ 9. `pauper setup_osx`
101
+
102
+ This will hopefully get you into a happy state... Hopefully...
@@ -183,11 +183,12 @@ class Pauper
183
183
  bootstrap(release)
184
184
  end
185
185
 
186
- puts "Cloning #{base_name}..."
187
- clone_base(base_name, node_name)
188
186
  mac = generate_mac
189
187
  ip = "#{@pauper_config.config[:subnet]}.#{node_config.config[:last_octet]}"
190
188
 
189
+ puts "Cloning #{base_name}..."
190
+ clone_base(base_name, node_name, ip)
191
+
191
192
  lxc = LXC.new(node_name)
192
193
  lxc.interface = @pauper_config.config[:bridge]
193
194
  lxc.mac = mac
@@ -265,7 +266,7 @@ EOF
265
266
  end
266
267
 
267
268
  if vm_exists?(node_name)
268
- stop_node(node_name)
269
+ stop(node_name)
269
270
 
270
271
  chef_node = "#{node_name}#{@pauper_config.config[:node_suffix]}"
271
272
  puts "Removing #{node_name} from Chef..."
@@ -561,11 +562,16 @@ EOF
561
562
  `sudo lxc-info -n '#{node_name}'`.include?("FROZEN")
562
563
  end
563
564
 
564
- def clone_base(base_name, node_name)
565
+ def clone_base(base_name, node_name, ip)
565
566
  cmd "sudo cp -ax #{DEFAULT_VM_PATH}/#{base_name} #{DEFAULT_VM_PATH}/#{node_name}"
566
567
  cmd "sudo rm -f #{DEFAULT_VM_PATH}/#{node_name}/rootfs/etc/chef/client.pem"
567
568
  cmd "sudo rm -f #{DEFAULT_VM_PATH}/#{node_name}/rootfs/etc/ssh/ssh*key*"
568
569
  cmd "sudo sed -i \"s/#{base_name}/#{node_name}/g\" /var/lib/lxc/#{node_name}/rootfs/etc/hostname /var/lib/lxc/#{node_name}/rootfs/etc/chef/client.rb"
570
+ # The chef run in the base wrote base's IP into /etc/hosts. Once we run chef
571
+ # in the copied lxc, its /etc/hosts will be rewritten. However, we need
572
+ # the node's hostname in /etc/hosts in the copy before we run chef in it,
573
+ # so that sudo lets us put files for chef in place and chef can run.
574
+ cmd "sudo sh -c 'echo #{ip} #{node_name} >> #{DEFAULT_VM_PATH}/#{node_name}/rootfs/etc/hosts'"
569
575
  end
570
576
 
571
577
  def vm_config(node_name)
@@ -1,3 +1,3 @@
1
1
  class Pauper
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pauper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler McMullen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-03-27 00:00:00.000000000 Z
12
+ date: 2014-04-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
@@ -116,3 +116,4 @@ summary: A semi-sane way to manage a multi-vm dev environment
116
116
  test_files:
117
117
  - test/pauper_test.rb
118
118
  - test/test_helper.rb
119
+ has_rdoc: