summaryrefslogtreecommitdiff
path: root/boxes.mdwn
blob: 0d6042801501a81a349e5a1a7c22e0aebf19594d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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