obda.net

Upgrade PostgreSQL from 9.4 to 9.5

Add a comment

Articles tagged with gentoo may not totally apply to your preferred flavor of Linux.

After installing PostgreSQL 9.5, first setup the initial database environment:

emerge --config dev-db/postgresql:9.5

Next, compare and update the configuration files:

If needed, run /etc/init.d/postgresql-9.4 stop to stop the old database server before proceeding with the upgrade.

Now, switch to the postgres user, and execute pg_upgrade, which does the hard work. Run it with the --check option first to perform only the necessary checks without changing any data:

# su - postgres
$ /usr/lib/postgresql-9.5/bin/pg_upgrade \
      --old-bindir=/usr/lib/postgresql-9.4/bin/ \
      --new-bindir=/usr/lib/postgresql-9.5/bin/ \
      --old-datadir=/var/lib/postgresql/9.4/data/ \
      --new-datadir=/var/lib/postgresql/9.5/data/ \
      --check

(This uses the default paths for the data directories; adjust the command accordingly if your setup is different.)

If the command runs without errors, execute it again without the --check flag to perform the actual upgrade. Once it is finished, you can start the new database server via /etc/init.d/postgresql-9.5 start, do some cleanup tasks that pg_upgrade might have you prompted for, and verify that everything works as before. Finally, uninstall the old PostgreSQL version, and don’t forget to add/delete services from runlevels if necessary.

Tweaking Gentoo’s Greeting Message

Add a comment

Articles tagged with gentoo may not totally apply to your preferred flavor of Linux.

Gentoo’s standard greeting message on the console looks like this:

This is <my_hostname>.<my_domain> (Linux x86_64 4.3.3-gentoo) 12:00:00

While informative, it isn’t really pretty. Modifying it turns out to be quite easy, though: just edit /etc/issue! By default, it contains:

This is \n.\O (\s \m \r) \t

Simply adjust this to your needs, and you are done. Especially removing .\O might be of interest, as this gets rid of the ugly .unknown_domain part which you get in case you don’t have a domain configured.

Custom CSS and JS for Sphinx-Generated Documentation

Add a comment

When generating HTML documentation with Sphinx, it is possible to adjust a couple of theme-related settings by defining html_theme_options in your conf.py, e.g.:

html_theme_options = {
    'rightsidebar': True,
    'textcolor': '#333',
}

However, the available options that can be customized are (a) rather restricted, and (b) specific to each theme. The [options] section of a theme’s theme.conf sheds light on what can be done (and what not).

On a global basis, though, you can define html_context to add some custom CSS and JavaScript files:

html_context = {
    'css_files': ['_static/custom.css'],
    'script_files': ['_static/custom.js'],
}

The files listed there will be included last in the generated HTML files’ sources, so it is easy to directly tweak the generated documentation’s final appearance (and, if needed, behavior).

For reference, have a look at Sphinx’s builders.html.StandaloneHTMLBuilder.prepare_writing() and see how self.globalcontext gets populated there.