How upgrade a very old Discourse site?

1. What’s the easiest way to get back up and running?
2. If I’ve had S3 backups, did that cover all the relevant data, including images, metadata, etc?

While I did find this article, it hasn’t been updated in 5 years:

So before I yak shave any longer today, I’d like to see if anybody can provide a few helpful tips. Maybe I can buy somebody a virtual beer, give some free advice on GitHub - shakacode/react_on_rails: Integration of React + Webpack + Rails using rails/webpacker to build Universal (Isomorphic) Apps (aka Server Rendering) or anything else?

Anybody have time pair with me on this and I’ll document the efforts?

Here’s what I know:

  1. My directory for discourse is /var/docker and not /var/discourse.
  2. I have a recent backup on S3.
  3. I tried [Change “templates/postgres.template.yml” TO “templates/postgres.9.5.template.yml”](http://Change “templates/postgres.template.yml” TO “templates/postgres.9.5.template.yml”)
  4. Then the database is not compatible:
2020-04-04 20:53:42.164 UTC [1601] FATAL:  database files are incompatible with server
2020-04-04 20:53:42.164 UTC [1601] DETAIL:  The data directory was initialized by PostgreSQL version 9.3, which is not compatible with this version 9.5.21.

Relevant Logs

Welcome to Ubuntu 16.04.3 LTS (GNU/Linux 4.4.0-148-generic x86_64)
  System load:  0.08               Processes:              137
  Usage of /:   69.3% of 29.40GB   Users logged in:        0
  Memory usage: 77%                IP address for eth0:    192.241.224.165
  Swap usage:   24%                IP address for docker0: 172.17.0.1
187 packages can be updated.
19 updates are security updates.

*** System restart required ***

root@forum:~# cd /var/docker/
root@forum:/var/docker# git pull

Updating 67f34b8..b0c92ba

I, [2020-04-04T20:34:13.023086 #1]  INFO -- : > apt-get update && apt-get install -y postgresql-9.3 postgresql-client-9.3 postgresql-contrib-9.3
E: Unable to locate package postgresql-client-9.3
E: Couldn't find any package by glob 'postgresql-client-9.3'
E: Couldn't find any package by regex 'postgresql-client-9.3'
E: Unable to locate package postgresql-contrib-9.3
E: Couldn't find any package by glob 'postgresql-contrib-9.3'
E: Couldn't find any package by regex 'postgresql-contrib-9.3'
I, [2020-04-04T20:34:17.590352 #1]  INFO -- : Hit:1 http://deb.debian.org/debian buster InRelease

FAILED
--------------------
Pups::ExecError: apt-get update && apt-get install -y postgresql-9.3 postgresql-client-9.3 postgresql-contrib-9.3 failed with return #<Process::Status: pid 18 exit 100>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params "apt-get update && apt-get install -y postgresql-9.3 postgresql-client-9.3 postgresql-contrib-9.3"
159a5389071c2e398c9f426ae0853f11f662503190b648f0390fdb14dd9a057e

WARNING! This will remove all stopped containers.
Are you sure you want to continue? [y/N] y
Deleted Containers:
5fd4cef4498a5ad12efb2f27373e3950e83b106d8ab7095177862511b10a0366

Total reclaimed space: 1.494GB
WARNING! This will remove all images without at least one container associated to them.
Are you sure you want to continue? [y/N] y
Deleted Images:
untagged: local_discourse/app:latest

Total reclaimed space: 9.848GB
root@forum:/var/docker# df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            477M     0  477M   0% /dev
tmpfs           100M   11M   89M  11% /run
/dev/vda1        30G  9.6G   19G  35% /
tmpfs           497M     0  497M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           497M     0  497M   0% /sys/fs/cgroup
cgmfs           100K     0  100K   0% /run/cgmanager/fs
tmpfs           100M     0  100M   0% /run/user/0

LOG:  skipping missing configuration file "/shared/postgres_data/postgresql.auto.conf"
2020-04-04 20:53:42.164 UTC [1601] FATAL:  database files are incompatible with server
2020-04-04 20:53:42.164 UTC [1601] DETAIL:  The data directory was initialized by PostgreSQL version 9.3, which is not compatible with this version 9.5.21

FAILED
--------------------
Pups::ExecError: su postgres -c 'psql discourse -c "alter schema public owner to discourse;"' failed with return #<Process::Status: pid 1627 exit 2>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params "su postgres -c 'psql $db_name -c \"alter schema public owner to $db_user;\"'"
e5ea7eeecd58ef02a19254a299700fe2146b447c6eda637a4fe64df373348953
3 Likes

Hi Justin! Great to see you again. As a courtesy since you’ve been using Discourse a looooong time, I’d be happy to pay @pfaffman to help you here. :hugs:

Just let him know to contact me for payment.

6 Likes

Hey, @justin_gordon. Is the site up now? If not, can you give me the S3 info?

You can get it to me reasonably securely at Discourse Support — Literate Computing, LLC

I trust this isn’t an emergency and getting started Monday is ok? If it is urgent, say so in your message and I’ll try to get started sooner.

You can also send me a pm here with your email address.

5 Likes

OMG @codinghorror, you made my day!

@pfaffman, yes, no urgency. I was upgrading to help a request for “how did you make your header so pretty on talksurf.com

Once we’re back up with talksurf.com, I’ll be sure to put in a few notes here that will be helpful for others.

7 Likes

Justin, I’m feeling guilty now :slightly_frowning_face:
3 days into using Discourse and I’m already causing mayhem!

4 Likes

Hi @Paul-Reed and @codinghorror,

@pfaffman got me back up and running…did an amazing job! The site is all shiny and new, and Discourse is amazing since everything needed was in the backups!

What an amazing bit of tech from Discourse!

@pfaffman updated me with the following:

  1. A 2-container install described here.
  2. Restoring from the backup on a fresh install seemed to be the path of least resistance for a very old installation.
  3. There’s really only one file that is useful outside of the backups, which is the /var/discourse/containers/app.yml file. And I should have daily backups, not every 7 days!

A key lesson that I knew and should have remembered:

Just because you think something will take 10 min, it sometimes doesn’t. I got into this update just because I wanted to make sure that I gave @Paul-Reed some good advice on the header. Ooops! And I didn’t just learn this, but we often forget. My specialty is making sites using React and Ruby on Rails work better via my consultancy https://www.shakacode.com and my open source GitHub - shakacode/react_on_rails: Integration of React + Webpack + Rails using rails/webpacker to build Universal (Isomorphic) Apps (aka Server Rendering).

Docker type dev ops is something I can do, but it takes a lot of time away from what I’m trying to accomplish!

So because of all that, I’m thinking about having @pfaffman help me with some update to my home page for https://forum.shakacode.com/.

So a HUGE thanks to @codinghorror and @pfaffman for all the help!


And if you’re interested, here’s the fix for the custom header that instigated this update of my old discourse site.

Custom Header

First of all, rather than yak shaving this, I’d recommend contacting @pfaffman at https://support.literatecomputing.com/. In fact, I’ll have @pfaffman help me if I want to create anything nicer in this area!

But, for you DIY’ers, I think all the useful parts are here:

AFAIK, everything else is blank.

CSS

#top-navbar-container {
    background: black;
    height: 25px;
}

#top-navbar-links .spacer {
    display: inline-block;
    margin-left: 12px;
    margin-right: 12px;
}


#top-navbar-links, #top-navbar-links a:visited, #top-navbar-links a {
    color: white;
}

