Rocketeer on Laravel 5

Using Rocketeer to deploy code with Laravel 4.2 is nice and easy, using the standard Rocketeer library in Laravel’s composer file. Rocketeer doesn’t play so well with Laravel 5, and so we have to approach the install from a different direction.

The solution here is to use composer to install Rocketeer globally.

composer global require anahkiasen/rocketeer

Config files can then be found in the .rocketeer folder, you can also setup your environment using the ignite command

rocketeer ignite

Then, to deploy your code you can use:

rocketeer deploy

Easy!

Update

If this method doesn’t work, you can download the file manually

wget http://rocketeer.autopergamene.eu/versions/rocketeer.phar
chmod +x rocketeer.phar
sudo mv rocketeer.phar /usr/local/bin/rocketeer

Full Server

Recently one of our app servers stopped serving, the server was running, but it had run out of disk space. The database wasn’t too large, and the Laravel apps log files weren’t massive.

The first stop then was to find any large files, to see what was clogging up the system.

find / -size +10M -ls

This revealed a 17Gb log file: /var/log/mysql/mysql-slow.log

It appeared that MySQL was taking it’s time with some queries.

We sync our database with various external APIs every day, these are inserted in bulk, so I don’t mind them taking over 0.1 second to run (the default slow-query log threshold set in our mysql config). What I do mind is having the server run out of space due to large log files.

Read More

Laravel to Digital Ocean using Server Pilot and Rocketeer

Recently I have been using Digital Ocean, they provide simple, quick, secure, and easy to setup servers which are perfect for hosting Laravel projects. They use SSD drives, take less than a minute to create, and cost as little as $5 a month, pretty nice!

I also recently discovered Server Pilot, a *really* easy way to manage your new server. With one line of code in terminal it sets up the server ready for use. It installs ngnix + Apache (yes, both at the same time), deals with security, then makes virtual hosts, ssl certificates and mysql (including security) as easy as 1 click.

Rocketeer is a deploy script, used for deploying php code simply, it integrates with Laravel nicely too.

Laravel is my MVC framework of choice, and here’s how I get it running on Digital Ocean using Server Pilot and Rocketeer.

logos

In this post we’ll be

  1. Creating a Laravel project on your local machine
  2. Uploading that to Github or Bitbucket (I’ll be using Bitbucket)
  3. Creating a server on Digital Ocean
  4. Using Server Pilot to setup the server for our needs
  5. Logging into the server to confirm a few basics
  6. Using Rocketeer to deploy our code to the server

This guide assumes you can use git, and you have accounts with the following sites:

It also assumes you have Git, Composer, and PHP installed locally.

Right, lets get stuck in!

Read More

Framework

Back when we started Libboo we coded everything ourselves, we wrote the entire backend, all the interface, and every line of css.  We were learning as we built, so it seemed like the logical thing to do, it was only later that we realised that there were frameworks for everything, and that we needn’t have built it all ourselves.

The css for Libboo a year ago was all handed coded, all of it (over 10,000 lines), and had become a bit of a beast.  The trouble was that file was created back in 2007, and we’d added to it over the next 4 years, I knew where everything was, but to anyone else it was a disaster (i.e. when we hired RM).

We had decided to re-work the front end code, and so I started looking around for possible frameworks, some looked promising, some looked over complicated, but none really filled the gap we had.  That was until a fellow Techstar colleague mentioned bootstrap.  I had used it before on small projects, but hand’t considered it for a larger project like this.

Bootstrap

Bootstrap features

Bootstrap contains several massively helpful tools to start you off:

  • 12 Column Grid system
  • Responsive design (adjusts to desktop, large desktop, tablet, mobile)
  • Styling for forms, in all shapes and sizes
  • Icon set for use with buttons, errors, etc
  • Styling for alerts, error, progress bars, labels
  • Extensive support for dropdowns and menus
  • Javascript plugins for modals, tooltips, carousels
  • Plenty more to be playing around with

When we started using it we realised that bootstrap did more than we expected, so many tasks that would have involved a large chunk of code were already built in, so it made the process of building the new site a pleasure.  We didn’t need to build a framework ourselves, and that became obvious fairly early on as we started using bootstrap.

Simple modal popup

Simple modal popup

You can get bootstrap from github, you can also get it as part of a package from Initializr, which bundles in an html5 boilerplate, as well as some other useful tools.

Using it saved us a huge amount of time in creating a framework, it does all the hard stuff for us, and it reduced our css by 80%.  However you get it, and whatever size  project you end up working on, bootstrap is a simple way for you to get up and running (with pleasing results) very quickly.

 

Re-building

We new we had some serious changes to make to the site, we cranked our brains over several weeks to come up with a suitable solution, it was big, and was going to require a lot of work.

The changes meant that we would be starting from scratch in various areas; we could no-longer rely on the same interface, the code that had been written over more than four years, or the aging database, and we were going to have to do something drastic.  We started with a sparkling white php file, and began the lengthy process of updating and migrating all the required backend code to our new codebase. The database was stripped back to the core of what we required, emptied of data, and re-built to meet the requirements of the new site.

The front end was no different: we imported our new framework, then built up every page by hand, making sure we cleared away the years of re-writes that we had applied to the old site. My job involved co-ordinating the development, as well as re-writing the front end, which took up all of my time and spare brain cycles for the full four months.

Initially we knew what features we were going to be building in, but as we didn’t have a designer working for us at the time, we didn’t know how it was going to look.  I was building to a rough wireframe that I threw together for each page until we could get a full design drawn up.  Halfway through the build process we hired Nicki, and then we had designs which really helped to pull it all together.  The two weeks before we deployed is where the pressure mounted, and were the hardest I’ve ever had to work.  We were working 16-hour RedBull-fueled days getting it all finished, built and tested on time, despite significant last minute changes to design and functionality days before we went live.

We’re very happy with the way it has come out, and hope to prove ourselves with the results.