-
Notifications
You must be signed in to change notification settings - Fork 1
Vagrant
This process was initially developed by colleagues at frappant.ch at the beginning of 2017. Scotchbox will be used: a pre-defined distribution.
- Install Vagrant: https://www.vagrantup.com/downloads.html
- Install Virtual Box: https://www.virtualbox.org/wiki/Downloads
- Install the Vagrant Hostmanager plugin: https://github.com/devopsgroup-io/vagrant-hostmanager
…in the document root.
- Wordpress: https://gist.github.com/markhowellsmead/4e45035d6f0aa4df8a6fd24e11f67f45
Use the following example YAML file for project configuration.
- Vagrant YAML: https://gist.github.com/markhowellsmead/99feb744e77e40c86ea4573489222bf0
Edit the following information in the Vagrantfile for your project.
- Comment the appropriate code blocks for the appropriate PHP version in/out.
- Comment in the appropriate block for SSL if you need it.
Using Sequel Pro in SSH mode.
- MySQL Host: 127.0.0.1
- Database user: root
- Database password: root
- SSH host: [IP from the Vagrantfile]
- SSH user: vagrant
- SSH password: vagrant
- Start server:
vagrant up
- Re-provision the configuration:
vagrant provision
- Re-start the server:
vagrant reload
- Stop server:
vagrant halt
- View all current machines:
vagrant global-status
- Reset list of all current machines:
vagrant global-status --prune
- Destroy Vagrant machine:
vagrant destroy [ID]
. Alternative: delete in VirtualBox
Each project should receive its own I.P. address, according to the convention 192.168.33.X. .0, .1 and .255 are reserved and may not be used.
Edit the project's php.ini
file to choose where to save an error log file. For example, error_log = /var/www/web/php_errors.log
puts the file into the web root of the project.
If you're running TYPO3, then clear the typo3temp/Cache
folder. This may resolve any inexplicable issues. If you're running WordPress, then add the following lines to wp-config.php
.
ini_set('display_errors',true);
error_reporting(E_ALL);
If the domain isn't reachable in the browser and a ping
results in the I.P. address 127.0.53.53, this indicates a DNS conflict. Make sure that the Vagrantfile is correct, then completely remove the pre-existing VM using vagrant destroy
and ensure that the .vagrant
folder is also removed. Then re-run vagrant up
.
Also be aware that the TLD suffix .dev
may become a valid public suffix. In this event, an alternative suffix will need to be used.
Problem: NFS is reporting that your exports file is invalid.
Lösung:
sudo rm /etc/exports
sudo touch /etc/exports
vagrant halt
vagrant up --provision
The initialisation of a virtual machine with Vagrant adds an entry to the hosts file at etc/hosts
. If the machine is deleted manually, then this entry is not automatically removed. Make sure that there is only one entry in the hosts file per domain.
If the server request times out, there's an error in the configuration within the Vagrantfile. Check the following.
- Invalid IP address for the domain/machine.
vagrant ssh
into the running Vagrant box, then run the following commands to install the WP CLI binary. Run CLI commands from /var/www/web
– the webroot of the project in the virtual machine – over the SSH connection.
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
sudo chmod 0777 /usr/local/bin/wp
Test WP CLI:
cd /var/www/web
wp --info
Use the IP address from the Vagrant config file with the port number 1080 appended.
define('WP_SMTP_HOST', 'localhost');
define('WP_SMTP_PORT', 1025);
define('WP_SMTP_USER', '');
define('WP_SMTP_PASSWORD', '');
define('WP_SMTP_FROM', 'John Doe <[email protected]>');
Mark Howells-Mead | https://permanenttourist.ch and https://sayhello.ch/ | Wiki since 2016
Use this code freely, widely and for free. Provision of this code provides and implies no guarantee.
Please respect the GPL v3 licence, which is available via http://www.gnu.org/licenses/gpl-3.0.html