artsy / bearden

A simple database of organizations
MIT License
3 stars 8 forks source link

Upgrade to latest Postgres #338

Closed jonallured closed 6 years ago

jonallured commented 6 years ago

I think it's time - version 10 has been out for a while and is now GA on Heroku since mid-December. I started with my laptop:

$ brew upgrade postgres

In the post-upgrade message, there's a command to run that will upgrade your data, I ran that without error. I expected to have to reinstall the pg gem, but rake was green without it.

Next step is upgrading at Heroku, which I'll document next but let's see what happens at Circle.

artsy-peril[bot] commented 6 years ago
Warnings
:warning: Please assign someone to merge this PR, and optionally include people who should review.

Generated by :no_entry_sign: dangerJS

jonallured commented 6 years ago

I just upgraded staging while CI passed, here's the procedure:

$ heroku addons:create heroku-postgresql:standard-0 -r staging
$ heroku pg:wait -r staging
$ heroku maintenance:on -r staging
$ heroku ps:scale export_worker=0 web=0 worker=0 -r staging
$ heroku pg:copy DATABASE PURPLE -r staging --confirm bearden-staging
$ heroku pg:promote PURPLE -r staging
$ heroku ps:scale export_worker=1 web=1 worker=1 -r staging
$ heroku maintenance:off -r staging
$ heroku addons:destroy PINK -r staging --confirm bearden-staging
$ heroku restart -r staging

I clicked around staging and didn't see anything goofy going on, so I'm going to merge this, deploy to production and then run those commands to upgrade things there.

jonallured commented 6 years ago

Ok, this is done on production and I'm not seeing any issues. One thing I forgot to check before running this on production was what happens to the database backups, but they are all still there, they just switch from the old to new db:

jon@magneto:~/code/bearden(master)% heroku pg:backups -r production
=== Backups
ID    Created at                 Status                               Size      Database
────  ─────────────────────────  ───────────────────────────────────  ────────  ────────
b282  2018-01-24 17:31:52 +0000  Completed 2018-01-24 17:32:18 +0000  122.54MB  DATABASE
a281  2018-01-24 11:03:03 +0000  Completed 2018-01-24 11:04:23 +0000  122.54MB  DATABASE
a280  2018-01-23 11:02:45 +0000  Completed 2018-01-23 11:04:31 +0000  122.53MB  DATABASE
a279  2018-01-22 11:04:15 +0000  Completed 2018-01-22 11:05:31 +0000  122.53MB  DATABASE
a278  2018-01-21 11:03:07 +0000  Completed 2018-01-21 11:04:33 +0000  122.53MB  DATABASE
a277  2018-01-20 11:02:47 +0000  Completed 2018-01-20 11:04:05 +0000  122.53MB  DATABASE
a276  2018-01-19 11:02:27 +0000  Completed 2018-01-19 11:03:35 +0000  122.53MB  DATABASE
a275  2018-01-18 11:02:22 +0000  Completed 2018-01-18 11:03:42 +0000  122.52MB  DATABASE
a274  2018-01-17 11:03:34 +0000  Completed 2018-01-17 11:04:58 +0000  122.52MB  DATABASE
a271  2018-01-14 11:02:50 +0000  Completed 2018-01-14 11:04:21 +0000  122.51MB  DATABASE
a263  2018-01-06 11:03:19 +0000  Completed 2018-01-06 11:04:50 +0000  122.50MB  DATABASE
b259  2018-01-02 16:07:05 +0000  Completed 2018-01-02 16:07:30 +0000  122.49MB  DATABASE
a255  2017-12-30 11:03:35 +0000  Completed 2017-12-30 11:04:55 +0000  122.48MB  DATABASE
b208  2017-11-13 16:29:41 +0000  Completed 2017-11-13 16:30:11 +0000  113.15MB  DATABASE
b190  2017-10-27 15:53:43 +0000  Completed 2017-10-27 15:54:05 +0000  108.39MB  DATABASE
b182  2017-10-20 15:14:34 +0000  Completed 2017-10-20 15:14:55 +0000  108.37MB  DATABASE
b177  2017-10-16 16:59:49 +0000  Completed 2017-10-16 17:00:10 +0000  108.36MB  DATABASE
b169  2017-10-09 15:20:47 +0000  Completed 2017-10-09 15:21:08 +0000  108.34MB  DATABASE
b161  2017-10-02 16:28:54 +0000  Completed 2017-10-02 16:29:16 +0000  108.33MB  DATABASE
b147  2017-09-19 19:23:55 +0000  Completed 2017-09-19 19:24:19 +0000  108.30MB  DATABASE
b133  2017-09-06 14:40:22 +0000  Completed 2017-09-06 14:40:44 +0000  108.27MB  DATABASE
b132  2017-09-06 14:35:32 +0000  Completed 2017-09-06 14:35:54 +0000  108.27MB  DATABASE
b125  2017-08-31 14:51:42 +0000  Completed 2017-08-31 14:52:04 +0000  108.25MB  DATABASE
b123  2017-08-30 14:58:54 +0000  Completed 2017-08-30 14:59:16 +0000  108.25MB  DATABASE
b101  2017-08-09 16:50:52 +0000  Completed 2017-08-09 16:51:13 +0000  108.20MB  DATABASE
b099  2017-08-08 19:54:08 +0000  Completed 2017-08-08 19:54:29 +0000  108.20MB  DATABASE
b098  2017-08-08 13:43:20 +0000  Completed 2017-08-08 13:43:43 +0000  108.20MB  DATABASE
b069  2017-07-11 21:08:49 +0000  Completed 2017-07-11 21:09:07 +0000  90.80MB   DATABASE
b068  2017-07-11 15:21:33 +0000  Completed 2017-07-11 15:21:54 +0000  90.80MB   DATABASE
b053  2017-06-27 13:15:27 +0000  Completed 2017-06-27 13:15:45 +0000  86.85MB   DATABASE
b052  2017-06-27 13:09:34 +0000  Completed 2017-06-27 13:09:52 +0000  86.85MB   DATABASE
b045  2017-06-21 13:09:39 +0000  Completed 2017-06-21 13:09:56 +0000  86.77MB   DATABASE
b024  2017-05-31 15:43:44 +0000  Completed 2017-05-31 15:44:01 +0000  83.37MB   DATABASE
b023  2017-05-22 13:35:46 +0000  Completed 2017-05-22 13:35:57 +0000  52.38MB   DATABASE
b022  2017-05-15 18:40:47 +0000  Completed 2017-05-15 18:41:40 +0000  51.80MB   DATABASE
b021  2017-05-15 18:11:22 +0000  Completed 2017-05-15 18:11:33 +0000  51.75MB   DATABASE

=== Restores
No restores found. Use heroku pg:backups:restore to restore a backup

=== Copies
ID    Started at                 Status                               Size      From      To
────  ─────────────────────────  ───────────────────────────────────  ────────  ────────  ─────
c283  2018-01-24 17:39:41 +0000  Completed 2018-01-24 17:41:27 +0000  122.54MB  DATABASE  GREEN
c015  2017-05-01 16:36:27 +0000  Completed 2017-05-01 16:36:32 +0000  11.56MB   DATABASE  TEAL

There was a failed build on the release branch, but it only failed because restarting the dynos failed. I'm going to rebuild it, but should be no problem.