add postgres post

This commit is contained in:
Ben Harris 2020-10-28 16:38:25 -04:00
parent a607f35b16
commit 619f5704e0
11 changed files with 258 additions and 33 deletions

View File

@ -25,6 +25,10 @@
</div></div></div>
<div id="divbody"><div class="content">
<h3>all posts</h3>
<h4 class='allposts_header'>October 2020</h4>
<ul>
<li><a href="./mastodon-postgres-upgrade-fun.html">mastodon postgres upgrade fun</a> &mdash; October 28, 2020</li>
</ul>
<h4 class='allposts_header'>June 2020</h4>
<ul>
<li><a href="./default-branch-name.html">default branch name</a> &mdash; June 16, 2020</li>

View File

@ -64,10 +64,10 @@
<li><a href="tag_post-mortem.html">post-mortem</a> &mdash; 1 post</li>
<li><a href="tag_save-for-later.html">save-for-later</a> &mdash; 1 post</li>
<li><a href="tag_snow.html">snow</a> &mdash; 1 post</li>
<li><a href="tag_social-networks.html">social-networks</a> &mdash; 1 post</li>
<li><a href="tag_social-networks.html">social-networks</a> &mdash; 2 posts</li>
<li><a href="tag_ssh.html">ssh</a> &mdash; 1 post</li>
<li><a href="tag_sysadmin.html">sysadmin</a> &mdash; 10 posts</li>
<li><a href="tag_tilde.html">tilde</a> &mdash; 10 posts</li>
<li><a href="tag_sysadmin.html">sysadmin</a> &mdash; 11 posts</li>
<li><a href="tag_tilde.html">tilde</a> &mdash; 11 posts</li>
<li><a href="tag_travel.html">travel</a> &mdash; 1 post</li>
<li><a href="tag_ubuntu.html">ubuntu</a> &mdash; 2 posts</li>
<li><a href="tag_update.html">update</a> &mdash; 2 posts</li>

View File

