Expose windows vagrant by ngrok - laravel

Hi I'm using windows vagrant and homestead developing laravel application.
i have this in my hosts file
192.168.10.10 laravel.dev
I wanted to expose this url so that I can test one requirements like responsiveness and the like. How to do this?

Use the share command: https://laravel.com/docs/5.5/homestead#sharing-your-environment
Also, you should change your .dev TLD to .test otherwise browsers will start complaining about your site.

First of all you are you using a private network in your Vagrantfile ? something like :
config.vm.network "private_network", ip: "192.168.10.10"

Related

Expo and Vagrant

I am trying to build a react-native-app on a vagrant linux box.
I am trying to access the app on my phone using expo but it just does not work.
Has anyone managed to make this work with port forwarding or something similar?
You need to have the linux box on the same network as the phone.
To make this a little more specific, the vagrant file should include the following line(the ip address is optional):
config.vm.network "public_network", ip: "ip address"
for example:
config.vm.network "public_network"
config.vm.network "public_network", ip: "192.168.1.9"
Here are a couple of useful links:
Youtube tutorial by sureshkm
Vagrant docs

Switch IP's in browser

For my development environment I'm looking for a way to change/override IP addresses used in DNS lookup for a domain, so I can point the domain to my local vagrant box with ease and without changing the hostfile everytime I want to switch back and forth from the live env to the dev env. I couldn't find a way to do this so I'm hoping there is a solution for this. I'm using Mac OS X.
Perhaps the Vagrant Hostsupdater plugin can be of help. It automatically adds entries to your local hosts file, when you include the following config in your Vagrantfile:
config.vm.network :private_network, ip: "192.168.3.10"
config.vm.hostname = "www.testing.de"
config.hostsupdater.aliases = ["alias.testing.de", "alias2.somedomain.com"]
Source

How to route and network Vagrant VM instances?

I have recently started using Vagrant instead of MAMP for some small projects (mainly WordPress) However, decided to try my hand at React and am wondering wether it is possible to use the two together?
At the moment I have a Vagrant setup created via PuPHPet which works fine and runs a local server on a VM which I can access via a URL - local.gethandle.com. I also downloaded a React starter kit as a starting point from a Facebook github page and it requires you to run a server e.g. node server.js which also works and I can access from a separate URL - http://localhost:3000/. But cant seem to access my React application via my Vagrant URL.
How do I combine the two? If at all possible.
Oki doki,
caveat: I've not looked at what kind of VM is provisioned via PuPHPet..
First you'll need to vagrant ssh into your vagrant vm and download the react tools into your vagrant vm
https://docs.vagrantup.com/v2/getting-started/up.html
Second you'll then want to edit your Vagrant file that should be in the directory on your machine where your vagrant settings are, then have a look and add some networking config
https://docs.vagrantup.com/v2/getting-started/networking.html
config.vm.network :forwarded_port, guest: 80, host: 4567
# guest is your machine, host is your vagrant vm
# e.g config.vm.network :forwarded_port, guest: 3000, host: 3000
You probably need to add the port to your firewall:

Boot2Docker private network setup

How can I do the private networking for the boot2docker docker container ?
For example, If I have a webapp, I can do the following in Vagrantfile
myapp1.vm.network "private_network", ip: "1.2.3.4"
myapp2.vm.network "private_network", ip: "1.2.3.5"
myapp3.vm.network "private_network", ip: "1.2.3.6"
Then I can use my browser to access my webapp at
http://1.2.3.4
http://1.2.3.5
http://1.2.3.6
How can I achieve the same result in docker easily ?
I also looked at How to expose docker container's ip and port to outside docker host without port mapping?
But in my boot2docker1.3, it said the interface eth0:1 does not exist
I looked at https://docs.docker.com/articles/networking
The tutorial does not work for boot2docker in mac.
Any help would be appreciated, thankyou!
I believe the instructions here, linked from this question give what you are looking for. The key is this line:
sudo route -n add 172.17.0.0/16 172.16.0.11
which tells your Mac how to route to the private network inside the VirtualBox VM that the Docker containers are on. (Obviously the specific addresses can change for your specific situation)
This still doesn't give you the ability to assign specific IP addresses to specific containers; as I said an add-on like weave can do that. (note: I work on weave)
You may also like this article which gives a beginner's overview of how Boot2Docker runs and illustrates how you have IP addresses inside the VirtualBox VM, and also an IP address of that box as a whole.

CKAN/Vagrant port forwarding

I created a vagrant box and installed ckan inside of it.
In the vagrantfile - i set up port forwarding to 4567 - so when in my browser i type
127.0.0.1:4567
I get to ckan inside the virtual box.
The problem is that now - when i do some actions in ckan like update my profile - I get redirected to
http://127.0.0.1/user/mirmir
which gives me an error of "Not Found - The requested URL /user/mirmir was not found on this server."
If i manually insert the :4567 so it becomes
http://127.0.0.1:4567/user/mirmir
everything works.
Any idea how to fix this?
You should probably be doing this with a private network: http://docs.vagrantup.com/v2/networking/private_network.html
Once you have added the IP address into your Vagrantfile like this:
config.vm.network "private_network", ip: "192.168.50.4"
You should reload vagrant and be able to browse to 192.168.50.4, there should now be no problems because you will not need to use a port in the URL.

Resources