You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
and user provisioning during sign-in (`PUT /api/0.6/user/{uid}`).
20
+
### To start on your local machine for dev work (no docker)
41
21
42
-
4.**Set the proxy headers.** The proxy rewrites `Host` to the OSM host and sets
43
-
`X-Real-IP` / `X-Forwarded-For` / `-Host` / `-Proto`, while stripping
44
-
hop-by-hop headers and any spoofed forwarding headers from the client. It does
45
-
*not* strip `Authorization` or `X-Workspace`.
22
+
```
23
+
cp .env.example .env # edit this file for your config
24
+
uv sync
25
+
uv run uvicorn api.main:app
26
+
```
46
27
47
-
5.**Connectivity.**`WS_OSM_HOST` must reach `osm-web`, and the backend needs
48
-
**both**`OSM_DATABASE_URL` and `TASK_DATABASE_URL` — the token bridge and
49
-
user provisioning write to the OSM database.
28
+
### Initial setup for development local environment
50
29
51
-
## Branch Index
30
+
Step 1: Login to azure docker
52
31
53
-
*```develop``` merge your work here; keep this up to date with the "development" environment / dev tag
54
-
*```staging``` keep this up to date with the "staging" environment / stage tag
55
-
*```production``` keep this up to date with the "production" environment / prod tag
32
+
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.
Use the following command to start the containers first time
43
+
44
+
`docker compose --file docker-compose.local.yml up --build`
45
+
46
+
Step 3: Run the migration scripts.
47
+
48
+
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:
49
+
50
+
- Connect to the `osm-rails` container. If you are using docker hub for desktop, just go to the exec section of the container.
51
+
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
52
+
- Execute the migration script in the /bin/bash with `bundle exec rails db:migrate`
53
+
- The above command runs the migration script for databases
54
+
55
+
Step 4: Add `workspaces-tasks-local` database in postgresql
56
+
57
+
Workspaces backend relies on an additional database. This is needed for some older migrations code.
Backend code will be available at `http://localhost:8000`
83
+
84
+
85
+
## Running the tests
86
+
87
+
Tests are fast and require no database, Docker, or network (see
88
+
`tests/README.md`for the design, and `CLAUDE.md`for conventions).
89
+
90
+
```
91
+
uv run pytest # full suite with coverage (configured in pyproject.toml)
92
+
uv run pytest --no-cov -q # quick run, no coverage
93
+
uv run pytest tests/unit # unit tests only
94
+
uv run pytest tests/integration # integration tests only
95
+
uv run pytest -k workspaces # filter by keyword
96
+
```
97
+
98
+
Type-check and format (matches the pre-commit hooks):
99
+
100
+
```
101
+
uvx pyright --pythonpath .venv/bin/python api tests
102
+
uv run black api tests && uv run isort api tests
103
+
```
57
104
## Deployment architecture
58
105
59
106
The deployed system is defined by [`docker-compose.az.yml`](docker-compose.az.yml). It runs the
@@ -125,94 +172,45 @@ Every image tag, database name/user, and server host is parameterized by `${ENV}
125
172
(`dev` / `stage` / `prod`), and secrets are injected from the shell environment
126
173
(`${WS_TASKS_DB_PASS}`, `${WS_OSM_DB_PASS}`, `${WS_OSM_SECRET_KEY_BASE}`). Branches map to these
127
174
environments — see the Branch Index below.
128
-
129
-
## To start on your local machine for dev work
130
-
131
-
```
132
-
cp .env.example .env # edit this file for your config
133
-
uv sync
134
-
uv run uvicorn api.main:app
135
-
```
136
-
137
-
## Running the tests
138
-
139
-
Tests are fast and require no database, Docker, or network (see
140
-
`tests/README.md` for the design, and `CLAUDE.md` for conventions).
141
-
142
-
```
143
-
uv run pytest # full suite with coverage (configured in pyproject.toml)
144
-
uv run pytest --no-cov -q # quick run, no coverage
145
-
uv run pytest tests/unit # unit tests only
146
-
uv run pytest tests/integration # integration tests only
147
-
uv run pytest -k workspaces # filter by keyword
148
-
```
149
-
150
-
Type-check and format (matches the pre-commit hooks):
151
-
152
-
```
153
-
uvx pyright --pythonpath .venv/bin/python api tests
154
-
uv run black api tests && uv run isort api tests
155
-
```
156
-
157
-
## Development with local environment
158
-
159
-
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
160
-
connecting to existing Databases.
161
-
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.
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.
0 commit comments