• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 2.0 Get a free development environment for XenForo up and running in minutes

DragonByte Tech

Well-known member
#22
I'll look into creating a custom VagrantFile that will automatically install the fixes and patches on box creation.
If you want to be extra awesome, go with 7.1 for free users too instead of trying to patch 7.0. Everyone should be writing code that's compatible with 7.1 anyway :)


Fillip
 

DragonByte Tech

Well-known member
#25
Great, I'll give it a wee test once it's ready :)

Also another question; if I create a VM and install XF2 / all my mods in it, how would I go about copying the VM so I can boot it on another machine? I'm assuming I should just zip up the VirtualBox VMs/development_default_1512151825124_73202 folder? I'm also assuming I can boot that VM in VirtualBox on another OS?

I've never really given VMs a serious look due to performance issues in the past so I'm still pretty new to it :D


Fillip
 

NixFifty

Well-known member
#26
I'm finding that unless I stick to locally installed MySQL I can't use this, my SQL client doesn't support SSH tunnelling unless I pay for it (SQLyog Community Edition). If I use local MySQL that takes away some of the portability, so that diminishes the value for me unfortunately :(
HeidiSQL is a nice alternative on Windows.
 

Kier

XenForo Developer
Staff member
#27
Great, I'll give it a wee test once it's ready :)

Also another question; if I create a VM and install XF2 / all my mods in it, how would I go about copying the VM so I can boot it on another machine? I'm assuming I should just zip up the VirtualBox VMs/development_default_1512151825124_73202 folder? I'm also assuming I can boot that VM in VirtualBox on another OS?

I've never really given VMs a serious look due to performance issues in the past so I'm still pretty new to it :D


Fillip
The nice thing is that apart from the database, your mods never actually live on the VM, they live in the Windows file system. You can just copy/move the entire XF directory to wherever you want to move it, along with a standard mysqldump of the database from the VM, then provision a new box and off you go.

More to come...
 

DragonByte Tech

Well-known member
#28
I actually discovered the cause of the performance issues Ive been having with VMs; I need symlinks in order to support managing multiple mods in multiple forum folders (vb3, vb4, vb5, xf1, xf2) and allow for separate Git repos for each mod.

There's no way I'd be able to manage 140 mods across those platforms if I manually copied files back and forth, or had 1 forum per mod (how would I test integration?) :p

So I guess I'm blocked from using VMs for anything other than quick one-off tests, which to be fair isn't the worst fate in the world.


Fillip
 

Kier

XenForo Developer
Staff member
#29
I actually discovered the cause of the performance issues Ive been having with VMs; I need symlinks in order to support managing multiple mods in multiple forum folders (vb3, vb4, vb5, xf1, xf2) and allow for separate Git repos for each mod.

There's no way I'd be able to manage 140 mods across those platforms if I manually copied files back and forth, or had 1 forum per mod (how would I test integration?) :p

So I guess I'm blocked from using VMs for anything other than quick one-off tests, which to be fair isn't the worst fate in the world.


Fillip
I'm not sure I fully understand the shape of the deployment you're talking about here... can you give me a few examples, as I'm sure there's an easier way to manage it
 

DragonByte Tech

Well-known member
#30
I'm not sure I fully understand the shape of the deployment you're talking about here... can you give me a few examples, as I'm sure there's an easier way to manage it
For instance, DB Security:
* A code repository for common files gets symlinked to the vB3, vB4, XF1 and XF2 installations
* A code repository for the vB version gets symlinked to the vB3 and vB4 installations
* A code repository for the XF1 version gets symlinked to the XF1 installation
* A code repository for the XF2 version gets symlinked to the XF2 installation

In other words, any single code repository can contain files that may need to be present in 1-4 different forum versions.

I also have a build process that triggers when I create a new tag in any of the code repositories, for instance I can tag "v5.0.0b1" and Github will send a request to the DBTech server that automatically places the files in that specific repository in our download generation folder.

That also means if I have to create a hotfix, I can tag "v5.0.0b1-hotfix1" and it will overwrite the "v5.0.0b1" files in the release folder.

I'd love to find a better way of managing this but I can't see it at the moment :(


Fillip
 

Kier

XenForo Developer
Staff member
#31
TBH, the only potential problem I can see with that setup would be if the folder from Windows that gets mounted on the VM as /var/www (using the example from the XF docs, that would be C:\Users\{username}\MyServer) couldn't follow the Windows symlinks - but I think it shouldn't have a problem with that.

You can test it fairly easily without moving any of your files...
1) In the config files for each of your installed packages (vB, XF etc.) change the name of the DB server from 'localhost' to 192.168.33.1 - which is the address of the host machine from within vagrant machines.

2) On your local MySQL server, allow connections from 192.168.33.*, then flush privileges etc.

3) Stop the Scotch Box server using vagrant halt

4) Edit the C:\Users\{username}\MyServer\Vagrantfile and change this line:

Code:
config.vm.synced_folder ".", "/var/www", :mount_options => ["dmode=777", "fmode=666"]
... to this, where {blablabla} is the existing path to the folder containing your various vB/XF installations

