News for hackers. Stuff that matters.
Re:Bye Bye Mongo, Hello Postgres by jack6e on Wednesday December 19, 2018 @02:15PM (#18718447)
Specific technology choices aside, this was an incredible write-up of their migration process: thorough, organized, readable prose about a technical topic. It is helpful to read how other teams handle these types of processes in real production systems. Perhaps most refreshing is the description of choices made for the various infrastructure pieces, because it is reasonable and real-world. Blog posts so often describe building a system from scratch where all latest-and-greatest software can be used at each layer. However, here is a more realistic mix of, on the one hand, swapping out DBs for an entirely new (and better) one, but on the other hand finding new tools within their existing primary language to extend the API and proxy.

Great read. Well done.

Re:Bye Bye Mongo, Hello Postgres by chronotis on Wednesday December 19, 2018 @02:33PM (#18718654)
This was what was particularly interesting to me - that they went to the effort of writing a purely technical article on the particulars of how parts of their environment operate, and to publish it on their platform even when that's not the sort of content they're known for.
Re:Bye Bye Mongo, Hello Postgres by viraptor on Wednesday December 19, 2018 @03:21PM (#18719175)
It's not their main platform though:

> Digital Blog

> A blog by the Guardian's internal Digital team. We build the Guardian website, mobile apps, Editorial tools, revenue products, support our infrastructure and manage all things tech around the Guardian

Re:Bye Bye Mongo, Hello Postgres by wftglf on Wednesday December 19, 2018 @06:34PM (#18721032)
Hi! Thanks for your comments. I'm one of the authors of this post. It is the same platform at the moment (just not tagged with editorial tags so it stays away from the fronts), though sometimes the team that approves non-editorial posts to the site can be concerned about us writing about outages and things as it might carry a 'reputational risk', so we may end up migrating to a different platform in the future so we can publish more quickly, we'll see!
Re:Bye Bye Mongo, Hello Postgres by reilly3000 on Thursday December 20, 2018 @01:14AM (#18722854)
In our era of deplatforming a publisher publishing on something like Medium seems antithetical, even for a dev team that just wants to get words out. Should you spend some cycles on the dev blog? Probably, but you should also split test the donation copy and get the data warehouse moved forward for 2019 initiatives and fix 1200 other issues. Thanks for sharing a great post. I shared it with my team and we all learned a lot.
Re:Bye Bye Mongo, Hello Postgres by wftglf on Thursday December 20, 2018 @05:27AM (#18723788)
Thanks to hacker news and reddit this piece got over 100,000 page views which should be enough to justify the blog staying on platform!
Re:Bye Bye Mongo, Hello Postgres by AlexCoventry on Wednesday December 19, 2018 @07:39PM (#18721477)
Does SecureDrop run on your AWS infrastructure?
Re:Bye Bye Mongo, Hello Postgres by wftglf on Thursday December 20, 2018 @05:59AM (#18723897)
No, I think it's on our own infrastructure.
Re:Bye Bye Mongo, Hello Postgres by AlexCoventry on Thursday December 20, 2018 @08:40AM (#18724755)
Thanks for the info, here and below.
Re:Bye Bye Mongo, Hello Postgres by dmix on Wednesday December 19, 2018 @07:43PM (#18721491)
It’s probably better if they didn’t answer this question...
Re:Bye Bye Mongo, Hello Postgres by AlexCoventry on Wednesday December 19, 2018 @08:55PM (#18721899)
It's a bit disturbing to me that they seem to be using AWS for confidential editorial work.

> Due to editorial requirements, we needed to run the database cluster and OpsManager on our own infrastructure in AWS rather than using Mongo’s managed database offering.

Re:Bye Bye Mongo, Hello Postgres by wftglf on Thursday December 20, 2018 @05:31AM (#18723801)
In a happy world the guardian wouldn't rely on a company we spend a lot of time reporting on for unethical practices (tax avoidance, worker exploitation etc.) - but we decided it was the only way to compete. One of the big drivers was a denial of service attack on our datacentre in 2014 on boxing day - not an experience any of us want to have to deal with again.
Re:Bye Bye Mongo, Hello Postgres by nexuist on Wednesday December 19, 2018 @09:12PM (#18721968)
>Since all our other services are running in AWS, the obvious choice was DynamoDB – Amazon’s NoSQL database offering. Unfortunately at the time Dynamo didn’t support encryption at rest. After waiting around nine months for this feature to be added, we ended up giving up and looking for something else, ultimately choosing to use Postgres on AWS RDS.
Re:Bye Bye Mongo, Hello Postgres by AlexCoventry on Wednesday December 19, 2018 @10:03PM (#18722176)
Anyone who gets control of the live server can still read a database, even if it encrypts its storage.
Re:Bye Bye Mongo, Hello Postgres by hbbio on Thursday December 20, 2018 @01:12AM (#18722848)
Exactly. As I read the original article, which mentions "encryption-at-rest", there was a voice in my head crying: "No, what they need is E2EE". That would enable the authors to write confidential drafts of the articles, no matter where the data is stored (and AWS would be perfectly fine of course).

Disclaimer: The voice is my head does not come out of nowhere. I am building a product which addresses this: https://github.com/wallix/datapeps-sdk-js is a API/SDK solution for E2EE. Sample app integration is available at: https://github.com/wallix/notes (you can switch between master and datapeps branches to see the changes of the E2EE integration)

Re:Bye Bye Mongo, Hello Postgres by manigandham on Thursday December 20, 2018 @02:26AM (#18723088)
In which case they could've just used a separate encryption layer with any database, including DynamoDB. The HSM security keys available from all the clouds makes this rather simple.
Re:Bye Bye Mongo, Hello Postgres by hbbio on Thursday December 20, 2018 @02:54AM (#18723197)
Yes, any db including Dynamo would have been fine.

Our software E2EE solution has advantages over HSM though: Cost obviously, and more features and extensibility.

Re:Bye Bye Mongo, Hello Postgres by AlexCoventry on Thursday December 20, 2018 @01:22AM (#18722887)
Great idea.
Re:Bye Bye Mongo, Hello Postgres by grogenaut on Wednesday December 19, 2018 @11:05PM (#18722418)
Encryption at rest is still important as it closes off a few attack/loss vectors: mis-disposed hard drives, re-allocated hosts. I'm probably missing a few others.
Re:Bye Bye Mongo, Hello Postgres by AlexCoventry on Wednesday December 19, 2018 @11:21PM (#18722484)
Yeah, but it doesn't really address my concern.
Re:Bye Bye Mongo, Hello Postgres by nixgeek on Thursday December 20, 2018 @12:04AM (#18722633)
Anyone who can control a server in any environment can potentially interact with the database powering applications running on that server.

How is running on AWS different than Guardian Cloud in their basement?

Re:Bye Bye Mongo, Hello Postgres by AlexCoventry on Thursday December 20, 2018 @12:07AM (#18722643)
The level of control over who has physical access, of course.

Did reports of the Snowden revelations reside on the CMS?

Re:Bye Bye Mongo, Hello Postgres by wftglf on Thursday December 20, 2018 @05:24AM (#18723775)
Sadly we don't trust our security practices anywhere enough for that! Secret investigations happen in an air gapped room on computers with their network cards removed then get moved across to the main CMS when they're ready to publish.
Re:Bye Bye Mongo, Hello Postgres by untog on Thursday December 20, 2018 @12:26AM (#18722711)
Probably not, no, until they were about to be published. I imagine that the choice between "run an entire data centre ourselves, store everything there" and "use AWS, but keep high sensitivity stories on local machines" is an easy one.

After all, the client computer that connects to the CMS is just as, or more likely to be compromised. I wouldn't be surprised if the coverage (or at least parts of it) were edited on airgapped laptops.

Re:Bye Bye Mongo, Hello Postgres by AlexCoventry on Thursday December 20, 2018 @01:02AM (#18722812)
> the choice between "run an entire data centre ourselves, store everything there"

If those were the only two choices, you might be right. But the resources needed for the actual CMS functionality sound modest enough to run independently of the main website.

> the client computer that connects to the CMS is just as, or more likely to be compromised

That's faulty reasoning.

Re:Bye Bye Mongo, Hello Postgres by untog on Thursday December 20, 2018 @05:44AM (#18723838)
> That's faulty reasoning.

Why? It's an obvious potential point of compromise.

Re:Bye Bye Mongo, Hello Postgres by AlexCoventry on Thursday December 20, 2018 @08:41AM (#18724767)
Sorry, I misunderstood. I read it as saying "We're going to get hacked via this other vector, anyway, so why bother?" I see your point, now.
Re:Bye Bye Mongo, Hello Postgres by philjohn on Thursday December 20, 2018 @04:40AM (#18723574)
They're using AWS VPC (Virtual Private Cloud) which isn't open to the world (you use a VPN to bridge the VPC into your internal network) and which you can spin up dedicated instances that don't share underlying hardware with other AWS customers.
Re:Bye Bye Mongo, Hello Postgres by pfriend on Friday December 21, 2018 @11:20AM (#18734270)
Thanks for writing the blog post. Insights like these and of such high quality are rare.

Can I ask what was the total cost of the migration?

If there was software that could do this database migration without downtime, how much would you/Guardian be willing to pay?

Re:Bye Bye Mongo, Hello Postgres by jwdunne on Wednesday December 19, 2018 @06:16PM (#18720882)
This is pretty much how all Guardian articles are formatted. Some of their regular pieces could be called "blog posts" - Felicity Cloake's cooking series comes to mind.

Guess it makes sense to reuse the platform that already has the templates than use another platform and reimplement the design.

Re:Bye Bye Mongo, Hello Postgres by vanderZwan on Wednesday December 19, 2018 @05:08PM (#18720233)
Given their employers, one would hope that they get good editorial support though!
Re:Bye Bye Mongo, Hello Postgres by pdpi on Wednesday December 19, 2018 @04:10PM (#18719670)
Ish. From what I can tell, the “Digital Blog” seems to be set up as just another column on the platform.
Re:Bye Bye Mongo, Hello Postgres by revel on Wednesday December 19, 2018 @04:33PM (#18719898)
Totally agreed. This is pretty much the definitive guide on how to perform a high stakes migration where downtime is absolutely unacceptable. It's extremely tempting, particularly for startups, to simply have a big-bang migration where an old system gets replaced by something else in one shot. I have never, ever seen that approach work out well. The Guardian approach is certainly conservative but it's hard to read that article and conclude anything other than that they did the right thing at every step along the way.

Well done and congratulations to everyone on the team.

Re:Bye Bye Mongo, Hello Postgres by konschubert on Wednesday December 19, 2018 @07:11PM (#18721295)
I agree, but it looked them a year if I am reading the article right.

In most early stage startups, that would be an unacceptable loss of time.

So I don't judge them for doing a one-shot migration even if it causes an hour of downtime.

It all depends on the business.

Re:Bye Bye Mongo, Hello Postgres by wftglf on Wednesday December 19, 2018 @07:22PM (#18721362)
Yeah it did take a long time! Part of this though was due to people moving on/off the project a fair bit as other more pressing business needs took priority. We sort of justified the cost due to the expected cost savings from not paying for OpsManager/Mongo support (as in the RDS world support became 'free' as we were already paying for AWS support) - which took the pressure off a bit.

Another team at the guardian did a similar migration but went for a 'bit by bit' approach - so migrating a few bits of the API at a time - which worked out faster, in part because stuff was tested in production more quickly, rather than our approach with the proxy which, whilst imitating production traffic, didn't actually serve Postgres data to the users until 'the big switch' - so not really a continuous delivery migration!

Re:Bye Bye Mongo, Hello Postgres by eecc on Thursday December 20, 2018 @12:48PM (#18727154)
The article mentions several corner cases that weren’t well covered by testing and caused issues later. What sort of test tooling did you use, Scalacheck?
Re:Bye Bye Mongo, Hello Postgres by hideo on Wednesday December 19, 2018 @03:18PM (#18719149)
Agreed! I don't think enough engineering orgs appreciate the value of a great narrative on any technical topic.

Part of my duties at work require me to deal with "large" issues. While a solution to them is usually necessary and quick and high quality, I've seen the analyses that come after them vary in quality.

Good writeups tend to stick around in people's memories and become company culture, and drive everyone to do better. Bad writeups are forgotten, and thus the lessons learned from them are forgotten as well.

This particular article stands out for me. English is not my first language, and I've spent most of my life dealing with very fundamental technical details, so most of my writeups aren't the best. I'm going to bookmark this one and come back to it to learn how to write accessible technical narratives.

Re:Bye Bye Mongo, Hello Postgres by harel on Wednesday December 19, 2018 @02:21PM (#18718518)
Writing is their Core business after all :) I agree though, I read it like a fascinating breaking news story
Re:Bye Bye Mongo, Hello Postgres by jdietrich on Wednesday December 19, 2018 @03:44PM (#18719403)
The BBC's Online and R&D departments have very interesting blogs, if you like this sort of thing.

http://www.bbc.co.uk/blogs/internet

https://www.bbc.co.uk/rd

Re:Bye Bye Mongo, Hello Postgres by DRW_ on Wednesday December 19, 2018 @03:57PM (#18719524)
Re:Bye Bye Mongo, Hello Postgres by deadbunny on Thursday December 20, 2018 @07:50AM (#18724449)
Has world class platform for delivering articles. Uses Medium.

I don't even.

Re:Bye Bye Mongo, Hello Postgres by brown9-2 on Wednesday December 19, 2018 @06:04PM (#18720780)
I imagine this is a nice benefit of working at an organization that is primarily about writing.
Re:Bye Bye Mongo, Hello Postgres by ranman on Thursday December 20, 2018 @05:57AM (#18723890)
I was actually a little confused by the article - it seems to go up and down in terms of technical depth. It feels like it was written by several people. The hyperlink to “a screen session” was odd as well ... ammonite hyperlink I get but... screen is a pretty ancient tool... people either know it or can find out about it. Like you link to screen but not “ELK” stack?

I like the article but it was a bit hard for me to consume with multiple voices in different parts.

Re:Bye Bye Mongo, Hello Postgres by thanatropism on Thursday December 20, 2018 @06:15AM (#18723962)
screen is hard to google.
Re:Bye Bye Mongo, Hello Postgres by luord on Wednesday December 19, 2018 @07:10PM (#18721286)
This is the first thing I noticed too. This was an excellent read.
Re:Bye Bye Mongo, Hello Postgres by InGodsName on Wednesday December 19, 2018 @02:44PM (#18718783)
Old versions of mongo were very bad.

We accured lots of downtime due to mongo.

But later versions were rock solid and I've matainer mongo installations at many startup and SMEs once you setup alertd for disk/memory usage, off you go. Works like charm 99% of the times.

Re:Bye Bye Mongo, Hello Postgres by kbenson on Wednesday December 19, 2018 @02:50PM (#18718861)
MogoDB is proof that with the right strategy, marketing and luck, you really can fake it until you make it.

Not that that's really a surprise or was unknown, it's just fairly new to see in the open source ecosystem instead of the enterprise one.

Re:Bye Bye Mongo, Hello Postgres by badloginagain on Wednesday December 19, 2018 @03:22PM (#18719184)
I'd posit its more a matter of maturing a new paradigm. There's a lot more edge cases you have to cover as NoSQL became more popular for production-at-scale.

SQL has decades of production maturation, and has wider domain knowledge.

Re:Bye Bye Mongo, Hello Postgres by kbenson on Wednesday December 19, 2018 @04:03PM (#18719587)
I'm sure there's some of that. But a lot of the early problems were a bit more weighted towards poor engineering in general, IIRC. For example, I seem to recall an early problem was truncating large amounts of data on crash occasionally.
Re:Bye Bye Mongo, Hello Postgres by bigiain on Wednesday December 19, 2018 @06:26PM (#18720968)
That's probably true.

Unfortunately the number of my customers who would sign off on just "two nines" is approximately zero...