Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT:...
Transcript of Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT:...
![Page 1: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/1.jpg)
Entornos de desarrollo local
para PHP
![Page 3: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/3.jpg)
● Necesidad de un entorno local● Beneficios● Requisitos● Tipos de entornos locales:
● FTP● XAMPP y similares● VM: Vagrant (Homestead, VVV,…)● Contenedores: Docker
Contenido
![Page 4: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/4.jpg)
Por qué necesito un entorno de desarrollo local
![Page 5: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/5.jpg)
<!DOCTYPE html><html>
<head> <meta charset="UTF-8">
<title>¡Hola Mundo!</title> </head>
<body> <h1>¡Hola Mundo!</h1>
</body></html>
![Page 6: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/6.jpg)
![Page 7: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/7.jpg)
<!DOCTYPE html><html>
<head> <meta charset="UTF-8">
<title>¡Hola Mundo!</title> </head>
<body> <h1><?php echo '<p>Hola Mundo</p>'; ?></h1>
</body></html>
![Page 8: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/8.jpg)
Beneficios
![Page 9: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/9.jpg)
● Desarrollo local● Probar cambios antes de desplegarlos● Realizar tests antes de desplegar el código● Tener un control de cambios local (SCM local) ● Trabajar desconectado● Mismo entorno en desarrollo y en
producción
Beneficios
![Page 10: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/10.jpg)
Requisitos
![Page 11: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/11.jpg)
● LAMP/LEMP● Linux● Apache/nginx ● MySQL/MariaDB● PHP/PHP-FPM
● IDE (PhpStorm, IntelliJ IDEA, NetBeans, Eclipse,...)
● Editor de texto (Sublime Text, Atom, Visual Studio Code, Vim,...)
Requisitos
![Page 12: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/12.jpg)
● Shell (Bash, Zsh, Git Bash,...)● Cliente SSH (PuTTY, MobaXterm,...)● Navegador (Chrome, Firefox, IE, Edge,...)● SCM (Git, SVN,...)● SCM GUI (Sourcetree, GitKraken, Sublime
Merge,…)● Npm/Yarn● Composer
Requisitos
![Page 13: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/13.jpg)
● Task runners (Gulp, Grunt, Webpack,…): Sass, concatenación, minificación,...
● Herramientas para desarrollo de API (Postman, HTTPie,...)
Requisitos
![Page 14: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/14.jpg)
Entornos locales
![Page 15: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/15.jpg)
● FTP● XAMPP y similares● VM: Vagrant (Homestead, VVV,…)● Contenedores: Docker
Evolución
![Page 16: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/16.jpg)
FTP
![Page 17: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/17.jpg)
● Edición en IDE o editor● Subida FTP a servidor:
● desarrollo● producción
● Recarga navegador web
FTP
![Page 18: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/18.jpg)
● Ventajas● Solo necesita un editor, un cliente FTP y
conexión al servidor● Desarrollo “sencillo”
● Inconvenientes● Cortar el servicio en producción● Necesita un servidor externo● Necesita conexión a Internet/Intranet
FTP
![Page 19: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/19.jpg)
XAMPPMAMPValet
![Page 20: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/20.jpg)
Hardware
SO anfitrión
Apache MySQL PHP-FPM
![Page 21: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/21.jpg)
● XAMPP● X: Multiplataforma● A: Apache● M: MySQL/MariaDB● P: PHP● P: Perl
● Edición en IDE o editor● Recarga navegador web
XAMPP
![Page 22: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/22.jpg)
● Ventajas● Instalación sencilla: asistente o apt-get● No necesitas la consola ni red
● Inconvenientes● Entorno distinto al de producción● Software instalado en el host● Imposibilidad de instalar algunos
programas● Versión única de PHP, servidor web,...
XAMPP
![Page 23: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/23.jpg)
Máquinas virtuales
![Page 24: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/24.jpg)
![Page 25: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/25.jpg)
● Ventajas● No se instala software en el host● Disponibilidad de consola● Distintas versiones de un SW: PHP
● Inconvenientes● Instalación más compleja● Sobrecarga de recursos● Entorno distinto (aunque similar) al de
producción
Máquina virtual
![Page 26: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/26.jpg)
Vagrant
![Page 27: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/27.jpg)
● Ligero● Reproducible● Portable● No instala nada en local -> sistema limpio
Vagrant
![Page 28: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/28.jpg)
Instalación:● Virtualbox, VMWare, Parallels o Hyper-V
● Ejecuta la VM● Vagrant
● Maneja la VMInstalación máquina de desarrollo:● Homestead● VVV
Vagrant
![Page 29: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/29.jpg)
● Vagrant● Local
● IDE desarrollo● Editor de texto● IDE Git● Navegador
Vagrant
![Page 30: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/30.jpg)
Homestead:● Ubuntu 18.04● Git● PHP 7.3, PHP 7.2, PHP 7.1, PHP 7.0, PHP 5.6● Nginx, Apache (opcional)● MySQL, MariaDB (opcional), Sqlite3,
PostgreSQL● Composer
Vagrant Homestead
![Page 31: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/31.jpg)
Homestead:● Node (con Yarn, Bower, Grunt y Gulp)● Redis● Memcached● Beanstalkd● Mailhog● Neo4j (opcional)
Vagrant Homestead
![Page 32: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/32.jpg)
Homestead:● MongoDB (opcional)● Elasticsearch (opcional)● Ngrok● Wp-cli● Zend Z-Ray● Go● Minio
Vagrant Homestead
![Page 33: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/33.jpg)
$ vagrant box add laravel/homestead$ git clone https://github.com/laravel/homestead.git ~/Homestead$ cd ~/Homestead$ bash init.sh
Vagrant Homestead
![Page 34: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/34.jpg)
Crea 3 archivos:● after.sh ● aliases
● Homestead.yaml
Vagrant Homestead
![Page 35: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/35.jpg)
ip: "192.168.10.10"memory: 2048cpus: 1provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys: - ~/.ssh/id_rsa
Vagrant Homestead
![Page 36: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/36.jpg)
folders: - map: ~/code to: /home/vagrant/code
sites: - map: homestead.test to: /home/vagrant/code/public
databases: - homestead
Vagrant Homestead
![Page 37: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/37.jpg)
Archivo de hosts del SO anfitrión
192.168.10.10 homestead.test
Vagrant Homestead
![Page 38: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/38.jpg)
$ vagrant up$ vagrant ssh
$ vagrant suspend$ vagrant up$ vagrant ssh
Vagrant Homestead
![Page 39: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/39.jpg)
$ cd ~/Homestead$ vagrant box update$ git pull
Vagrant Homestead
![Page 40: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/40.jpg)
Ubuntu 14.04 LTS WordPress DevelopWordPress StableWP-CLI nginx MariaDB 10.1php-fpm 7.0.xmemcached
Vagrant VVV
![Page 41: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/41.jpg)
PHP memcache extensionPHP xdebug extensionPHP imagick extensionPHPUnitack-grepgitsubversionngrep
Vagrant VVV
![Page 42: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/42.jpg)
dos2unixComposerphpMemcachedAdminphpMyAdminOpcache StatusWebgrindNodeJsgrunt-cliMailcatcher
Vagrant VVV
![Page 43: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/43.jpg)
$ vagrant plugin install vagrant-hostsupdater$ git clone -b master git://github.com/Varying-Vagrant-Vagrants/VVV.git ~/vagrant-local$ cd ~/vagrant-local
$ cp vvv-config.yml vvv-custom.yml
Vagrant VVV
![Page 44: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/44.jpg)
sites:
wordpress-default:
repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
hosts:
- local.wordpress.test
example-site:
repo: https://github.com/Varying-Vagrant-Vagrants/custom-site-template.git
hosts:
- my-example-site.test
Vagrant VVV
![Page 45: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/45.jpg)
Archivo hosts192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4
192.168.50.4 vvv.dev
192.168.50.4 vvv.test
192.168.50.4 vvv.local
192.168.50.4 vvv.localhost
192.168.50.4 local.wordpress.test
192.168.50.4 my-example-site.test
Vagrant VVV
![Page 46: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/46.jpg)
![Page 47: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/47.jpg)
![Page 48: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/48.jpg)
![Page 49: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/49.jpg)
![Page 50: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/50.jpg)
$ ls -la ~/vagrant-local/www
default example-sitePhpcswordpress-default
Vagrant VVV
![Page 51: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/51.jpg)
● Carga de recursos elevada● Entorno distinto en
● desarrollo ● producción
Máquina virtual
![Page 52: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/52.jpg)
Contenedores
![Page 53: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/53.jpg)
Hardware
SO anfitrión
Motor de contenedores
Bin/Libs
App A
Bin/Libs
App A’ App B App B’ App C App C’
Contenedores
![Page 54: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/54.jpg)
● Ventajas● No se instala software en el host● Disponibilidad de consola● Distintas versiones de un SW: PHP● Menor carga de recursos● Entorno idéntico en desarrollo y en
producción● Inconvenientes
● Instalación más compleja
Contenedor
![Page 55: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/55.jpg)
Docker
![Page 56: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/56.jpg)
![Page 57: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/57.jpg)
$ mkdir ~/code/wordpress$ cd ~/code/wordpress$ vim docker-compose.yml
Docker
![Page 58: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/58.jpg)
version: '3.3'
services:
db:
image: mysql:5.7
volumes:
- db_data:/var/lib/mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: somewordpress
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
Docker
![Page 59: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/59.jpg)
wordpress:
depends_on:
- db
image: wordpress:latest
volumes:
- wordpress_files:/var/www/html
ports:
- "8000:80"
restart: always
Docker
![Page 60: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/60.jpg)
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
volumes:
db_data:
wordpress_files:
Docker
![Page 61: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/61.jpg)
$ docker-compose up -d
Docker
![Page 62: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/62.jpg)
![Page 63: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/63.jpg)
![Page 64: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/64.jpg)
![Page 65: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/65.jpg)
![Page 66: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/66.jpg)
$ docker-compose down
Docker
![Page 67: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/67.jpg)
![Page 68: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/68.jpg)
$ ls -la /var/lib/docker/volumes wordpress_db_datawordpress_wordpress_files
$ ls -la /var/lib/docker/volumes/wordpress_wordpress_files/_data/
$ docker-compose up -d
Docker
![Page 69: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/69.jpg)
![Page 70: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/70.jpg)
Soluciones “empaquetadas”:● Devilbox● Laradock● Visible Wordpress Starter● vessel (shipping-docker/vessel)● Stacker (Maxlab/stacker)
Docker
![Page 71: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/71.jpg)
● CakePHP ● CodeIgniter● CraftCMS● Drupal● Joomla● Laravel● Magento ● PhalconPHP
Docker. Devilbox
![Page 72: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/72.jpg)
● PhotonCMS● PrestaShop ● Shopware ● Symfony ● Typo3 ● Wordpress ● Yii ● Zend
Docker. Devilbox
![Page 73: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/73.jpg)
$ cd ~$ git clone https://github.com/cytopia/devilbox $ cd devilbox$ cp env-example .env$ docker-compose up -d$ ./shell.shdb$ cd /shared/httpddb$ mkdir my-laravel
Docker. Devilbox
![Page 74: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/74.jpg)
db$ cd my-laraveldb$ laravel new laravel-projectdb$ ln -s laravel-project/public/ htdocs
Añadir en el /etc/hosts del host anfitrión
127.0.0.1 my-laravel.loc
Docker. Devilbox
![Page 75: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/75.jpg)
![Page 76: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/76.jpg)
![Page 77: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/77.jpg)
$ ls -la ~/devilbox/data/www/my-laravel
Docker. Devilbox
![Page 78: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/78.jpg)
la semana
![Page 79: Entornos de desarrollo local para PHP - Jesús Amieiro...Archivo hosts 192.168.50.4 vvv # VAGRANT: 0bd9d5b87bc499d80648dd118d890b69 (default) / 90f58ba6-aaf6-4ba5-b9e7-b9e2539ef4a4](https://reader035.fdocuments.es/reader035/viewer/2022070715/5ed7aafe5ab86c3b0273a180/html5/thumbnails/79.jpg)
www.jesusamieiro.com