Code:
config.vm.synced_folder "{blablabla}", "/var/www", :mount_options => ["dmode=777", "fmode=666"]
5) Finally, Scotch Box expects to serve your files from /var/www/public, but as you've now got /var/www pointing directly to your web folder, you need to start up the VM, then vagrant ssh into it, edit the /etc/apache2/sites-enabled/000-default.conf file, and change the references to /var/www/public to /var/www, the save and restart Apache, and I think you'll be ready to test everything... probably
 

Kier

XenForo Developer
Staff member
#32
WRT getting a zero-config VM up and running, I've written a new Vagrantfile that runs a bunch of commands while provisioning the box, leaving you with a VM running PHP 7.1 with all the necessary modules to run XF2... but for some reason the XF2 installer is dying silently in install step 2b, which is currently leaving me scratching my head. But watch this space, and hopefully I'll have something working before too long.
 

DragonByte Tech

Well-known member
#33
TBH, the only potential problem I can see with that setup would be if the folder from Windows that gets mounted on the VM as /var/www (using the example from the XF docs, that would be C:\Users\{username}\MyServer) couldn't follow the Windows symlinks - but I think it shouldn't have a problem with that.
I did test it last night actually, and the autoloader in XF2 failed because it said the files didn’t exist.

I then copied my source files to a folder inside the VM. I ran the symlink generator script inside the VM, all the links failed to generate. Had to run the VM as admin, then the links worked.

Checked XF2 and the performance was in the toilet compared to a clean install with no symlinks.

I’ll continue experimenting, maybe I’ll figure something out.


Fillip
 

Kier

XenForo Developer
Staff member
#34
Right, got it all up and running with my custom Vagrantfile - which it turns out was working all along, but things were falling over for another reason related to me being an idiot.

Anyway, to use this, use the git clone, command, and then, before you run vagrant up, replace the the content of Vagrantfile, located in the /Users/{username}/MyServer folder with these lines:
Ruby:
# -*- mode: ruby -*-
# vi: set ft=ruby :

$bootstrap = <<SCRIPT
# This installs php7.1
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install -y php7.1 php7.1-xml php7.1-mysql php7.1-curl php7.1-mbstring php7.1-gd php7.1-bcmath php7.1-bz2 php7.1-enchant php7.1-imap php7.1-intl php7.1-mcrypt php7.1-pspell php7.1-zip php7.1-odbc php7.1-xdebug
# add the proper xdebug config
sudo echo -e "zend_extension=xdebug.so\nxdebug.show_error_trace = 1\nxdebug.remote_enable=on\nxdebug.remote_connect_back=on\nxdebug.remote_host=192.168.33.10" > /etc/php/7.1/mods-available/xdebug.ini
# This enables Apache to run php7.1
sudo a2dismod php7.0
sudo a2enmod php7.1
sudo service apache2 restart
# create a database for XenForo
mysql -uroot -proot -e 'create database xenforo'
SCRIPT

Vagrant.configure("2") do |config|

    # This is Scotch Box 3.0 (the free version)
    # _________________________________________
    # If you want PHP7, MySQL 5.7, Ubuntu 16.04, Build Scripts (customize your own boxes in minutes)...
    # ... an NGINX version, PHPUnit, Yarn, WebPack, improved email testing with MailHog...
    # ... generally Higher versions of things, Ruby (via RVM), Node (via NVM), WebPack ready, and more.

    # Just go to https://box.scotch.io/pro
    # Your support will help keep this project alive!

    config.vm.box = "scotch/box"
    config.vm.provision :shell, inline: $bootstrap
    config.vm.network "private_network", ip: "192.168.33.10"
    config.vm.hostname = "scotchbox"
    config.vm.synced_folder ".", "/var/www", :mount_options => ["dmode=777", "fmode=666"]

    # Optional NFS. Make sure to remove other synced_folder line too
    #config.vm.synced_folder ".", "/var/www", :nfs => { :mount_options => ["dmode=777","fmode=666"] }

end
Then run vagrant up.

This Vagrantfile also does all of the xdebug installation and configuration for you, and creates a shiny new database ready for XenForo, which is nice :)

Hopefully, this will build a 100% zero setup XenForo development machine, that is ready for the XenForo 2 installer as soon as it's run.

Let me know how you get on, and I'll update the live docs in the XF2 Dev Manual.
 
Last edited:

DragonByte Tech

Well-known member
#35
I’ll give it a test tomorrow, although I’ll change the DB name to xf2 so it wouldn’t be confused with any XF1 DBs :)

Thanks for your hard work on this :D


Fillip
 

DragonByte Tech

Well-known member
#36
sudo apt-get install -y php7.1 php7.1-xml php7.1-mysql php7.1-curl php7.1-mbstring php7.1-gd php7.1-bcmath php7.1-bz2 php7.1-$
# add the proper xdebug config
sudo echo -e "zend_extension=xdebug.so\nxdebug.show_error_trace = 1\nxdebug.remote_enable=on\nxdebug.remote_connect_back=on\n$
I think the $ means the lines are incomplete here :p


Fillip
 

Tiki Tiki

Active member
#37
I've been using MAMP but would love to try this. I'm not sure what a git client is though. Where can I find one for macOS High Sierra?