From b1d2dc5e97cf794f987d4586ff13597c2f99b0d5 Mon Sep 17 00:00:00 2001 From: Zach Gollwitzer Date: Tue, 1 Oct 2024 18:57:38 -0400 Subject: [PATCH] Add DB connection troubleshooting to self hosting guide Signed-off-by: Zach Gollwitzer --- docs/hosting/docker.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/hosting/docker.md b/docs/hosting/docker.md index 9ba688e6..c112f42d 100644 --- a/docs/hosting/docker.md +++ b/docs/hosting/docker.md @@ -174,6 +174,19 @@ docker compose up --no-deps -d app # This restarts the app using the newest vers ## Troubleshooting -This section will provide troubleshooting tips and solutions for common issues -encountered during deployment. Check back later for updates! +### ActiveRecord::DatabaseConnectionError +If you are trying to get Maybe started for the **first time** and run into database connection issues, it is likely because Docker has already initialized the Postgres database with a _different_ default role (usually from a previous attempt to start the app). + +If you run into this issue, you can optionally **reset the database**. + +**PLEASE NOTE: this will delete any existing data that you have in your Maybe database, so proceed with caution.** For first-time users of the app just trying to get started, you're generally safe to run the commands below. + +By running the commands below, you will delete your existing Maybe database and "reset" it. + +``` +docker compose down +docker volume rm maybe_postgres-data # this is the name of the volume the DB is mounted to +docker compose up +docker exec -it maybe-postgres-1 psql -U maybe -d maybe_production -c "SELECT 1;" # This will verify that the issue is fixed +```