Skip to content

Commit

Permalink
Better support local dev - local DB documentation & env vars (#456)
Browse files Browse the repository at this point in the history
  • Loading branch information
draknor authored Nov 5, 2024
1 parent e7eba42 commit 452da3e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,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/))
- 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 )

Expand Down
8 changes: 1 addition & 7 deletions config/database.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
default: &default
adapter: postgresql
encoding: unicode
host: localhost
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
port: <%= ENV['HOSTEDGPT_DATABASE_PORT'] || 5432 %>
<% 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"] %>

2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,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
- ALLOWED_REQUEST_ORIGINS
Expand Down

0 comments on commit 452da3e

Please sign in to comment.