Last active
April 29, 2024 00:30
-
-
Save monsha/d7620a3457e7ae90219ad6c15fd0369f to your computer and use it in GitHub Desktop.
Pghero on Rails with Dokku
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#postgresql setup | |
ssh -i ~/.ssh/id_rsa root@<domain> | |
dokku postgres:connect <db> | |
psql=# SHOW config_file; | |
-> /var/lib/postgresql/data/postgresql.conf | |
psql=# \q | |
docker ps | |
docker cp <container>:/var/lib/postgresql/data/postgresql.conf . | |
#Add the following to postgresql.conf: | |
shared_preload_libraries = 'pg_stat_statements' | |
pg_stat_statements.track = all | |
pg_stat_statements.max = 10000 | |
track_activity_query_size = 2048 | |
docker cp postgresql.conf <container>:/var/lib/postgresql/data/postgresql.conf | |
docker exec -ti <container> /bin/bash | |
root@24de23319cd7: cat /var/lib/postgresql/data/postgresql.conf | |
root@24de23319cd7: exit | |
#restart PostgreSQL. | |
docker restart <container> | |
# deploy | |
git push dokku master | |
dokku --rm run <app> bundle exec rake db:migrate | |
# Schedule cron: | |
*/5 * * * * dokku --rm run <app> bundle exec rails pghero:capture_query_stats && curl -fsS --retry 3 https://hchk.io/<token> > /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
One would gladly have that as an installation option but thank you for the share.