How to Solution: install with docker in lxd


Issue Summary

I have been running redash on an lxd container. Since redash streamlined to docker images and stopped providing a on-docker installation script, I was stuck with no way to upgrade.

This is a small how to list of steps that got me an upgraded redash using docker inside lxd.

Technical details:

  • Redash Version: 4 to 6
  • Browser/OS: NA
  • How did you install Redash: self-hosted install script, upgraded with docker image

How To

Basically I just installed the latest docker-based redash, which was at this time v6.0.
My plan was to get a new instance running, point it to the existing database from v4, and run migrations. That ran well, with just 2 caveats easily solved.

1 - create new postgresql database as a duplicate of the production v4 database (backup/restore)
2 - create new lxd container for the docker based redash v6, with nested virtualization:
lxd launch ubuntu:18.04 redashdocker -c security.nesting=true
3 - login into the lxs container
lxc exec redashdocker -- sudo --login --user ubuntu
4 - configure docker proxy since we do have one on
sudo mkdir -p /etc/systemd/system/docker.service.d
sudo nano /etc/systemd/system/docker.service.d/proxy.conf
Environment="HTTP_PROXY=" Environment="HTTPS_PROXY=" Environment="NO_PROXY="localhost,,::1,10.230.*.*,172.18.0.*,172.17.0.*"

(We also always configure apt and ubuntu system wide proxy. You should search elsewhere.)
5 - Proceed with the usual redash installation as documented I also found this useful.
6 - Stop redash, edit env file to point to production database (had to use sudo with docker)
sudo docker-compose stop server scheduler scheduled_worker adhoc_worker
nano /opt/redash/env #REDASH_DATABASE_URL=postgresql://postgres:Q5BuULdlWw4EKHcNJQVHFmBVAVESi3pu@postgres/postgres

7-Run migrations
sudo docker-compose run --rm server manage db upgrade
8-start redash if not running
sudo docker-compose up -d

That’s it, as far as I remember.

Good luck.