|
1 | | -# Contents of This Repo |
| 1 | +# Dev Standards |
2 | 2 |
|
3 | | -## Frontend Tier |
| 3 | +### Branch Strategy |
| 4 | + |
| 5 | +* **main**: day to day work goes here. |
| 6 | +* **dev**: current code of the dev environment. No commits allowed directly; you'll need to open a PR from main (or your feature branch). Committing/pushing here causes a deployment to the dev infrastructure. |
| 7 | +* **stage**: current code of the stage environment. No commits allowed directly; you'll need to open a PR from dev. Committing/pushing here causes a deployment to the stage infrastructure. |
| 8 | +* **prod**: current code of the prod environment. No commits allowed directly; you'll need to open a PR from stage. Committing/pushing here causes a deployment to the prod infrastructure. |
| 9 | + |
| 10 | +### GH Actions |
| 11 | + |
| 12 | +See GitHub's actions tab in this repo for more deployment examples/steps. |
| 13 | + |
| 14 | +# System Overview |
| 15 | + |
| 16 | +### Frontend Tier |
4 | 17 | * ```frontend```: The Workspaces frontend (VueJS app). |
5 | 18 | * Code here: https://github.com/TaskarCenterAtUW/workspaces-frontend. |
6 | 19 | * Uses the other components within this repo, e.g. ```osm-rails```, ```osm-cgimap``` and ```tasking-manager``` as an API backend. |
|
10 | 23 | * Workspaces version in the ```workspaces``` branch. Need to pull from public version periodically to keep up to date. |
11 | 24 | * Public version: tries to be a match to ```main``` of upstream. |
12 | 25 |
|
13 | | -## Backend Tier |
| 26 | +### Backend Tier |
14 | 27 | * ```osm-web```: Reverse proxy that dispatches requests to osm-cgimap or osm-rails depending on performance requirements. |
15 | 28 | * ```osm-log-proxy```: sits in front of the below two services, logs requests for debugging purposes. |
16 | 29 | * ```osm-rails```: “reference implementation” for OSM API for editing. Slow. |
17 | 30 | * ```osm-cgimap```: Faster version of osm-rails. API format the same as osm-rails. Only some functions of osm-rails. |
18 | 31 | * ```tasking-manager```: Not currently using, but task manager for OSM. |
19 | | - |
20 | | -# To build images |
| 32 | + |
| 33 | +# Getting Started |
| 34 | + |
| 35 | +### To build images for deploy |
21 | 36 |
|
22 | 37 | ```git clone --recursive https://github.com/TaskarCenterAtUW/workspaces-stack.git``` |
23 | 38 |
|
24 | 39 | ```docker-compose -f docker-compose.build.yml --env-file XXX.env build``` |
25 | 40 |
|
26 | | -```docker-compose --env-file XXX.env push``` |
| 41 | +```docker-compose -f docker-compose.build.yml push``` |
27 | 42 |
|
28 | 43 | Replace XXX.env with the environment definition file of the environment for which you want to build an image. This can be overridden when running (see below). |
29 | 44 |
|
30 | | -# To update docker daemon to run with latest images |
| 45 | +### To update docker daemon to run with latest images |
31 | 46 |
|
32 | 47 | ```docker-compose -f docker-compose.deploy.yml --env-file XXX.env up -d -pull always --force-recreate --remove-orphans``` |
33 | 48 |
|
34 | 49 | Replace XXX.env with the environment definition file of the environment for which you are deploying. |
35 | 50 |
|
36 | | -# Other Files |
| 51 | +### Other Files |
37 | 52 |
|
38 | 53 | * ```example.env```: template of the .env file required by the Docker compose YAML files |
39 | | -* ```tdei_uw.env```: .env for deployment at UW's TDEI center. Only UW should use this, new users should adapt example.env to suit their needs. LTG: remove this file from this repo. |
| 54 | +* ```tdei_uw.env```: .env for deployment at UW's TDEI center. Only UW should use this, new users should adapt example.env to suit their needs. LTG: remove this file from this repo. |
| 55 | + |
| 56 | +# Local Development |
| 57 | + |
| 58 | +### To build images for local development |
| 59 | + |
| 60 | +You will need access to prepopulated .env files that are not in version control. Specifically local.dev.env for the rest of these steps, which is assumed to be found in the workspaces-stack root directory. |
| 61 | + |
| 62 | +Add (or merge) the following to your ```/etc/hosts``` file: |
| 63 | + |
| 64 | +```127.0.0.1 localhost workspaces.local api.workspaces.local rapid.workspaces.local osm.workspaces.local pathways.workspaces.local tasks.workspaces.local``` |
| 65 | + |
| 66 | +You will also need to increase the total amount of system memory available to Docker containers to 10+ GB. In Docker Desktop you find this in Settings -> Resources -> Memory Limit. |
| 67 | + |
| 68 | +```git clone --recursive https://github.com/TaskarCenterAtUW/workspaces-stack.git``` |
| 69 | + |
| 70 | +Comment out the ```osm-log-proxy``` section from ```docker-compose.yml``` as aggregate logging is not available locally. |
| 71 | + |
| 72 | +```docker-compose build``` |
| 73 | + |
| 74 | +```cp local.dev.env .env``` |
| 75 | + |
| 76 | +```docker-compose up -d``` |
| 77 | + |
| 78 | +Now we are ready to finalize configuration on each container. |
| 79 | + |
| 80 | +``` |
| 81 | +docker-compose run --rm --entrypoint=bash frontend |
| 82 | +npm i |
| 83 | +exit |
| 84 | +``` |
| 85 | + |
| 86 | +``` |
| 87 | +docker-compose run --rm --entrypoint=bash rapid |
| 88 | +npm i |
| 89 | +exit |
| 90 | +``` |
| 91 | + |
| 92 | +``` |
| 93 | +docker-compose run --rm --entrypoint=bash pathways-editor |
| 94 | +npm i |
| 95 | +exit |
| 96 | +``` |
| 97 | + |
| 98 | +``` |
| 99 | +docker-compose run --rm --entrypoint=bash osm-rails |
| 100 | +cp /config/example.storage.yml /config/storage.yml |
| 101 | +bundle install |
| 102 | +exit |
| 103 | +``` |
| 104 | + |
| 105 | +Note that there are two different ways to run individual containers depending on your dev context. |
| 106 | + |
| 107 | +Using the frontend container as an example: |
| 108 | +* To debug / step through run ```docker-compose run --rm frontend``` |
| 109 | +* To run while working on another service run ```docker-compose up -d frontend``` |
0 commit comments