@ -2,9 +2,25 @@
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel><title>blog // ~ben</title><link>https://tilde.team/~ben/blog/index.html</link>
<description>a blog about tildes and other things</description><language>en</language>
<lastBuildDate>Tue, 16 Jun 2020 15:26:33 -0400</lastBuildDate>
<pubDate>Tue, 16 Jun 2020 15:26:33 -0400</pubDate>
<atom:link href="https://tilde.team/~ben/blog/feed.rss" rel="self" type="application/rss+xml" />
<lastBuildDate>Wed, 28 Oct 2020 16:33:00 -0400</lastBuildDate>
<pubDate>Wed, 28 Oct 2020 16:33:00 -0400</pubDate>
<atom:link href="https://tilde.team/~ben/blog/feed.rss" rel="self" type="application/rss+xml">
<item><title>
mastodon postgres upgrade fun
</title><description><![CDATA[
<p>howdy friends!</p>
<p>if you&rsquo;re a mastodon user on <a href="https://tilde.zone">tilde.zone</a> (the tildeverse
mastodon instance), you might&rsquo;ve noticed some downtime recently.</p>
<p>here&rsquo;s a quick recap of what went down during the upgrade process.</p>
<hr />
]]></description><link>https://tilde.team/~ben/blog/mastodon-postgres-upgrade-fun.html</link>
<guid>https://tilde.team/~ben/blog/./mastodon-postgres-upgrade-fun.html</guid>
<dc:creator>~ben</dc:creator>
<pubDate>Wed, 28 Oct 2020 16:31:39 -0400</pubDate></item>
<item><title>
default branch name
</title><description><![CDATA[

8
blog/index.gmi Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env sh
printf "20 text/gemini\r\n"
printf "my bashblog posts\r\n"
user=$(stat -c '%U' $0)
for post in $(ls -t /home/$user/public_gemini/blog/*.md); do
post=$(basename $post)
printf "=> /~$user/blog/$post $post\r\n"
done

View File

@ -24,6 +24,23 @@
<div id="description">a blog about tildes and other things</div>
</div></div></div>
<div id="divbody"><div class="content">
<h3><a class="ablack" href="mastodon-postgres-upgrade-fun.html">
mastodon postgres upgrade fun
</a></h3>
<!-- bashblog_timestamp: #202010281631.39# -->
<div class="subtitle">October 28, 2020 &mdash;
~ben
</div>
<!-- text begin -->
<p>howdy friends!</p>
<p>if you&rsquo;re a mastodon user on <a href="https://tilde.zone">tilde.zone</a> (the tildeverse
mastodon instance), you might&rsquo;ve noticed some downtime recently.</p>
<p>here&rsquo;s a quick recap of what went down during the upgrade process.</p>
<p class="readmore"><a href="./mastodon-postgres-upgrade-fun.html">read more...</a></p>
<h3><a class="ablack" href="default-branch-name.html">
default branch name
</a></h3>
@ -202,32 +219,6 @@ italy
<p><img src="https://bhh.sh/pub/photos/italy/roman-forum.jpg" alt="" title="" /></p>
<p class="readmore"><a href="./italy.html">read more...</a></p>
<h3><a class="ablack" href="utterances.html">
utterances
</a></h3>
<!-- bashblog_timestamp: #201809052134.13# -->
<div class="subtitle">September 05, 2018 &mdash;
~ben
</div>
<!-- text begin -->
<p>i somehow stumbled upon <a href="https://utteranc.es">utterances</a> today at lunch. (i think someone had it forked on their github page).</p>
<p>no matter how i found it, i still decided to add it to my blog here with <a href="https://tildegit.org/team/bashblog">bashblog</a>. utterances is a commenting system that leverages github issues. so, for example a comment on <a href="https://tilde.team/~ben/blog/upsides-of-new-dns-nameservers.html">a post</a> shows up on github <a href="https://github.com/benharri/tilde/issues/1#issuecomment-418732788">like this</a>.</p>
<p>now we just need to figure out if it can be pointed at a gitea instance like <a href="https://tildegit.org">tildegit</a>. might be time for a PR!</p>
<p>tags: <a href='tag_blog.html'>blog</a></p>
<!-- text end -->
<div id="all_posts"><a href="all_posts.html">archive</a> &mdash; <a href="all_tags.html">all tags</a> &mdash; <a href="feed.rss">rss</a></div>
</div>
<div id="footer">CC by-nc-nd <a href="https://tilde.team/~ben/">~ben</a> &mdash; <a href="mailto:ben&#64;tilde&#46;team">ben&#64;tilde&#46;team</a><br/>

View File

@ -0,0 +1,106 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="theme-color" content="#00cc00">
<link rel="icon" type="image/png" sizes="192x192" href="https://tilde.team/apple-touch-icon-precomposed.png">
<link rel="icon" type="image/png" sizes="96x96" href="https://tilde.team/favicon-96x96.png">
<link rel="stylesheet" href="https://tilde.team/~ben/gruvbox/gruvbox.css">
<link rel="stylesheet" href="extra.css">
<link rel="alternate" type="application/rss+xml" title="subscribe to this page..." href="feed.rss" />
<title>mastodon postgres upgrade fun</title>
</head><body>
<main>
<div id="divbodyholder">
<div class="headerholder"><div class="header">
<div id="title">
<h1 class="nomargin"><a class="ablack" href="https://tilde.team/~ben/blog/index.html">blog // ~ben</a></h1>
<div id="description">a blog about tildes and other things</div>
</div></div></div>
<div id="divbody"><div class="content">
<!-- entry begin -->
<h3><a class="ablack" href="mastodon-postgres-upgrade-fun.html">
mastodon postgres upgrade fun
</a></h3>
<!-- bashblog_timestamp: #202010281631.39# -->
<div class="subtitle">October 28, 2020 &mdash;
~ben
</div>
<!-- text begin -->
<p>howdy friends!</p>
<p>if you&rsquo;re a mastodon user on <a href="https://tilde.zone">tilde.zone</a> (the tildeverse
mastodon instance), you might&rsquo;ve noticed some downtime recently.</p>
<p>here&rsquo;s a quick recap of what went down during the upgrade process.</p>
<hr />
<p>we run the current stable version of postgresql from the <a href="https://wiki.postgresql.org/wiki/Apt">postgres
apt repos</a>. postgres <a href="https://www.postgresql.org/docs/release/13.0/">13</a> was released recently
and the apt upgrades automatically created a new cluster running 13.</p>
<p>the database for mastodon has gotten quite large (about 16gb) which
complicates this upgrade a bit. this was my inital plan:</p>
<ul>
<li>drop the 13 cluster created by the apt package upgrades</li>
<li>upgrade the 12-main cluster to 13</li>
<li>drop the 12 cluster</li>
</ul>
<p>these steps appeared to work fine, but closer inspection afterwards
led me to discover that the new cluster had ended up with <code>SQL_ASCII</code>
encoding somehow. this is not a situation we want to be in. time to fix it.</p>
<p>here&rsquo;s the new plan:</p>
<ul>
<li>stop mastodon
for i in streaming sidekiq web; do systemctl stop mastodon-$i; done</li>
<li>dump current database state
pg_dump mastodon_production > db.dump</li>
<li>drop and recreate cluster with utf8 encoding
pg_dropcluster 13 main &ndash;stop
pg_createcluster &ndash;locale=en_US.UTF8 13 main &ndash;start</li>
<li>restore backup
sudo -u postgres psql -c &ldquo;create user mastodon createdb;&rdquo;
sudo -u mastodon createdb -E utf8 mastodon_production
sudo -u mastodon psql &lt; db.dump</li>
</ul>
<p>i&rsquo;m still not 100% sure how the encoding reverted to ascii but
it seems that the locale was not correctly set while running the
apt upgrades&hellip;</p>
<p>if this happens to you, hopefully this helps you wade out while
keeping all your data :)</p>
<p>tags: <a href='tag_sysadmin.html'>sysadmin</a>, <a href='tag_tilde.html'>tilde</a>, <a href='tag_social-networks.html'>social-networks</a></p>
<!-- text end -->
<!-- entry end -->
</div>
<div id="footer">CC by-nc-nd <a href="https://tilde.team/~ben/">~ben</a> &mdash; <a href="mailto:ben&#64;tilde&#46;team">ben&#64;tilde&#46;team</a><br>
generated with <a href="https://tildegit.org/team/bashblog">bashblog</a>, a single bash script to easily create blogs like this one</div>
</div></div>
<script src="https://utteranc.es/client.js"
repo="benharri/tilde"
issue-term="title"
crossorigin="anonymous"
theme="github-dark"
async>
</script>
</main>
<br>
</body></html>

View File

@ -0,0 +1,49 @@
mastodon postgres upgrade fun
howdy friends!
if you're a mastodon user on [tilde.zone](https://tilde.zone) (the tildeverse
mastodon instance), you might've noticed some downtime recently.
here's a quick recap of what went down during the upgrade process.
---
we run the current stable version of postgresql from the [postgres
apt repos](https://wiki.postgresql.org/wiki/Apt). postgres [13](
https://www.postgresql.org/docs/release/13.0/) was released recently
and the apt upgrades automatically created a new cluster running 13.
the database for mastodon has gotten quite large (about 16gb) which
complicates this upgrade a bit. this was my inital plan:
- drop the 13 cluster created by the apt package upgrades
- upgrade the 12-main cluster to 13
- drop the 12 cluster
these steps appeared to work fine, but closer inspection afterwards
led me to discover that the new cluster had ended up with `SQL_ASCII`
encoding somehow. this is not a situation we want to be in. time to fix it.
here's the new plan:
- stop mastodon
for i in streaming sidekiq web; do systemctl stop mastodon-$i; done
- dump current database state
pg_dump mastodon_production > db.dump
- drop and recreate cluster with utf8 encoding
pg_dropcluster 13 main --stop
pg_createcluster --locale=en_US.UTF8 13 main --start
- restore backup
sudo -u postgres psql -c "create user mastodon createdb;"
sudo -u mastodon createdb -E utf8 mastodon_production
sudo -u mastodon psql < db.dump
i'm still not 100% sure how the encoding reverted to ascii but
it seems that the locale was not correctly set while running the
apt upgrades...
if this happens to you, hopefully this helps you wade out while
keeping all your data :)
tags: sysadmin, tilde, social-networks

View File

@ -24,6 +24,23 @@
<div id="description">a blog about tildes and other things</div>
</div></div></div>
<div id="divbody"><div class="content">
<h3><a class="ablack" href="mastodon-postgres-upgrade-fun.html">
mastodon postgres upgrade fun
</a></h3>
<!-- bashblog_timestamp: #202010281631.39# -->
<div class="subtitle">October 28, 2020 &mdash;
~ben
</div>
<!-- text begin -->
<p>howdy friends!</p>
<p>if you&rsquo;re a mastodon user on <a href="https://tilde.zone">tilde.zone</a> (the tildeverse
mastodon instance), you might&rsquo;ve noticed some downtime recently.</p>
<p>here&rsquo;s a quick recap of what went down during the upgrade process.</p>
<p class="readmore"><a href="./mastodon-postgres-upgrade-fun.html">read more...</a></p>
<h3><a class="ablack" href="mastodon.html">
mastodon
</a></h3>

View File

@ -24,6 +24,23 @@
<div id="description">a blog about tildes and other things</div>
</div></div></div>
<div id="divbody"><div class="content">
<h3><a class="ablack" href="mastodon-postgres-upgrade-fun.html">
mastodon postgres upgrade fun
</a></h3>
<!-- bashblog_timestamp: #202010281631.39# -->
<div class="subtitle">October 28, 2020 &mdash;
~ben
</div>
<!-- text begin -->
<p>howdy friends!</p>
<p>if you&rsquo;re a mastodon user on <a href="https://tilde.zone">tilde.zone</a> (the tildeverse
mastodon instance), you might&rsquo;ve noticed some downtime recently.</p>
<p>here&rsquo;s a quick recap of what went down during the upgrade process.</p>
<p class="readmore"><a href="./mastodon-postgres-upgrade-fun.html">read more...</a></p>
<h3><a class="ablack" href="tools-and-services.html">
tools and services
</a></h3>

View File

@ -24,6 +24,23 @@
<div id="description">a blog about tildes and other things</div>
</div></div></div>
<div id="divbody"><div class="content">
<h3><a class="ablack" href="mastodon-postgres-upgrade-fun.html">
mastodon postgres upgrade fun
</a></h3>
<!-- bashblog_timestamp: #202010281631.39# -->
<div class="subtitle">October 28, 2020 &mdash;
~ben
</div>
<!-- text begin -->
<p>howdy friends!</p>
<p>if you&rsquo;re a mastodon user on <a href="https://tilde.zone">tilde.zone</a> (the tildeverse
mastodon instance), you might&rsquo;ve noticed some downtime recently.</p>
<p>here&rsquo;s a quick recap of what went down during the upgrade process.</p>
<p class="readmore"><a href="./mastodon-postgres-upgrade-fun.html">read more...</a></p>
<h3><a class="ablack" href="tools-and-services.html">
tools and services
</a></h3>

View File

@ -17,7 +17,7 @@ if [ ! -f "$manfile" ]; then
exit 1
fi
zcat "$manfile" \
zcat -f "$manfile" \
| man2html -M /~ben/cgi-bin/man.sh
exit 0