From fad4f5f61483e30ade917d94e7d015ee1ae961d6 Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Mon, 13 Jul 2015 11:31:45 -0300 Subject: Boxes --- boxes.mdwn | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 boxes.mdwn diff --git a/boxes.mdwn b/boxes.mdwn new file mode 100644 index 0000000..0d60428 --- /dev/null +++ b/boxes.mdwn @@ -0,0 +1,52 @@ +[[!toc levels=4]] + +Boxes +===== + +Necessidade +----------- + +* Ambiente de desenvolvimento ágil. +* Que permita executar de forma isolada aplicações sem auditoria ou checagem de integridade. + +Criando uma base box +-------------------- + +* [Creating a Base Box - Vagrant Documentation](https://docs.vagrantup.com/v2/boxes/base.html). +* [Creating a Base Box - VirtualBox Provider - Vagrant Documentation](https://docs.vagrantup.com/v2/virtualbox/boxes.html). + +### Configuração do sudo + +Usamos algo mais recomendado ao invés de mexer no `/etc/sudoers` do pacote: + + echo "vagrant ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/vagrant + chown root.root /etc/sudoers.d/vagrant + chmod 0440 /etc/sudoers.d/vagrant + +### Workarounds + +A mensagem de erro [stdin: is not a tty](https://github.com/mitchellh/vagrant/issues/1673) é corrigida +com isto no `/root/profile`: + + tty -s && mesg n + +Encolhendo uma máquina virtual +------------------------------ + + * https://superuser.com/questions/529149/how-to-compact-virtualboxs-vdi-file-size + * http://www.thelinuxdaily.com/2010/02/shrinking-a-dynamic-virtualbox-disk-image/ + * https://packages.debian.org/wheezy/zerofree + * https://unix.stackexchange.com/questions/42015/mount-is-busy-when-trying-to-mount-as-read-only-so-that-i-can-run-zerofree + +Procedimento genérico, dentro da máquina virtual: + + hydractl upgrade clean + apt-get install zerofree + telinit 1 + mount -o remount,ro / + zerofree /dev/sda1 + halt + +Fora da máquina: + + VBoxManage modifyhd --compact /var/cache/virtualbox/$box/$box.vdi -- cgit v1.2.3