Vagrant setup error (privatenetwork) & SS 4.x

Silverstripe Version:
4.x
Question:
https://docs.silverstripe.org/en/4/getting_started/installation/other_installation_options/vagrant_virtualbox/#the-private-network-and-hostname

After getting frustrated with MAMP, I’ve decided to try out vagrant.

The above link has a section dealing with the privatenetwork

...

 # 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.hostname = "virtuallythere.dev"
    config.vm.network "privatenetwork", ip: "10.1.2.50"

error

  Trevors-Mac-mini:virtuallythere trevorpan$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:
* Network type 'privatenetwork' is invalid. Please use a valid network type.

If you have any tips, I’d appreciate them! Thank you ~

I tried changing the “privatenetwork” to:

# Create a private network, which allows host-only access to the machine
# using a specific IP.
    config.vm.hostname = "virtuallythere.dev"
    config.vm.network "private_network", ip: "192.168.33.10"
# config.vm.network "privatenetwork", ip: "10.1.2.50" 

and also moving the tutorial ip to the “private_network” (this was in the base install of vagrant)

doesn’t seem to allow me to connect.

Enclosed is a folder structure, as best I can read from the tutorial.

(from tutorial)
All they need is listed in the Requirements at the top, and the files you’ve just created:

Vagrantfile
setup.sh
apache/virtuallythere.conf
public/ (with SilverStripe files here)


there seems to be 2 .conf files listed. vagrant.conf and virtuallythere.conf Are both of these necessary?

Have you upgraded to MAMP Pro 5? It solved all of my Silverstripe 4 CLI issues in one fell swoop.

Hi Gelert,
Didn’t have the thought to do so… but I may follow your suggestion soon!

The fellas at SS said they think vagrant is the best local development solution. Thought I’d give vagrant a shot. I like the idea of setting up a bunch of OS to view how it looks on other machines.

I feel I’m real close to getting this vagrant to work. I think it has to do with the folder structure, or .conf. The guide on a vagrant install is very simple and different than the SS guide linked above…which requires more finesse.

I saw that thread and commented. Then the very next week MAMP Pro 5 came out and surprised me by solving the issues I had. I think they should re-recommend MAMP Pro 5. It’s way easier to use than Vagrant to get up and running with SS.

1 Like

Has anyone else got stuck at the privatenetwork part of the tutorial?

I’d like to try out vagrant and am stuck. When I type in virtuallythere.dev/install the connection times out. Is this likely a ip issue? Is the keyword “privatenetwork” actually “private_network”?

Yeah it should be “private_network”. Can you connect directly by the IP address you specified instead of the hostname?

I’m not sure if this is part of your problem but “.dev” is problematic for local development now because Google owns that TLD and Chrome (and probably other browsers by now) now forces .dev sites to only accept secure connections (if you’re curious about this google HSTS preload list). So you may want to use something like “.localhost” instead.

If you want to take a step back you could bypass the tutorial you referenced and try setting up a Vagrant box using Scotchbox. It should be quick and easy to set up and be suitable for installing SilverStripe on. You could then set up a virtual host if you want but for the few sites I use Vagrant for I don’t bother. I only ever have one Vagrant box running at a time, so I have http://192.168.33.10 bookmarked as ‘Active Scotch Box’.

JonoM Great tips!

I did try pasting the ip address as you mentioned, got the error with
10.1.2.50

Just am unable to get the settings right. I’d like to but maybe I’ve got the folder structure slightly off.

After downloading Scotch box I put this ip in and their branded welcome screen showed up!
http://192.168.33.10/

The site I’m wanting to get started with is BidBird, when you work on projects with Scotch do you have a base SS folder and then those projects are in them? Wondering if this is necessary for the .env files?

Do plan to work on another site before too long.

Normally you would have one Scotch box (Vagrant box) per project. You initialise a Vagrant box in the project root, which could be wherever you like on your computer, e.g. ~/Sites/BidBird. You install SilverStripe to the same directory, which is exposed to the Vagrant box as the web root.

In that example, if you had a global .env file in ~/Sites that you want to trickle down to all your sites, I don’t think that the Vagrant box would be able to read that, as it’s outside the project root. So you would have to have a .env file in ~/Sites/BidBird. with all of your SS environment configuration.

Ok great. JonoM

So many things to keep track of! I’m hoping this turns out to be fruitful. Definitely going to give her a shot.

Gelert I wanted to thank you on the MAMP 5 update. The intl.so was once figured out, but it came back and caused trouble, and turned me off.

I’m still trying to decide which local dev works best for me—don’t want to discount anybody’s suggestion.

Thank you both!

No problem. It’s certainly easier to stick with MAMP Pro 5 if you’ve been using it for years, like me.

I’ve been re-attemtping my SilverStripe 4 upgrade from my own SS3 website today and I’ve had loads of success. It’s taken me ages to get a grip of how SS4 works after many failed attempts. The documentation is all over the place but I’ve pieced it all together now and taken my own notes. There are some real gotchas to look out for (when I get a minute I’ll post my tips). Overall though SS4 is very resilient and I’ve not had to throw the whole thing away and start over despite really having it all in a mess at several points. I’ve even picked up a few tricks along the way.

One of my bigger problems seems to have been that I never split my Page Controllers out into separate files back in SS3. It simply wasn’t necessary (well if it was it never caused me a problem in SS3).

I’m now on SS 4.2.1 using MAMP Pro 5 and update-code and composer are all fully working. Just a couple of things to get working. Mostly Gridfield related stuff. Goodness knows how to upload it to a shared hosting service though… I’ll have to setup a test sub domain account to try first.

Then an attempt on a truly massive SS3 site that took almost a year to dev. Not sure how that will pan out. I think a staged approach.

1 Like

Actually it’s not me is it? Silverstripe 4 requires the separation of Controller.

Compare these:

and

That’s gotta be as big than anything else in the upgrade process but I’ve not seen mention of it anywhere yet. Given I’ve tried and failed many SS4 updates recently that’s got to mean it’s either buried deep in the documentation or not mentioned or I’ve just missed it starring at me somewhere.