header.d-header {
    background: black;
    background-image: url(/uploads/default/63/873a733a013f8208.jpg);
    padding-top: 0;
    box-shadow: none;
    top: 25px;
    height: 63px;
}

.ember-view > #main-outlet {
    padding-top: 97px;
}

header > .container {
    background-image: url(/uploads/default/63/873a733a013f8208.jpg);
    max-width: 1200px;
    padding-right: 50px;
}

header.d-header > .container > .contents {
    margin: 0;
}

header.d-header #site-logo, header.d-header .logo-small {
    max-height: 53px;
}

body #main .extra-info > a.star {
    color: #A5ACDD;
}

header .extra-info-wrapper h1 {
    margin-top: 18px;    
}

@media screen and (min-width: 1140px)  {
    header .extra-info-wrapper {
        max-width: 780px;
    }
}

@media screen and (min-width: 967px) and (max-width: 1139px)  {
    header .extra-info-wrapper {
        max-width: 647px;
    }
}

#user-notifications, #search-button, #site-map  {
    color: #AAA; 
}

@media screen and (max-width: 966px) {
    .extra-info-wrapper {
        max-width: 620px;
    }
}

header .current-username .username > a {
    color: white;
}

header.d-header .icons .icon:hover {
    background-color: #000000;
}

HEADER

<div id="top-navbar-container" class="d-header">
<div id="top-navbar" class="wrap">
<span id="top-navbar-links" style="height:20px;">
  <a href="http://forum.talksurf.com">Home</a><span class="spacer"> | </span>
  <a href="http://forum.talksurf.com/category/surfing/doug-silva">Doug Silva</a><span class="spacer"> | </span>
  <a href="http://forum.talksurf.com/category/surfing">Surfing</a><span class="spacer"> | </span>
  <a href="http://forum.talksurf.com/category/kitesurfing">Kitesurfing</a><span class="spacer"> | </span>
  <a href="http://forum.talksurf.com/category/standup-paddling">SUP</a><span class="spacer"> | </span>
  <a href="http://forum.talksurf.com/category/windsurfing">Windsurfing</a><span class="spacer"> | </span>
  <a href="http://forum.talksurf.com/t/pros-instructors-equipment-travel/264">Pros</a><span class="spacer"> | </span>
  <a href="http://forum.talksurf.com/t/what-is-talksurf-com/265">About</a><span class="spacer"> | </span>
  <a href="http://forum.talksurf.com/faq">FAQ</a>
</span>
</div>
</div>
5 Likes

Yes, I’d seen that here, but I don’t know where the talksurf image is included in the code.

I can see where the background image originates, but not the ‘talksurf’ image on the left, which is floating above the background image.

Adding ‘talksurf’ as a image in Settings>Branding>logo results in a much smaller image as Discourse shrinks it from 120px original height to just 31px. Talksurf is a lot more than 31px high.

@Paul-Reed Maybe see if you can hire @pfaffman to help? I never set this up, so I have no idea.

1 Like

You can make the header taller with a bit of CSS. I can help you with that but I’d suggest you to create a new #support topic since it’s a bit off-topic here.

I have an existing topic which I started a few days ago - Image not filling header container
Is it ok to continue there?

1 Like