March 11, 2021

Updates

One feature of running your own server is that you are responsible for keeping it up to date. This isn't a particularly onerous task but it does need to be done periodically.

First you should ensure that the operating system and various Raspbian installed packages are updated using apt update and apt upgrade.

server@example:~ $ sudo apt update
Get:1 http://archive.raspberrypi.org/debian buster InRelease [32.8 kB]       
Get:2 http://raspbian.raspberrypi.org/raspbian buster InRelease [15.0 kB]      
Get:3 http://archive.raspberrypi.org/debian buster/main armhf Packages [364 kB]
Get:4 https://deb.nodesource.com/node_12.x buster InRelease [4,584 B]
Get:5 http://raspbian.raspberrypi.org/raspbian buster/main armhf Packages [13.0 MB]
Get:6 https://deb.nodesource.com/node_12.x buster/main armhf Packages [774 B]  
Fetched 13.4 MB in 33s (405 kB/s)                                              
Reading package lists... Done
Building dependency tree       
Reading state information... Done
24 packages can be upgraded. Run 'apt list --upgradable' to see them.
server@example:~ $ sudo apt upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  bind9-host dnsutils libbind9-161 libdns-export1104 libdns1104 libirs161
  libisc-export1100 libisc1100 libisccc161 libisccfg163 libldap-2.4-2
  libldap-common liblwres161 libraspberrypi-bin libraspberrypi-dev
  libraspberrypi-doc libraspberrypi0 libssl1.1 libzstd1 nodejs openssl
  raspberrypi-bootloader raspberrypi-kernel rpi-eeprom
24 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 140 MB of archives.
After this operation, 2,305 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
    .
    .
    .
Processing triggers for libc-bin (2.28-10+rpi1) ...
Processing triggers for man-db (2.8.5-2) ...
server@example:~ $

Then you should make sure that ghost is up to date. First update the ghost-cli package with npm install -g ghost-cli@latest

server@example:~ $ sudo npm install -g ghost-cli@latest
/usr/bin/ghost -> /usr/lib/node_modules/ghost-cli/bin/ghost
+ [email protected]
added 11 packages from 5 contributors, removed 26 packages and updated 29 packages in 91.719s

You may well also be informed that npm itself needs updating. In which case do as you are told and npm install -g npm

server@example:~ $ sudo npm install -g npm
/usr/bin/npm -> /usr/lib/node_modules/npm/bin/npm-cli.js
/usr/bin/npx -> /usr/lib/node_modules/npm/bin/npx-cli.js
+ [email protected]
added 59 packages from 24 contributors, removed 241 packages and updated 194 packages in 31.973s

Next cd into the blog directory and do ghost update. If you are running on a Pi 3 this will take some time. If you are running on a Pi 3 and you have other things also on it (like the chat server) then stop them first (sudo snap stop rocketchat-server) because you are very likely to run out of resources if you don't and it isn't pretty when that happens*

server@example:~ $ cd blog
server@example:~/blog $ ghost update
✔ Checking system Node.js version
ℹ Ensuring user is not logged in as ghost user [skipped]
ℹ Checking if logged in user is directory owner [skipped]
✔ Checking current folder permissions
✔ Checking memory availability
✔ Checking free space
✔ Checking for available migrations
✔ Checking for latest Ghost version

No user-visible changes in this release.

---

View the changelogs for full details:
* Ghost - https://github.com/tryghost/ghost/compare/3.41.9...3.42.0
* Ghost-Admin - https://github.com/tryghost/admin/compare/3.41.9...3.42.0

✔ Fetched release notes
✔ Downloading and updating Ghost to v3.42.0
✔ Stopping Ghost
✔ Linking latest Ghost and recording versions
✔ Restarting Ghost
ℹ Removing old Ghost versions [skipped]
server@example:~/blog $ 

That's it unless you have added comments. If you did add comments and are using the default caspar theme you'll probably find that they have disappeared during the update. You can get them back by running edittheme.pl again. Be sure to use your comment hostname and not the example one (commento-example.devtru.st) in the text below.

server@example:~/blog $ edittheme.pl content/themes/casper/post.hbs commento-example.devtru.st 
Differences between new and old:
117c117
<             
---
>             {{!--
119,120c119
<                 <script defer src="https://commento-example.devtru.st/js/commento.js"></script>
<                 <div id="commento"></div>
---
>                 If you want to embed comments, this is a good place to do it!
121a121
>             --}}
server@example:~/blog $

You may also want to update commento++ itself. Currently I'm building commento++ manually from source and making the result available because there's no readily available ARM binary for it but I hope to change that. When I update the commento package on this website I'll update this page with instructions on how to update it on your micronetia instance. In the last week or so there have been two minor bug fixes, one of which was raised by me so it looks like updates will occur fairly often.

Finally once you've updated everything it is probably a good idea to reboot the pi and make sure that it all comes up again.

*The alert reader may have noticed this blog was offline for some of March 10. Running out of resources while doing the update was why.