Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

add host to /etc/hosts #131

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
!/data_bags/sites/local.json
/public
!/public/local.dev
.DS_Store
65 changes: 65 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Requrements
* Virtualbox
* Vagrant >= 1.7.0
* vagrant-omnibus plugin
* vagrant-hostmanager plugin

Installation:
-------------
Expand All @@ -22,12 +23,24 @@ Install [vagrant-omnibus](https://github.com/chef/vagrant-omnibus) plugin

$ vagrant plugin install vagrant-omnibus

Install [vagrant-hostmanager](https://github.com/devopsgroup-io/vagrant-hostmanager) plugin

$ vagrant plugin install vagrant-hostmanager

Clone this repository

Go to the repository folder and launch the box

$ cd [repo]
$ vagrant up

To update **/etc/hosts** in host machine

$ vagrant hostmanager

This machine URL:

http://local.dev

What's inside:
--------------
Expand Down Expand Up @@ -74,6 +87,25 @@ a docroot explicitly by adding a `docroot` key in the json file.

The guests local 3306 port is available on the host at port 33066. It is also available on every domain. Logging in can be done with username=root, password=vagrant.


##### MySQL Remote Access

The root account's localhost-only in the vast majority of default installations, are you certain you've allowed it to log in from the other system? From the MySQL reference manual:

it means that there is no row in the user table with a Host value that matches the client host
So, there's no % or 10.0.2.2 in the Host column at all. Check your current config:

select user,host from mysql.user where user='root';

You likely want to create a new root entry with the same password as you have now.

create user 'root'@'10.0.2.2' identified by 'yourpassword';
grant all privileges on *.* to 'root'@'10.0.2.2' with grant option;
flush privileges;


Source: [Access to mysql server via virtualbox](http://serverfault.com/questions/486710/access-to-mysql-server-via-virtualbox)

### phpMyAdmin

phpMyAdmin is available on every domain. For example:
Expand All @@ -82,6 +114,8 @@ phpMyAdmin is available on every domain. For example:

### XDebug and webgrind



XDebug is configured to connect back to your host machine on port 9000 when
starting a debug session from a browser running on your host. A debug session is
started by appending GET variable XDEBUG_SESSION_START to the URL (if you use an
Expand Down Expand Up @@ -119,3 +153,34 @@ ll emails sent via local mail transport are intercepted by [MailHog](http://gith
### Composer

Composer binary is installed globally (to `/usr/local/bin`), so you can simply call `composer` from any directory.


### Host
Add **local.dev** in /etc/hosts

sudo echo "192.168.33.10 local.dev" >> /etc/hosts


### PHPUnit

[Oficial Website](https://phpunit.de/manual/current/pt_br/installation.html)

[PHPUnit phar Versions](https://phar.phpunit.de/)


#### Colors to bash_profile terminal

Add below content to **~/.bash_profile** in **/home/vagrant/**

/home/vagrant/.bash_profile

# terminal colors
export GREP_OPTIONS="--color=auto"
export GREP_COLOR="4;33"
#export CLICOLOR="auto"
export CLICOLOR=1
export LSCOLORS=ExFxCxDxBxegedabagacad
export PATH="/usr/local/bin:$PATH"
export PS1='\n\033[0;37m\][\t]\[\033[0;32m\][\u]\[\033[31m\][\h]`git branch 2>/dev/null | grep \* | head -1 | sed "s/\* //g" | awk "{ print \"[ \"\\\$1 \" ]\" }"` \[\033[1;33m\]\w\a\[\033[0m\] \n\033[0;37m\]➥\[\033[0;32m\] '


28 changes: 27 additions & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,33 @@ Vagrant.configure("2") do |config|

# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.network :private_network, ip: "192.168.33.10"
#config.vm.network :private_network, ip: "192.168.33.10"
#config.vm.network :public_network
config.vm.network :public_network, bridge: "en1: Wi-Fi (AirPort)"

# update /etc/host in host machine
if Vagrant.has_plugin? 'vagrant-hostmanager'
config.vm.hostname = 'local.dev'
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.manage_guest = true
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true
#config.hostmanager.aliases = %w(example-box.localdomain example-box-alias)
else
raise Vagrant::Errors::VagrantError.new,
"vagrant-hostmanager missing, please install the plugin:\n" +
"vagrant plugin install vagrant-hostmanager"
end




config.hostmanager.ip_resolver = proc do |vm, resolving_vm|
if hostname = (vm.ssh_info && vm.ssh_info[:host])
`vagrant ssh -c "/sbin/ifconfig eth1" | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`.split("\n").first[/(\d+\.\d+\.\d+\.\d+)/, 1]
end
end

# Set share folder permissions to 777 so that apache can write files
config.vm.synced_folder ".", "/vagrant", mount_options: ['dmode=777','fmode=666']
Expand Down