Friday, September 29, 2017

Freeside Development Environment (day 1)

I'm on the job market again after two wonderful years at Broadbean. Sadly, budget cuts eliminated my position and several others, but enough about that. Anyway, as part of my job search, I came upon Freeside, which is a billing application for ISP's, CLEC's, and similar. They work on an open source, paid support model, so after discussion with Ivan, the CEO and "head geek", I thought I'd do some work "on spec" as a job application of sorts. But to begin with, I need a development environment.

At Broadbean I got used to every package we worked on having its own cpanfile. This meant that, using perlbrew, all I had to do was perlbrew lib create perl-<version>@<package>, and then cpanm --installdeps ., and I was set. Freeside doesn't work like that, so I'll set up a VirtualBox VM for it instead.

I'm going to use Debian 8.9.0 (Jessie), as that is the version where installation instructions are completely documented in the Freeside wiki. So I've downloaded the Debian network install CD image from https://cdimage.debian.org/cdimage/archive/8.9.0/amd64/iso-cd/ and will install it into a VM. I've got Google Fiber, so this shouldn't take long.

Since I intend to interact with this VM via SSH and a browser, I've selected the "web server", "SSH server", and "standard system utilities" collections. A few minutes later, the system is installed, I've rebooted the VM, and installed sudo (I prefer using sudo to simply doing su). I set up a network interface, put in my SSH key for passwordless login, and I'm ready to start setting up my development environment.

First thing to install is vim. This is my preferred editor for code, and I can't abide nano. ;) Next I set up the package repositories as specified in the Freeside installation instructions and install the Freeside packages. I'll note here that aptitude is recommending that I remove the packages exim4, exim4-base, exim4-config, and exim4-daemon-light, and is not installing the recommendation of the Perl EV package. I assume since Freeside is installing Mojolicious, it is going to be running under Mojo::IOLoop (which I was just working with at Broadbean. Freeside++!) No, I was mistaken. Only very minimal usage of Mojolicious in Freeside.

OK, a few minutes later all the packages are installed and I'm setting up the database. Note where the docs say "[ as postgres/pgsql user ]" they mean "user" to be the system user (from /etc/passwd) "postgres". I set up the database role with a crappy password (this box isn't exposed to the internet, after all) and as the "freeside" user, I execute freeside-setup -d example.com. Note that the domain is important - if it's not a valid TLD, freeside-setup will throw an error and you'll have to blow away the freeside database and start over. Anyway, freeside-setup barfs, so now I need to figure out what I did wrong.

Turns out the wiki has things in the wrong order. I need to set up the RT database before I run freeside-setup. With that done, I can move on, install the system users and so on, and I should be up and running. Sure enough, I am able to restart the Freeside daemon successfully.

Since I want to hack on Freeside, I think I need to blow away the Freeside packages and set up a fresh installation via the instructions on installing from source. This might allow me to use perlbrew as well, but I'm not certain of that. But that's a task for another day.