Some hosted providers like Heroku do not support the HypoPG extension, which Dexter needs to run. Hopefully this will change with time. For now, we can spin up a separate database instance to run Dexter. It’s not super convenient, but can be useful to do from time to time.
Ubuntu 22.04
sudo apt-get install -y curl ca-certificates gnupg
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg >/dev/null
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
sudo apt-get update
sudo apt-get install -y postgresql-15 postgresql-server-dev-15
sudo -u postgres createuser $(whoami) -s
sudo apt-get install -y ruby3.0 ruby3.0-dev
Mac
brew install postgresql
brew install ruby
HypoPG
cd /tmp
curl -L https://github.com/HypoPG/hypopg/archive/1.4.0.tar.gz | tar xz
cd hypopg-1.4.0
make
make install # may need sudo
Dexter
gem install pgdexter # may need sudo
Production-tier databases only
heroku logs -p postgres > postgresql.log
We recommend creating a new instance from a snapshot for the dump to avoid affecting customers.
pg_dump -v -j 8 -Fd -f /tmp/newout.dir <connection-options>
Then shutdown the dump instance. Restore with:
createdb dexter_restore
pg_restore -v -j 8 -x -O --format=d -d dexter_restore /tmp/newout.dir/
dexter dexter_restore postgresql.log* --analyze
🎉