Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 49 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `

Copy link
Copy Markdown

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.

-`docker login opensidewalksdev.azurecr.io -u opensidewalksdev `
+`docker login opensidewalksdev.azurecr.io -u opensidewalksdev`
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
`docker login opensidewalksdev.azurecr.io -u opensidewalksdev `
`docker login opensidewalksdev.azurecr.io -u opensidewalksdev`
🧰 Tools
🪛 markdownlint-cli2 (0.23.0)

[warning] 98-98: Spaces inside code span elements

(MD038, no-space-in-code)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` at line 98, Remove the trailing space inside the inline code span
containing the docker login command, while preserving the command text and
formatting.

Source: Linters/SAST tools


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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The 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 \q or separate psql commands here.
exit; is SQL, not a psql quit command, so this block does not leave the first session before the next command.

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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```shell
psql --username postgres
create database "workspaces-tasks-local";
exit;
psql --username postgres --dbname "workspaces-tasks-local";
create extension if not exists postgis;
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` around lines 124 - 130, Update the README database setup commands
so the first psql session is terminated with the psql quit command \q, or split
the database creation and connection steps into separate psql invocations;
remove the invalid exit; SQL command while preserving the existing database and
PostGIS setup sequence.

```

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

Expand Down
Loading