Build Tezos from source for alphanet on Debian 9

This explains how to build a Tezos node from source on Debian 9 such that it runs on the alphanet. Building from source is more complicated than just running the docker image but it allows us to easily place the Tezos data in a filesystem that is tuned for the purpose and makes better use of the available disk space.

Build instructions also appear at https://github.com/tezos/tezos. This document just gives some specifics for Debian 9 and optimizes the file space as above.

(If you are not concerned about disk space, just ignore the steps below that refer to the “home” partition or “/dev/sdc”. Similarly, this uses Debian 9 as the base since that distro is fairly lightweight, easily available on linode.com, and has the necessary dependent packages for building tezos. Other distros will work but you may have issues getting the right version of libsodium / libsodium-dev.)

At linode.com [1], create a new 1024 Linode instance ($5/month).

  1. Deploy the Debian 9 image on it allocating 2000 MB.
  2. Create a new disk labeled as “home”, raw/unformatted, using all remaining available space.
  3. Assign that “home” disk to /dev/sdc in the configuration profile.
  4. Boot the linode.

Login to the server and update it.

$ ssh root@173.255.xxx.xxx
$ apt-get update
$ apt-get upgrade -y

Create the filesystem that will hold the Tezos blockchain and other meta-data. This data comprises many small files so we override ext4 defaults to use small blocks, more inodes, and the minimal inode size.

$ mkfs.ext4 -b 1024 -i 1024 -I 128 /dev/sdc
$ mount /dev/sdc /home

Create the user [2] where we will finish the installation and run Tezos:

$ adduser tezos
$ adduser tezos sudo
$ su - tezos

Install the base packages needed:

$ sudo apt-get install -y patch unzip make gcc m4 git g++

Install the necessary OPAM (Ocaml) tools. (These steps can take five or so minutes apiece):

$ wget https://raw.github.com/ocaml/opam/master/shell/opam_installer.sh -O - | sh -s /usr/local/bin
$ opam switch "tezos" --alias-of 4.04.2
$ eval `opam config env`

Get tezos code:

$ git clone -b alphanet https://github.com/tezos/tezos.git
$ cd tezos

Build (takes a long time; there are several user-prompts requiring responses early on; this will install some additional packages as needed such as leveldb[3]):

$ make build-deps
$ make

Note: The above two build steps fail as of 2017/12/06. See a workaround at GitHub issues.

See https://github.com/tezos/tezos/tree/alphanet#compilation-from-sources for the steps to run your alphanet node.

Here is one way to start the node service so that the RPC port (8732) is available remotely and CORS support is enabled:

$ ./tezos-node run --rpc-addr='*' --connections=16 --cors-header='content-type' --cors-origin='*'

I run it inside a screen session so that it hangs around after I log out.

Another option is to run it in the background this way (with no CORS support, arbitrarily):

$ nohup ./tezos-node run --rpc-addr='*' --connections=16 >node.log 2>&1 &

That runs tezos-node in the background (because of the final &), writes its output to a node.log file, and continues after you log out (because of the initial nohup command wrapper).

Footnotes

  1. Linode only because that’s the VPS host I know best. If you should happen to create an account at linode, my referral code is da62f5a3a544121428ed41f357c3056c1f51091a — I’d get $20 credit and you’d get my gratitude.

  2. It’s not strictly necessary to create a new user (tezos in the above) to build and run tezos — you can do it as the default root user — but it’s good security practice to do as little as possible as root.

  3. Version 1.18 of the leveldb libraries is required. Newer versions may compile but are prone to runtime errors when used with tezos. Building on Debian 9 currently gets the correct version; if you build on the latest Ubuntu you’ll have to force-install leveldb 1.18 somehow before running make build-deps.

Managing WordPress via git

I reorganized my self-hosted WordPress system to use git to manage the WordPress code and to move the content outside of the WordPress directory. That way I should be able to do a simple git pull and git checkout $newversion to update my WordPress. I’m also keeping my content directory under change management (separately) so that I can update plugins through the web and be able to roll back.

  • $HOME/blog/wordpress is a git clone of git@github.com:WordPress/WordPress.git. I make no local changes in this. In particular, all of wp-content is unchanged (I make it unwriteable by Apache to be sure).
  • $HOME/blog/content is a copy of the wp-content of my site (prior to moving it outside the wordpress code). It contains the usual: plugins, themes, uploads. It’s all writeable by Apache so that I can update plugins and themes through the web.
  • $HOME/blog/wp-config.php is the usual config file (WordPress looks in the parent directory for it). It’s standard except for two settings:

    define('WP_CONTENT_DIR', '/home/fred/blog/content');  
    define('WP_CONTENT_URL', 'http://fred.yankowski.com/content');
    
  • /etc/apache2/conf.d/wordpress.conf defines the VirtualHost for the wordpress site. It has an alias to support special location of the content. (It also has the mod_rewrite rules for permalinks so that I don’t need an .htaccess file in the wordpress code).

    DocumentRoot /home/fred/blog/wordpress
    Alias /content /home/fred/blog/content
    

Google Reader, RIP

Google just announced that Reader will be unavailable as of July 1. Damn!

This makes me think that I should never rely on Google products for anything important. Docs, calendar, etc. Time to start looking for alternatives to each.

Calendar as information central

I think Scott Adams is right, “the biggest software revolution of the future is that the calendar will be the organizing filter for most of the information flowing into your life”. Sharing calendars is still too hard, and when we solve that problem I expect it to be hugely useful. I expected shared calendar technology to become mainstream years ago and it still hasn’t happened. Just what is the roadblock?

upgrading WordPress, or how to turn 30 minutes into several hours

It took maybe 30 minutes to upgrade from WordPress 2.2 to 2.6, including time to revisit my notes on how I’ve done it before and to scan the official install/upgrade notes. But then it took a couple of hours to figure out why categories were gone and how to fix it. Long story short, I had to manually build the wp_terms table rows based on the old wp_categories rows. The SQL given in a forum note, lost categories after 2.6 upgrade, did the trick. But what a waste of time.

Selenium

The Selenium software for testing web apps looks promising. We’ve got a boatload of pages to get going in our PowerSchool deployment project and I’m hoping to use something like Selenium to automate some of the testing.

I experimented creating a test using the Selenium IDE plug-in with Firefox and ran into a glitch right away. The page I’m testing does a redirect to force the connection into SSL/https. The IDE tool captures the session OK but when I try to run the test from Selenium on the host it hangs at the point where the conversation switches to the SSL port. I tried starting out in SSL but then it hangs when the ultimate page redirects back to a port 80 connection. Rats.