From 18896298e007b3e7ca7e165e4e9007faf87d0f25 Mon Sep 17 00:00:00 2001 From: David Patnode Date: Wed, 10 Jul 2024 08:33:00 -0500 Subject: [PATCH 1/4] Update README to better document db setup for local dev, and update database.yml to support local username+password --- README.md | 6 ++++++ config/database.yml | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9c6ca0623..2accf1105 100644 --- a/README.md +++ b/README.md @@ -229,6 +229,12 @@ Every time you pull new changes down, kill docker (if it's running) and re-run: HostedGPT requires these services to be running: - Postgres ([installation instructions](https://www.postgresql.org/download/)) + - Default database username: `app` + - Default database password: `secret` + - Default dev database: `hostedgpt_development` + - Default test database: `hostedgpt_test` + - You can override via environment variables - see `config/database.yml` + - *Note that the docker compose workflow uses `DATABASE_URL` instead, which overrides anything in `config/database.yml`* - rbenv ([installation instructions](https://github.com/rbenv/rbenv)) - ImageMagick (`brew install imagemagick` should work on Mac ) diff --git a/config/database.yml b/config/database.yml index 6fa635417..d43eba3e7 100644 --- a/config/database.yml +++ b/config/database.yml @@ -4,6 +4,8 @@ default: &default host: localhost pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> port: <%= ENV['HOSTEDGPT_DATABASE_PORT'] || 5432 %> + username: <%= ENV['HOSTEDGPT_DB_USERNAME'] || "app" %> + password: <%= ENV["HOSTEDGPT_PB_PASSWORD"] || "secret" %> <% if RUBY_PLATFORM =~ /darwin/ %> gssencmode: disable <% end %> @@ -21,4 +23,3 @@ production: database: hostedgpt_production username: hostedgpt password: <%= ENV["HOSTEDGPT_DATABASE_PASSWORD"] %> - \ No newline at end of file From e48f00d64ab4634c107217bdba7f43967c91e6ab Mon Sep 17 00:00:00 2001 From: David Patnode Date: Thu, 11 Jul 2024 08:37:57 -0500 Subject: [PATCH 2/4] change approach to just use DATABASE_URL for config --- README.md | 10 ++++------ config/database.yml | 9 +-------- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 2accf1105..13acb888f 100644 --- a/README.md +++ b/README.md @@ -229,12 +229,10 @@ Every time you pull new changes down, kill docker (if it's running) and re-run: HostedGPT requires these services to be running: - Postgres ([installation instructions](https://www.postgresql.org/download/)) - - Default database username: `app` - - Default database password: `secret` - - Default dev database: `hostedgpt_development` - - Default test database: `hostedgpt_test` - - You can override via environment variables - see `config/database.yml` - - *Note that the docker compose workflow uses `DATABASE_URL` instead, which overrides anything in `config/database.yml`* + - Use environment variable `DATABASE_URL` to specify the connection parameters + - *Make sure to set that environment variable in your setup!* + - Recommended (development): `DATABASE_URL=postgres://app:secret@localhost/hostedgpt_development` + - Recommended (test): `DATABASE_URL=postgres://app:secret@localhost/hostedgpt_test` - rbenv ([installation instructions](https://github.com/rbenv/rbenv)) - ImageMagick (`brew install imagemagick` should work on Mac ) diff --git a/config/database.yml b/config/database.yml index d43eba3e7..f30a6c41c 100644 --- a/config/database.yml +++ b/config/database.yml @@ -1,25 +1,18 @@ default: &default adapter: postgresql encoding: unicode - host: localhost pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> port: <%= ENV['HOSTEDGPT_DATABASE_PORT'] || 5432 %> - username: <%= ENV['HOSTEDGPT_DB_USERNAME'] || "app" %> - password: <%= ENV["HOSTEDGPT_PB_PASSWORD"] || "secret" %> <% if RUBY_PLATFORM =~ /darwin/ %> gssencmode: disable <% end %> + url: <%= ENV['DATABASE_URL'] %> development: <<: *default - database: <%= ENV['HOSTEDGPT_DEV_DB'] || "hostedgpt_development" %> test: <<: *default - database: <%= ENV['HOSTEDGPT_TEST_DB'] || "hostedgpt_test" %> production: <<: *default - database: hostedgpt_production - username: hostedgpt - password: <%= ENV["HOSTEDGPT_DATABASE_PASSWORD"] %> From e7b610050184677d01ac7fea4acf07ca80273260 Mon Sep 17 00:00:00 2001 From: David Patnode Date: Fri, 12 Jul 2024 08:33:36 -0500 Subject: [PATCH 3/4] revise README for clarity & remove override DATABASE_URL from docker-compose.yml --- README.md | 7 ++----- docker-compose.yml | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 13acb888f..096e4cf9a 100644 --- a/README.md +++ b/README.md @@ -228,11 +228,8 @@ Every time you pull new changes down, kill docker (if it's running) and re-run: HostedGPT requires these services to be running: -- Postgres ([installation instructions](https://www.postgresql.org/download/)) - - Use environment variable `DATABASE_URL` to specify the connection parameters - - *Make sure to set that environment variable in your setup!* - - Recommended (development): `DATABASE_URL=postgres://app:secret@localhost/hostedgpt_development` - - Recommended (test): `DATABASE_URL=postgres://app:secret@localhost/hostedgpt_test` +- Postgres (`brew install imagemagick` or other [install instructions](https://www.postgresql.org/download/)) + - By default postgres will create a default user and following the instructions below to run the app should just work without any additional config, but if you want to set a specific username and password for your database then set the environment variable `DATABASE_URL=postgres://username:password@localhost/hostedgpt_development` (replacing `username`, `password`, and `hostedgpt_development` (database name) as appropriate - rbenv ([installation instructions](https://github.com/rbenv/rbenv)) - ImageMagick (`brew install imagemagick` should work on Mac ) diff --git a/docker-compose.yml b/docker-compose.yml index a6d24ab0b..0f1dd41cb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,7 +24,7 @@ services: target: development environment: # Be sure to add environment variables to config/options.yml - - DATABASE_URL=postgres://app:secret@postgres/app_development + - DATABASE_URL - DEV_HOST=${DEV_HOST:-localhost} # Set if you want to use a different hostname - OVERMIND_COLORS=2,3,5 - VOICE_FEATURE From 9dcd4368c99334d3d7c98148ae31eb4c3b4e73ed Mon Sep 17 00:00:00 2001 From: Keith Schacht Date: Tue, 5 Nov 2024 10:22:11 -0600 Subject: [PATCH 4/4] Update README.md Co-authored-by: Justin Vallelonga --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 096e4cf9a..b2714e667 100644 --- a/README.md +++ b/README.md @@ -228,7 +228,7 @@ Every time you pull new changes down, kill docker (if it's running) and re-run: HostedGPT requires these services to be running: -- Postgres (`brew install imagemagick` or other [install instructions](https://www.postgresql.org/download/)) +- Postgres (`brew install postgresql@16` or other [install instructions](https://www.postgresql.org/download/)) - By default postgres will create a default user and following the instructions below to run the app should just work without any additional config, but if you want to set a specific username and password for your database then set the environment variable `DATABASE_URL=postgres://username:password@localhost/hostedgpt_development` (replacing `username`, `password`, and `hostedgpt_development` (database name) as appropriate - rbenv ([installation instructions](https://github.com/rbenv/rbenv)) - ImageMagick (`brew install imagemagick` should work on Mac )