Skip to content

Commit 63fab7c

Browse files
committed
Update README.md
Readme updated with steps to run local development
1 parent d7dc66c commit 63fab7c

1 file changed

Lines changed: 49 additions & 12 deletions

File tree

README.md

Lines changed: 49 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -159,18 +159,55 @@ uv run black api tests && uv run isort api tests
159159
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
160160
connecting to existing Databases.
161161

162-
### Initial setup.
163-
- On first launch, rails-worker will fail because migrations are not done
164-
- Go to the `osm-rails` `/bin/sh` and execute `bundle exec rails db:migrate`
165-
- The above script runs the migration code for osm-rails
166-
- The rails-worker will be able to run
167-
- The backend code will fail first time becase `workspaces-tasks-local` database is not available
168-
- Login to postgresql container and run the following commands
169-
`psql --username postgres`
170-
`create database "workspaces-tasks-local";`
171-
`psql --username postgres --dbname "workspaces-tasks-local";`
172-
`create extension if not exists postgis;`
173-
- Run the backend code now and it should be able to run
162+
### Initial setup for development local environment
163+
164+
Step 1: Login to azure docker
165+
166+
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.
167+
168+
Docker login command:
169+
170+
`docker login opensidewalksdev.azurecr.io -u opensidewalksdev `
171+
172+
Password needs to be obtained from Azure portal
173+
174+
Step 2: Run docker compose for the first time
175+
176+
Use the following command to start the containers first time
177+
178+
`docker compose --file docker-compose.local.yml up --build`
179+
180+
Step 3: Run the migration scripts.
181+
182+
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:
183+
184+
- Connect to the `osm-rails` container. If you are using docker hub for desktop, just go to the exec section of the container.
185+
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
186+
- Execute the migration script in the /bin/bash with `bundle exec rails db:migrate`
187+
- The above command runs the migration script for databases
188+
189+
Step 4: Add `workspaces-tasks-local` database in postgresql
190+
191+
Workspaces backend relies on an additional database. This is needed for some older migrations code.
192+
193+
- Connect to `database` container.
194+
- Run the following set of commands one by one
195+
196+
```shell
197+
psql --username postgres
198+
create database "workspaces-tasks-local";
199+
exit;
200+
psql --username postgres --dbname "workspaces-tasks-local";
201+
create extension if not exists postgis;
202+
203+
```
204+
205+
Step 5: Restart the docker compose again
206+
207+
- `docker compose --file docker-compose.local.yml down`
208+
- `docker compose --file docker-compose.local.yml up --build`
209+
210+
174211
175212
### Commands to start and stop the docker compose
176213

0 commit comments

Comments
 (0)