-
Notifications
You must be signed in to change notification settings - Fork 8
chore: update readme and better error logging #2117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -232,20 +232,42 @@ CC_BASE_URL=http://localhost:3000 | |
| docker run --name ca-postgres -e POSTGRES_PASSWORD=admin -e POSTGRES_DB=postgres \ | ||
| -p 5432:5432 -d postgres:15 | ||
|
|
||
| # Fixed commands (check for user) | ||
| # give hint on actual docker name container E.g. bold_buck random name | ||
| docker exec -i bold_buck psql -U citycatalyst -d postgres -v ON_ERROR_STOP=1 -c "CREATE USER climateadvisor WITH PASSWORD 'climateadvisor';" | ||
|
|
||
| docker exec -i bold_buck psql -U citycatalyst -d postgres -v ON_ERROR_STOP=1 -c "CREATE DATABASE climateadvisor OWNER climateadvisor;" | ||
|
|
||
| docker exec -i bold_buck psql -U citycatalyst -d postgres -v ON_ERROR_STOP=1 -c "GRANT ALL PRIVILEGES ON DATABASE climateadvisor TO climateadvisor;" | ||
|
|
||
| docker exec -i bold_buck psql -U citycatalyst -d postgres -v ON_ERROR_STOP=1 -c "ALTER USER climateadvisor CREATEDB;" | ||
|
|
||
| # Setup database and user | ||
| docker exec -i ca-postgres psql -U postgres -d postgres << EOF | ||
| docker exec -i ca-postgres psql -U postgres -d postgres | ||
| CREATE USER climateadvisor WITH PASSWORD 'climateadvisor'; | ||
| CREATE DATABASE climateadvisor OWNER climateadvisor; | ||
| GRANT ALL PRIVILEGES ON DATABASE climateadvisor TO climateadvisor; | ||
| ALTER USER climateadvisor CREATEDB; | ||
|
Comment on lines
+246
to
250
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Previously the README used a here-document to feed the SQL statements into Useful? React with 👍 / 👎. |
||
| EOF | ||
|
|
||
| # Install pgvector extension | ||
| docker exec ca-postgres apt update | ||
| docker exec ca-postgres apt install -y postgresql-15-pgvector | ||
| docker exec ca-postgres psql -U postgres -d climateadvisor -c "CREATE EXTENSION IF NOT EXISTS vector;" | ||
| ``` | ||
|
|
||
| ``` | ||
| TODO: add comments for docker exec bold_buck sh -lc "apt-get update && apt-get install | ||
|
|
||
| docker exec bold_buck sh -lc "apt-get update && apt-get install -y postgresql-16-pgvector" | ||
| docker exec bold_buck sh -lc "ls /usr/share/postgresql/16/extension/vector.control" | ||
| docker exec -i bold_buck psql -U citycatalyst -d climateadvisor -c "CREATE EXTENSION IF NOT EXISTS vector;" | ||
|
|
||
|
|
||
| on windows: | ||
| TODO: Create additional key in .env for database setup | ||
| CA_DATABASE_URL=postgresql://climateadvisor:climateadvisor@localhost:5432/climateadvisor | ||
| ``` | ||
|
|
||
| ### 4. Install Dependencies & Setup Database | ||
|
|
||
| ```bash | ||
|
|
@@ -264,6 +286,12 @@ cd climate-advisor/service | |
| uvicorn app.main:app --host 0.0.0.0 --port 8080 --reload | ||
| ``` | ||
|
|
||
| TODO: instead of uvicorn chanfe config to use docker container here | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this need to be fixed in this PR? |
||
|
|
||
| something like this: | ||
| docker build -t hiap-app . | ||
| docker run -it --rm -p 8000:8000 --env-file .env hiap-app | ||
|
|
||
| ### 6. Verify Setup | ||
|
|
||
| - **API Docs**: http://localhost:8080/docs | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The setup instructions start the PostgreSQL container with
--name ca-postgres, but the subsequentdocker execcommands targetbold_buck. Unless the user happens to have a container with that randomly generated name, these commands fail with “No such container: bold_buck”, preventing database initialization. The examples should referenceca-postgres(or explain how to discover the actual container name) so the instructions can be executed as written.Useful? React with 👍 / 👎.