psql -U user db
\l # list databases
\c db # connect to database
\dt # list tables


  • change user password (doesn't have one by default)
    psql -p 5432 -U mastodon mastodon_production -w
    alter user mastodon with password '<password>';
    update .env.production

setting up nagios monitoring

  • download check_postgres plugin
    cd /opt/nagios/custom_plugins
    wget ""
    tar xf check_postgres.tar.gz
    cd check_postgres...
    ./ --symlinks
  • open port on mastodon server
    iptables -A INPUT -p tcp -s --dport 5432 -m state --state NEW,ESTABLISHED -j ACCEPT