https://governmentasaplatform.blog.gov.uk/2016/09/29/first-service-paas/

Guest post: Moving the first live service to the Platform as a Service for government

Photo of shipping containers stacked up
Image by www.glynlowe.com Creative Commons Attribution license

This is a guest post from Matthew Ford, the Technical Director of Bit Zesty, on how the GOV.UK Trade Tariff service was moved to the Platform as a Service for government (PaaS). 

Bit Zesty is a Digital Marketplace supplier that runs the Trade Tariff service on behalf of HMRC and GDS.

The GOV.UK Trade Tariff is a service people can use to find licences, duty and VAT rates for goods they want to import or export. In July, the Trade Tariff became the first service to migrate to the PaaS.

In this post I’ll share some of the benefits and challenges of the migration.

Benefits of the PaaS

Maintaining the Trade Tariff service is now easier. We’ve maintained the Trade Tariff since it launched, but doing this as an external agency proved tricky at times.

The Trade Tariff used to run on the same hosting infrastructure as the rest of GOV.UK, but as an external agency, we didn’t have access to this. This meant we needed help from GDS  whenever we wanted to make changes (often called ‘deployments’) or investigate issues.

Since migrating to the PaaS, we’ve been able to fully manage the service ourselves. It’s now easier for us to make deployments and monitor performance. This means we can focus on developing and improving the Trade Tariff service, rather than having to worry about the underlying infrastructure.

We can quickly create new application environments

We followed the guidance on multiple deployment environments in the service manual: development, staging and production). Now we're on the PaaS we can easily create new environments when needed, for example for user testing.

Scale up or down easily and simply

One of the benefits of migrating to the PaaS is we can now easily scale up the application to meet demand, or scale down development and testing environments when they’re not in use.

The challenges we overcame

With the PaaS in private beta and the Trade Tariff the first live service to migrate to the platform, this collaboration was in many ways a learning curve. It presented the PaaS team and Bit Zesty with challenges and insight, which will no doubt inform how the platform is iterated and developed for the next services to onboard. Here are some of those challenges.

Restrictions of cloud hosting

The PaaS is built on Cloud Foundry. Like most PaaS platforms, Cloud Foundry has a number of restrictions compared to more traditional hosting, such as a short-lived file system, ie one which can be destroyed at any time. We knew this would have an impact on how we imported the files we received on a daily basis from HMRC and the EU. To solve this we redesigned our file import process to use a cloud based file store called Amazon S3.

This approach is a one of the best practice 12 Factor Application principles - we adopted these during the migration to Cloud Foundry.

Different databases

The Trade Tariff was built on MySQL, but at the time we migrated PaaS supported PostgreSQL. To move the service to the PaaS we rewrote complex database queries and ran both applications in parallel. By doing this and testing extensively, we could make sure the data returned by the new version matched the old version.

Scheduling tasks

Scheduling periodic jobs was another challenge we solved. We used to have cron job (a job scheduler) that ran our daily import and database update process. Cloud Foundry doesn't have this functionality built-in, so we migrated our jobs to use the open source tool Sidekiq and used sidekiq-scheduler for periodic jobs.

Backing services

There are PaaS backing services you can create for your application, but not all the services we need are available yet. For example, we chose Papertail for the log management service. This was easy to integrate with Cloud Foundry.

Another was ElasticSearch, which we use to power the Trade Tariff’s search. In the end we procured this outside of the PaaS, but with time, as more backing services are added we should be able to migrate this to the PaaS too.

What PaaS means for our users

We want to thank the PaaS team for all their support and help migrating the Trade Tariff to the PaaS. They helped make the process simple and straightforward.

Everyone involved worked hard to make sure users wouldn’t notice the migration. There was almost no downtime during the switchover and we tested everything thoroughly to avoid any surprises.

The migration to the PaaS benefits users because we can iterate and innovate more regularly. We'll be rolling out a new design for the service which, among other things, will improve the experience of users on mobile devices. And there’s plenty more to come.

In my next post I'll outline the useful lessons we learned from the Trade Tariff migration.

The government PaaS is currently in private beta and hosting a limited number of services. If you’re interested in using government PaaS, email us.

Follow Matt Ford on Twitter and don't forget to sign up for email alerts.

GDS is expanding, and we have a number of positions that need to be filled - especially on the Government as a Platform team. So we’re always on the lookout for talented people. Have a look at our videos describing how we workour vacancies page, or drop us a line.

Leave a comment