-
Notifications
You must be signed in to change notification settings - Fork 1
Update README.md #64
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
Update README.md #64
Changes from all commits
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 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -87,18 +87,55 @@ uv run black api tests && uv run isort api tests | |||||||||||||
| Use the file `docker-compose.local.yml` to build and deploy local code changes. This allows you to run the entire system at once instead of | ||||||||||||||
| connecting to existing Databases. | ||||||||||||||
|
|
||||||||||||||
| ### Initial setup. | ||||||||||||||
| - On first launch, rails-worker will fail because migrations are not done | ||||||||||||||
| - Go to the `osm-rails` `/bin/sh` and execute `bundle exec rails db:migrate` | ||||||||||||||
| - The above script runs the migration code for osm-rails | ||||||||||||||
| - The rails-worker will be able to run | ||||||||||||||
| - The backend code will fail first time becase `workspaces-tasks-local` database is not available | ||||||||||||||
| - Login to postgresql container and run the following commands | ||||||||||||||
| `psql --username postgres` | ||||||||||||||
| `create database "workspaces-tasks-local";` | ||||||||||||||
| `psql --username postgres --dbname "workspaces-tasks-local";` | ||||||||||||||
| `create extension if not exists postgis;` | ||||||||||||||
| - Run the backend code now and it should be able to run | ||||||||||||||
| ### Initial setup for development local environment | ||||||||||||||
|
|
||||||||||||||
| Step 1: Login to azure docker | ||||||||||||||
|
|
||||||||||||||
| The docker compose relies on images in `opensidewalksdev` azure container registry. Make sure your docker system is logged into it before pulling the images and trying to run the containers. | ||||||||||||||
|
|
||||||||||||||
| Docker login command: | ||||||||||||||
|
|
||||||||||||||
| `docker login opensidewalksdev.azurecr.io -u opensidewalksdev ` | ||||||||||||||
|
|
||||||||||||||
| Password needs to be obtained from Azure portal | ||||||||||||||
|
|
||||||||||||||
| Step 2: Run docker compose for the first time | ||||||||||||||
|
|
||||||||||||||
| Use the following command to start the containers first time | ||||||||||||||
|
|
||||||||||||||
| `docker compose --file docker-compose.local.yml up --build` | ||||||||||||||
|
|
||||||||||||||
| Step 3: Run the migration scripts. | ||||||||||||||
|
|
||||||||||||||
| You will observe that only `osm-rails` component seems to work but the backend and other services may be down. this is because the database migrations on the base osm database are not done. To do the base migrations, do the following: | ||||||||||||||
|
|
||||||||||||||
| - Connect to the `osm-rails` container. If you are using docker hub for desktop, just go to the exec section of the container. | ||||||||||||||
| If you want to use command line, execute the command `docker exec -it <container_name_or_id> /bin/bash` where `container_name` is the name of osm-rails container | ||||||||||||||
| - Execute the migration script in the /bin/bash with `bundle exec rails db:migrate` | ||||||||||||||
| - The above command runs the migration script for databases | ||||||||||||||
|
|
||||||||||||||
| Step 4: Add `workspaces-tasks-local` database in postgresql | ||||||||||||||
|
|
||||||||||||||
| Workspaces backend relies on an additional database. This is needed for some older migrations code. | ||||||||||||||
|
|
||||||||||||||
| - Connect to `database` container. | ||||||||||||||
| - Run the following set of commands one by one | ||||||||||||||
|
|
||||||||||||||
| ```shell | ||||||||||||||
| psql --username postgres | ||||||||||||||
| create database "workspaces-tasks-local"; | ||||||||||||||
| exit; | ||||||||||||||
| psql --username postgres --dbname "workspaces-tasks-local"; | ||||||||||||||
| create extension if not exists postgis; | ||||||||||||||
|
|
||||||||||||||
|
Comment on lines
+124
to
+130
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. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: docker compose --file docker-compose.local.yml exec database \
psql --username postgres --dbname workspaces-tasks-local \
--command "SELECT current_database(), EXISTS (SELECT 1 FROM pg_extension WHERE extname = 'postgis');"Repository: TaskarCenterAtUW/workspaces-backend Length of output: 217 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '\nREADME excerpt around the claimed lines:\n'
sed -n '118,134p' README.md | cat -n
printf '\nSearch for psql/exit usage in README:\n'
rg -n 'psql|exit;|\\q|CREATE EXTENSION|CREATE DATABASE' README.md
printf '\nIf available, inspect psql help text locally:\n'
command -v psql >/dev/null 2>&1 && psql --help | sed -n '1,80p' || echo 'psql binary not available'Repository: TaskarCenterAtUW/workspaces-backend Length of output: 966 Use Proposed fix-psql --username postgres
-create database "workspaces-tasks-local";
-exit;
-psql --username postgres --dbname "workspaces-tasks-local";
-create extension if not exists postgis;
+psql --username postgres --command 'CREATE DATABASE "workspaces-tasks-local";'
+psql --username postgres --dbname "workspaces-tasks-local" \
+ --command 'CREATE EXTENSION IF NOT EXISTS postgis;'📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||
| ``` | ||||||||||||||
|
|
||||||||||||||
| Step 5: Restart the docker compose again | ||||||||||||||
|
|
||||||||||||||
| - `docker compose --file docker-compose.local.yml down` | ||||||||||||||
| - `docker compose --file docker-compose.local.yml up --build` | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
| ### Commands to start and stop the docker compose | ||||||||||||||
|
|
||||||||||||||
|
|
||||||||||||||
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.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Remove the trailing space inside the code span.
This triggers markdownlint MD038.
📝 Committable suggestion
🧰 Tools
🪛 markdownlint-cli2 (0.23.0)
[warning] 98-98: Spaces inside code span elements
(MD038, no-space-in-code)
🤖 Prompt for AI Agents
Source: Linters/SAST tools