webdevops / vagrant-docker-vm

:computer: Development Vagrant VM with Docker, Samba and Mail sandbox (customizable)
https://webdevops.io/projects/vagrant-docker-vm/
MIT License
87 stars 28 forks source link

Minimum resources are far lower / Evaluation on MacBook Air #54

Closed elmar-hinz closed 7 years ago

elmar-hinz commented 9 years ago

Hello. Thank you for doing this great stuff.

I am evaluating on an early Macbook Air and want to support with my experience.

2 GB RAM
1,6 GHz Intel Core i5
10 GB remaining diskspace

I deployed TYPO3-docker-boilerplate and TYPO3 6.2 with the introduction package. After clearing the Cache the FE renders within 2 seconds.

I didn't alter the configuration. Hence, while the machine is configured to 1.5 GB OS X grants the process 0.95 GB max. that is approximately 50% of the memory.

elmar@apple> du -hs Parallels/*
4,4G      Parallels/DEV-VM.pvm
1,5G      Parallels/devvm

elmar@apple> du -hs Docker/*
291M    Docker/typo362

That means the first TYPO3 needs 1.7 GB of diskspace.

As a developer using vim and tmux I don't need more resources even for professional work. I just have to keep the memory footprint of open windows low.

I guess you could shrink the DEV-VM.pvm to 1.5 GB using sparseimages. That would not only reduce the time to download. In my case it would save 3GB of remaining 10G of diskspace.

    Development VM :: Ubuntu 14.04.2 LTS

   Linux: 3.16.0-43-generic                         eth0: 10.211.55.8
  Docker: Docker version 1.7.1, build 786b29d       eth1: 192.168.56.2
   CPU: 4 Cores
  Memory:   1.44 GiB
  root:   2.81 GiB (5% in use)
  /mnt/data:   1.13 GiB (1% in use)

Cheers

Elmar

mblaschke commented 9 years ago

For TYPO3 Docker Boilerplate:

With docker the base images are shared between installations. So every TYPO3 installation don't really need 1.7GB disk space.

Ubuntu base image: 188.4 MB MySQL base image: 214.5 MB Apache HTTPd base image: 161.8 MB webdevops/php-boilerplate base image: 491.5 MB

Currently the main docker container will also update all packages which requires some disk space. This will be disabled when the automatic docker image rebuild/pulling is working so the whole base images are updated -> security updates? shellshock? openssl issues? :)

For Vagrant Docker VM:

If you don't need any development tools you can switch to box-cutter/ubuntu1404-docker and set PROVISION.packages to minimal. Also you can disable PROVISION.samba if you don't need samba.

For fast development with virtualization you really need some GB RAM. 8 GB should be the minimum because even with 8 GB RAM there is a high possibility for heavy swapping. My working notebook only have 8 GB RAM and i have about 6 GB write access to my SSD (about 5 GB only because of swapping)... and with swapping you will lose performance :( You will gain some perfomance with 16 GB RAM because your Browser and also your IDE requires some memory (PHPStorm eg. 1-3 GB, Chrome up to 4 GB based on usage).

BTW: if you only have 10 GB space left and you're using an SSD you will notice a huge performance impact because SSDs need to rewrite most cells if you're writing anything to disk.

Both swapping and low space on SSDs will reduce SSD lifetime.

PS: This issue also applies to Boot2docker or similar tools :(

mblaschke commented 9 years ago

Also there are video cards with shared memory (using your RAM for video usage).. eg. Intel cards So you maybe don't really have 2 GB

elmar-hinz commented 9 years ago

Yes, the minimal requirements are never the optimal requirements. However, it's thrilling to go to the limits.

Btw. the bottleneck of lifetime of my MacBook Air wont be the SSD. It's the costs and difficulty to exchange battery and keyboard.

I will give box-cutter/ubuntu1404-docker a try.

mblaschke commented 9 years ago

You need at least some space (20-30 GB) for Docker and VM because of file handling of VM images. If you don't have much space you will have to compact (defragment and shrink) your images regularly which costs more time than a new notebook.

The goal of the Vagrant VM and Docker Boilerplate is to provide a fast, easy, recreateable, customizable and project depend (PHP 5.5, 5.4, 5.3... or MySQL, MariaDB....) environment. But the drawback of this flexibility is more disk space and RAM usage but IMHO it's more important to speed up developers than to shink the development environment... developers make money and not the environment ;)

This environment can prevent "works for me" issues because it provides an equal environment for multiple developers and also you can prevent nodejs or npm version issues

elmar-hinz commented 9 years ago

I tested it. The process doesn't work fully when I set:

VAGRANT_IMAGE = 'boxcutter/ubuntu1504-docker'

It seems the docker port is not connected, although the docker service is running inside the image.

elmar-hinz commented 9 years ago

Then there is a tiny issue in the "First Startup". I have to enter the provider:

https://github.com/webdevops/vagrant-development/blob/develop/documentation/INSTALL.md

# Start vm
vagrant up --provider=parallels

Else Virtualbox takes precedency.

PanadeEdu commented 9 years ago

Related to the --provider thing: Vagrant seemts to go trough every configuration, first checking if the Provider is available and then selecting it.

Assuming that users that have parallels will prefer that and users using vmware will prefere it aswell we will change the order soon. So the prossible providers will be selected in the following ordner: Prallels > VMWare > VirtualBox. So VirtualBox is only selected then nothing else fits.

mblaschke commented 9 years ago

You have to use 14. 04 (Ubuntu trusty LTS). 15.04 is currently not tested.

mblaschke commented 9 years ago

Make sure you have Vagrant parallels plug-in installed

elmar-hinz commented 9 years ago

I always lose my typo3 especially the mysql container, when doing this tests. However, I could save the container with docker save.

In other words, rebuilding the docker server results in a new setup of the client projects. That's not the idea of client server separation.

Is there a best practice path to keep the docker content as a whole, i.e. when I want to switch to box-cutter/ubuntu1404-docker? So that the client doesn't notice the exchange of the server?

mblaschke commented 9 years ago

With VirtualBox you're losing your data partition (where docker stores it data) because vagrant destroy will also destroy the disk image. With Parallels or VMware the image isn't destroyed but currently this is a Vagrant issue.

If you're using NFS sharing you can store your files outside of the VM and do a make mysql-backup which will backup the full MySQL database of the current boilerplate instance. Your home directory is automatically shared inside VM so you also can use docker directly from your MacOS or Linux and control the docker daemon inside.

You also can use ct sync:server for syncing your database from your testing, staging and/or production service (it will also manipulate all TYPO3 domains and inject a dev TYPO3 backend user).

Personally I'm using NFS share for my files and only services and mysql databases are stored inside the VM. I'm also using the ct sync:server feature to fetch the databases from the production servers :)

elmar-hinz commented 9 years ago

That means the first TYPO3 needs 1.7 GB of diskspace.

With docker the base images are shared between installations. So every TYPO3 installation don't really need 1.7GB disk space.

For the archives.

Second TYPO3: 0.5 GB

mblaschke commented 9 years ago

Try removing the update tasks from playbook-task: https://github.com/webdevops/TYPO3-docker-boilerplate/blob/develop/docker/main/provision/roles/common/tasks/main.yml

I'm currently unsure if we should ship the boilerplate with auto-update feature.. but what about security issues?! :(

mblaschke commented 7 years ago

Now ubuntu-16.04 is using linked base image clones which reduces the size of the installation. Also now some packages are optional and not installed by default (must be added to vm.yml).

So this issue should be finally fixed.