Skip to content

Commit 90ddfc5

Browse files
committed
Update README.md
Readme updated with steps to run local development
1 parent 1129280 commit 90ddfc5

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
@@ -87,18 +87,55 @@ uv run black api tests && uv run isort api tests
8787
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
8888
connecting to existing Databases.
8989

90-
### Initial setup.
91-
- On first launch, rails-worker will fail because migrations are not done
92-
- Go to the `osm-rails` `/bin/sh` and execute `bundle exec rails db:migrate`
93-
- The above script runs the migration code for osm-rails
94-
- The rails-worker will be able to run
95-
- The backend code will fail first time becase `workspaces-tasks-local` database is not available
96-
- Login to postgresql container and run the following commands
97-
`psql --username postgres`
98-
`create database "workspaces-tasks-local";`
99-
`psql --username postgres --dbname "workspaces-tasks-local";`
100-
`create extension if not exists postgis;`
101-
- Run the backend code now and it should be able to run
90+
### Initial setup for development local environment
91+
92+
Step 1: Login to azure docker
93+
94+
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.
95+
96+
Docker login command:
97+
98+
`docker login opensidewalksdev.azurecr.io -u opensidewalksdev `
99+
100+
Password needs to be obtained from Azure portal
101+
102+
Step 2: Run docker compose for the first time
103+
104+
Use the following command to start the containers first time
105+
106+
`docker compose --file docker-compose.local.yml up --build`
107+
108+
Step 3: Run the migration scripts.
109+
110+
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:
111+
112+
- Connect to the `osm-rails` container. If you are using docker hub for desktop, just go to the exec section of the container.
113+
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
114+
- Execute the migration script in the /bin/bash with `bundle exec rails db:migrate`
115+
- The above command runs the migration script for databases
116+
117+
Step 4: Add `workspaces-tasks-local` database in postgresql
118+
119+
Workspaces backend relies on an additional database. This is needed for some older migrations code.
120+
121+
- Connect to `database` container.
122+
- Run the following set of commands one by one
123+
124+
```shell
125+
psql --username postgres
126+
create database "workspaces-tasks-local";
127+
exit;
128+
psql --username postgres --dbname "workspaces-tasks-local";
129+
create extension if not exists postgis;
130+
131+
```
132+
133+
Step 5: Restart the docker compose again
134+
135+
- `docker compose --file docker-compose.local.yml down`
136+
- `docker compose --file docker-compose.local.yml up --build`
137+
138+
102139
103140
### Commands to start and stop the docker compose
104141

0 commit comments

Comments
 (0)