Saturday 22 November 2014

Writing and moving words

The past week I've mainly been putting the church magazine together and working on a couple of articles for my photo tips website. This morning I made some Gingerbread Latte syrup. I had some in a Coffee with plenty of milk, but it didn't seem very tasty. Maybe you need 1½ teaspoons to taste it better.

Monday 3 November 2014

Giving up on Vagrant

Well, I probably haven't got everything working with my Vagrant box yet, but I can at least access a local copy of my website through it.

The first issue I had today was that Nginx wasn't starting with the machine, and my @reboot cron job wasn't being run either. I found the reason and a solution here: If Nginx doesn’t restart on Vagrant up. The problem is because vagrant (virtualBox) only mounts the shared folders after init and cron have run. So, in my case, the nginx conf files were in my shared folder, and the script I wanted to run @reboot was too. The solution is to add an init conf file to /etc/init that will start nginx / run the script when the vagrant shared folders are mounted.

Another issue I had was that although I had imported my mysql database, the users / privileges didn't seem to have carried over. I found the solution to this here: How can I export the privileges from MySQL and then import to a new server?. Strangely there were quite a few privileges for tables that no longer existed, so I had to delete those to get the import to import everything successfully.

So far, there are three points that seriously hamper the usability of Vagrant for me. Actually, these aren't really related to Vagrant, but problems using shared folders with VirtualBox when running a linux guest OS on a Windows host OS:

  1. Permissions can't be set properly. You can set permissions for a whole folder through the mount_options when mounting a shared folder, but this applies to the whole folder contents, and is a bit of a kludge.
  2. You can't create symbolic links in the shared folder. If you do it from Windows, then the VM can't read the link.
  3. Shared folders aren't mounted early enough, causing issues with init scripts and @reboot cron jobs.

Despite these problems, I intend to persevere, at least for the moment. The issue with using a standard VM without shared folders is that even if you only change 1 byte of code in a single file, then you have the whole VM to backup. I guess you could always just backup the files from the VM, but that means having to start up the VM and use FTP whenever you want to backup.

Aggh! I just found another issue with the shared folders - it seems that the VM has the same restrictions as windows when working with long filepaths in the shared folders! There is a possible solution given here: VirtualBox bug tracker: long paths (>260chars) cannot be created using a host:win + guest:linux setup.

However, I couldn't get that to work in combination with Vagrant. I tried specifying the path in the VagrantFile, but that gave an error about //?/E not being valid when trying to vagrant up. (I was using an absolute path to a folder on my E: drive). I tried running the command, which added the folder, but VirtualBox would not auto mount it. And you couldn't set the Auto Mount option for it using the VirtualBox GUI (the OK button was greyed out).

I also tried setting that up, then using a standard path in my VagrantFile, but the path in the VagrantFile overwrote the path set up using VBoxManage.exe. Thus the \\?\ at the start of the path was lost.

So it seems to me that with all these issues, Vagrant using VirtualBox with Shared folders on a windows host OS is just not usable at the moment. I'm going to go back to my VMWare Ubuntu VM for now. It took me over a week to try and set up this VM, only to have to abandon it. But I did learn some things along the way. Most of them I'll probably forget, but hopefully I can take a look at replacing my current shared hosting account with a VPS at some point.

Sunday 2 November 2014

Spyro Gyra got played on "HFM through the night" (no DJ)

Today I was still trying to get my Vagrant box set up. I'm getting closer, but still not quite there yet. I think if I've learned one thing from this process, it's that I really ought to be using VPS hosting so I don't have to compile everything from source. It would make installing, and just as importantly, keeping everything up to date, so much easier.

I also had another issue with Vagrant / VirtualBox, which is that as well as not being able to create symlinks in a shared folder, it can't read them either. Quite annoying, as I was thinking that creating the symlinks from windows might have been a solution in some instances.

I was quite happy with myself today as I managed to start writing an article in the afternoon, and had it ready to publish by 9pm. As usual finding and inserting the pics took a lot longer than the actual writing process, but I was able to find relevant pics a lot faster than I usually can.