Audcom
Servers, Ubuntu -> FreeBSD

Hello!

There's actually a couple of intermediate steps that have happened in the past year and a half or so. Arch was falling out of favor with DigitalOcean, so I moved my servers over to Ubuntu. As one might expect, that migration was relatively painless. There were version differences between the two, but for the most part my configuration and setup could be copied almost as-is and everything worked pretty well.

For the move to Ubuntu, I did alter my servers a little bit. My webserver picked up Varnish in front of it, and I believe this was also the point where I made the full switch over from Apache to NGINX, instead of maintaining a hybrid setup with my Drupal sites being on Apache and my non-Drupal sites being on NGINX. I put together a PHP-FPM setup that worked well to shove out my previous Apache/suPHP setup and separated out my NGINX configuration enough that adding new sites is a breeze. Around this time, I also dropped GitLab and developed my own "gitwrap" utility w/ Python 3. My util and git servers were merged into one, and I dropped my BYOND and area51 servers as they saw very little activity. I also dropped OpenLDAP for the time being, as I was no longer running Redmine.

That brings us up to November 2015. As of September, I had switched my Desktop over to FreeBSD. I eventually switched over to Xfce, and I've yet to look back. In November, I decided to take the plunge and convert my servers from Ubuntu to FreeBSD. The initial step was to assess version differences between Ubuntu and FreeBSD. Much to my fortune, there was not much of a discrepancy in Varnish or NGINX versions-- nothing to significantly change my configuration, the following steps were then taken to migrate properly:

At first, I put up two servers that I would then be moving to: www2 and util2. Only being two months into my FreeBSD experience, I hadn't actually setup any of the stuff I would need on my servers before in a FreeBSD-way. So, I installed www/nginx, lang/php56, databases/postgresql94-server, and www/varnish4 (FreshPorts is awesome, by the way).

First observation: php-fpm actually comes with lang/php56...OK, that's interesting (and convenient)! I was already aware that most configuration of packages not in the base system occurs in /usr/local/(etc), so I was prepared for that. I wasn't quite prepared for php/fpm conf files to just be dropped into /usr/local/etc, but that's not exactly a killer. The stock php.ini-production was suitable for my needs, so I symlinked that over to php.ini and moved on to FPM.

For FPM, life's not too difficult. Adding an "include=etc/fpm.d/pool.d/*.conf" is enough for me to go ahead and copy over my pool definitions. For each pool, very little ultimately needed changed. Listen socket as well as user/group and listen owner/group, then log locations to reflect that I'd now like to put logs in log/nginx (/usr/local/log/nginx).

After that, FPM and PHP were happy enough that I went ahead and setup NGINX. This setup was also pretty easy. I commented out the server {} block in nginx.conf and added an include directive to make sure I was pulling in etc/nginx/sites-enabled/* -- which is where I prefer to store my server {} blocks. I pulled this one from Apache habits, and have a corresponding sites-available/ directory that holds all of my site configuration, and then sites-enabled/* is just a bunch of symlinks. Other than that, I was actually able to drop in my drupal.conf, php.conf, set-pool.conf, and ssl.conf to etc/nginx without changing anything except the path to my php-fpm sockets in my php.conf. SWEET! Now NGINX is happily serving my domains, although I hadn't quite switched over DNS at this point or stood up Postgres.

Varnish was also relatively easy-- still using Varnish 4, so I could drop my 4.vcl from my Ubuntu configuration into etc/varnish and setup varnishd_config in /etc/rc.conf appropriately, and all was good.

Postgres was a slightly different story. I was moving from 9.4 to 9.4, so things got a little bit sketchy. I've got 9 or 10 different databases in the same cluster, so I didn't necessarily want to backup/restore to a new cluster as I probably should have done (note: If it's feasible, this should be the recommended method- especially if you're moving between minor versions). Instead, I rsync'd my data/ directory over on a live/running instance of Postgres, and adjusted accordingly.

I did not maintain symlinks to any of the *.conf files as I was in Ubuntu, but that didn't seem to be an issue. I created new local users for my corresponding database users, and then ran into an issue with postgres/pgsql differences. In Ubuntu-land, the user is named 'postgres' -- this seems to make more sense to me, because initializing the cluster seems to automagically created a databasee named 'postgres'. databases/postgresql94-server actually creates a 'pgsql' user, but cluster creation still automagically creates the 'postgres' database- so a `psql` as pgsql won't actually get you into a working database or command-line at first, which seems kind of odd. If I were first dealing with postgres on FreeBSD without any previous experience, I would probably be mildly confused by this. I tested this out on my laptop, just to make sure I wasn't crazy.

Much to my happiness, though, this pretty much worked. All of my data happily carried over, I just needed to get in and rename the 'postgres' user so that my local authentication as 'pgsql' would still be happy. My webserver was up and running at this point, other than needing to install a couple of other extensions (all suitably named either php56-* or pecl-* -- this made things really easy to work with).

My git server is not much to speak of, however. As it was a custom 'gitwrap' wrapper, all I really had to do was install lang/python35, rsync my gitwrap directories over, and then everything was pretty much happy.

I suppose the point (or TL;DR, if that's your flavor) of this post is that it doesn't have to be painful to make the switch from Linux to *BSD. Granted, my setup isn't all that intense/extensive- I have Drupal (backed by Postgres) running w/ PHP, PHP-FPM on NGINX behind Varnish. I have a couple of other odds and ends running around on here, but nothing to speak seriously of. My webserver doesn't have an entirely uncommon setup, and I was still able to easily find comparable ports to suit my needs. Installing PHP extensions was also entirely straightforward, and these things are pretty well-named. The problems you run into in your own migrations will be different than the problems I experienced, but given what I've already seen and know- I don't suspect they'll be anything major or show-stopping. My migration for both servers was completed in under 3.5 hours.