Qarik-Group / bucc

The fastest way to get a BUCC (BOSH, UAA Credhub and Concourse)
Apache License 2.0
135 stars 46 forks source link

Bucc resume (for virtualbox) #29

Open rkoster opened 7 years ago

rkoster commented 7 years ago

It would be nice to be able to resume a bucc deployed virtualbox vm. Currently the bosh jobs won't be able to start because they are missing their persistent disk: https://github.com/cppforlife/bosh-virtualbox-cpi-release/issues/7

below some things I have tried so far to workaround the above issue, with mixed results:

df /var/vcap/data | grep /var/vcap/data # wait for agent to mount /var/vcap/data
disk=$(sort <(cat /etc/mtab | grep /dev/sd | cut -d ' ' -f1) <(fdisk -l | grep /dev/sd | grep -v : | grep -v swap | cut -d ' ' -f1) | uniq -u)
mount ${disk} /var/vcap/store
monit

vboxmanage startvm $(bosh int state/state.json --path /current_vm_cid) --type headless
bucc ssh
cd /dev/disk/by-id/ && ln -s ../../sdc 1ATA
bchalk101 commented 6 years ago

Currently if my machine shuts down the concourse vm goes down and can not be brought back up. If there was a way to save state that would be great. Also, the same with credhub, I have lost all credentials that were entered as my machine shut down and could not figure out how to bring it back up without doing a complete bucc up

drnic commented 6 years ago

If you remove current_vm_cid from your state.json then bosh create-env should go thru the motions of creating it again and moving on.

shreddedbacon commented 5 years ago

Have had limited success using the following

# savestate
vboxmanage controlvm $(bosh int state/state.json --path /current_vm_cid) savestate
# resume
vboxmanage startvm $(bosh int state/state.json --path /current_vm_cid) --type headless
shreddedbacon commented 5 years ago

Just on this, I've been saving and resuming state on my local bucc for a while now I've found that the date is out of sync when resuming, setting the time using the following works.

sudo date --set="$(date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z" +"%Y-%m-%d %H:%M:%S")"

I have the following helper commands for resuming

vboxmanage startvm $(bosh int state/state.json --path /current_vm_cid) --type headless
bucc ssh cat > cmd.sh << "EOF"
date --set="$(date -s "$(wget -qSO- --max-redirect=0 google.com 2>&1 | grep Date: | cut -d' ' -f5-8)Z" +"%Y-%m-%d %H:%M:%S")"
EOF
bucc ssh sudo bash cmd.sh
ramonskie commented 5 years ago

i'm still convinced that this should be solved in the virtualbox-cpi and not in bucc it self. we need to address this to the bosh developers