Accessing Dev Environment from another VM (Virtualbox) - virtual-machine

On my OSX machine I have two VM's running:
Development Environment (aka DE) (Linux)
Testing Environment (aka TE) (Win7 IE9)
In my TE, I would like to be able to access a server running on my DE. Pretty straight forward sounding but I'm sort of new.
I'm using Virtualbox as my client on both machines. My dev environment is a vagrant box setup with puppet. I can modify it with virtualbox as well for now. SIMPLEST solution wins. I have tried nested-boxing, it doesn't work :P

I was able to achieve the desired results much more easily than I had anticipated. I had to add the same lines I added to my local machine to my VM.

Related

Magento 2 development environment on local server

I need to create a local development environment and struggling a little with the setup. I want to replicate my live server as close as I possibly can.
I want to install Magento ver 2.1.8, running MySQL 5.6, PHP 7.0 with NginX and Debian.
Now, it would be more than one person which will be working on the development sites, therefore, it will have to stored on our local server.
We are working on Windows 10 Pro machines.
I had a look at tools such as VirtualBox, Vagrant and Docker but reading about them got me even more confused.
I had a brief look at the LAMP stack too. Could you recommend the best way to go for my situation?
Do I have to use these tools in combination with each other?
Do I have to install the software on each computer or on local server?
I recommend to use this docker container: https://github.com/yvoronoy/magento2docker
It uses apache but you can change it via editing Dockerfile. Main advantage in this container is configured sshfs mounting in MacOS which works a little bit faster that default mounting, and you can work with source code as you work on local instance.

Is there a fast painless way to setup a linux distro on VirtualBox?

I like the Docker Hub with dockerfiles idea very much.
Is there a similar way to get a small working linux VirtualBox instance in a few commands, that could also be controlled from a command line?
Vagrant is a great tool that does just what you want and much more! It's a ruby application written for fast and simple setup of minimal development environments.
By default it creates VirtualBox images, but it supports VMWare and many others too. The whole setup of a box is managed by a single Vagrantfile! Your vm options, network settings and provisioning is done there.
Setting up a virtualbox box is as easy as executing just two shell commands. Checkout the Getting Started Guide for an example using Ubuntu.
You can use a vast range of prepared images from the Hashicorp Atlas or build your owns.
Also, vagrant doesn't limit you to one virtual machine per development setup, it enables you to model cluster setups on a single machine using multiple vms. I myself use docker for that part though.
Edit: fixed a typo :<

PhpStorm and other Tools in a Virtual Machine

I am developing php applications at my work.
The development server runs in a ubuntu vm, but on the host machine runs windows 7 os.
I keep running into problems with windows as a development environment and i am missing
some linux features. Unfortunately, I can not install another operating system on the host.
Now I wonder if I should install all my dev tools (like phpstorm) in another virtual machine
and do my work there. Does it make sense or will i get performance issues?
This is the perfect use-case for Vagrant.
Create and configure lightweight, reproducible, and portable development environments.
From the official website.
It can be controlled with PhpStorm and it is perfectly lightwight.
I am using PhpStorm, Vagrant & Puppet with nginx, php and mysql, XDebug and I am quite happy with it, quite powerful and very easy to deploy.
EDIT
And this is awesome blog post by James McFadden on Using Vagrant and Puppet to build a PHP, Nginx and MySQL environment and you can find numerous others with apache or any other tool you might need.
DECLAIMER: The step with replacing my.cnf didn't work for me so I could advice you to just skip it.

Ubuntu on VirtualBox and Rails server

I have Windows 7. Installed VirtualBox and Ubuntu 11.04 as guest OS.
Networking is done by NAT.
Everything is fine: I have internet on Ubuntu.
I can access Windows from Ubuntu by its ip.
But i can't access Ubuntu by it's ip which is shown by ifconfig.
I run rails on Ubuntu.
How can I solve this problem: connect to Ubuntu/Rails server on ort 3000 from my Windows?
By default, VirtualBox's NAT allows the virtual machine to access the Internet ; but doesn't allow the physical machine to access the Virtual one.
The simplest solution would be to use another networking setting than NAT, for your Virtual Machine -- for instance, bridge should work fine (your VM would be visible on your network, though).
Another solution would be to use port forwarding ; about that, this article might help : Howto Access via ssh a Virtualbox Guest machine.
I used to struggle with configuring a similar setup until I found Vagrant. Vagrant makes it very simple to setup, connect to and work with a Linux virtual machine. After Vagrant is configured you can just type vagrant ssh to enter the virtual machine and your account has automatic sudo rights and everything works as expected - you don't even have to deal with logging into the vm. The initial setup for ssh does look to be a little more work under Windows though as you need to configure Putty before you can connect.
There is a simple configuration file in Vagrant that you use to specify which ports from the VM you want forwarded to your machine using a syntax like:
config.vm.forward_port("rails", 80, 3000)
config.vm.forward_port("tomcat", 8000, 8080)
and everything is taken care of. Details are here
If, for example, you are using Rails and you start vagrant with the command vagrant up in your Rails project directory than that directory is available on the VM. Since it is the same shared directory between machines, any changes you make in your Rails project directory on your machine using your regular editor is seen on the VM also. This makes testing in other environments very easy.
Instructions for setting Vagrant up with Windows are here and a RailsCast about it is here. Note that Vagrant has nothing to do directly with Rails - you can use it for setup of any virtual machine environment you need.
In short, you can't.
It is a local host not a public domain therefore not publicly accessible outside of your virtualbox environment.
Maybe someone has a clever hack for this but why would you want to do this in the first place?
Your solution is to either use firefox to browse to your localhost within your virtualbox linux session or develop on windows.
Personally I work the other way round I run Ubuntu 11.04 and I have virtualbox installations of xp, 2,000, me, vista and 7 so I can test in different environments. Inevitably I end up sharing my project folder from Ubuntu so that I can run the project in whatever OS I am testing for.

MAMP/LAMP native or virtual (Virtualbox/VMware)?

What is your preferred development environment ?
Native
WAMP/MAMP/LAMP (Apache, MySQL, PHP) on Windows/MacOS/Linux
Working copy local, SVN/CVS on server
IDE/Editor on the same system (Eclipse, Aptana, Zend...)
Virtual/Native (Server on VM)
LAMP on VirtualBox/VMware
working copy in the VM
IDE/Editor on host, access to the VM with Samba, FTP, SFTP (eventually mapping with tools like WebDrive)
Virtual (VM)
Complete development environment running in a VM (server, tools, IDE)
Host is only used for special tools not available on the OS running in the VM
All have pros and cons.
With BitNami stacks you can run the exact same XAMP environment locally or remotely (and make sure everybody on your team is running the exact same stack). It is free and works on Windows, Linux, Mac.
I like having the SVN repository somewhere on a web server.
It's reasonably secure (using Apache WebDAV), and it gives me a good chance of recovering quickly from any disasters that may befall my main development machine. I have the luxury of control over my own web server, but there are lots of cheap hosts that will do the job at low cost.
As regards VM or no VM:
Advantages of VM - very fast recovery from screwing up your development environment
Ability to try out different versions or upgrades quickly
If you have many systems running the VM host, ability to quickly move the whole environment
Can choose any Host
Disadvantages of VM - performance impact; extra setup complexity.
On balance, I go for "no VM" if all the tools are available on my host system, but I do use VM when I need to run a different OS (the host system is a Mac Pro, so if I need Visual Studio, I do it with Parallels).