Skip to content
Merged
Show file tree
Hide file tree
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
173 changes: 0 additions & 173 deletions .github/build-v2-wip.yaml

This file was deleted.

40 changes: 25 additions & 15 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
name: "Release"
on:
push:
branches:
- dev
- stage

workflow_dispatch:
inputs:
build_flag:
Expand All @@ -13,9 +18,9 @@ on:
jobs:
build:
runs-on: ubuntu-latest
name: Build, Push, Deploy (dev)
environment: "dev"
timeout-minutes: 45
name: Build, Push, Deploy
environment: ${{ github.ref_name }}
timeout-minutes: 30
steps:
- uses: actions/checkout@v2
with:
Expand All @@ -27,13 +32,19 @@ jobs:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: "Build Changelog"
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v5
with:
fromTag: "0.1"
toTag: ${{ github.sha }}
mode: "HYBRID"
# - name: Get last tag
# run: echo "TAG_LAST=$(git describe --tags --abbrev=0 --always)" >> $GITHUB_ENV

# - name: "Build Changelog"
# id: build_changelog
# uses: mikepenz/release-changelog-builder-action@v5
# with:
# toTag: "${{ github.ref }}"
# mode: "HYBRID"
# outputFile: "CHANGELOG.md"

# - name: Print CHANGELOG.md
# run: cat CHANGELOG.md

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand Down Expand Up @@ -88,8 +99,8 @@ jobs:
ssh-add ~/.ssh/github_actions

echo Configuring docker context
docker context create dev --docker "host=ssh://github-actions@${{ vars.AZURE_DOCKER_HOST_IP }}"
docker context use dev
docker context create ${{ vars.ENV }} --docker "host=ssh://github-actions@${{ vars.AZURE_DOCKER_HOST_IP }}"
docker context use ${{ vars.ENV }}

# remove images no longer in use--may need disk space to pull
echo Pruning old docker images
Expand All @@ -103,6 +114,5 @@ jobs:
sleep 30s

echo Deploy list
docker ps


docker ps

88 changes: 79 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
# Contents of This Repo
# Dev Standards

## Frontend Tier
### Branch Strategy

* **main**: day to day work goes here.
* **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.
* **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.
* **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.

### GH Actions

See GitHub's actions tab in this repo for more deployment examples/steps.

# System Overview

### Frontend Tier
* ```frontend```: The Workspaces frontend (VueJS app).
* Code here: https://github.com/TaskarCenterAtUW/workspaces-frontend.
* Uses the other components within this repo, e.g. ```osm-rails```, ```osm-cgimap``` and ```tasking-manager``` as an API backend.
Expand All @@ -10,30 +23,87 @@
* Workspaces version in the ```workspaces``` branch. Need to pull from public version periodically to keep up to date.
* Public version: tries to be a match to ```main``` of upstream.

## Backend Tier
### Backend Tier
* ```osm-web```: Reverse proxy that dispatches requests to osm-cgimap or osm-rails depending on performance requirements.
* ```osm-log-proxy```: sits in front of the below two services, logs requests for debugging purposes.
* ```osm-rails```: “reference implementation” for OSM API for editing. Slow.
* ```osm-cgimap```: Faster version of osm-rails. API format the same as osm-rails. Only some functions of osm-rails.
* ```tasking-manager```: Not currently using, but task manager for OSM.

# To build images

# Getting Started

### To build images for deploy

```git clone --recursive https://github.com/TaskarCenterAtUW/workspaces-stack.git```

```docker-compose -f docker-compose.build.yml --env-file XXX.env build```

```docker-compose --env-file XXX.env push```
```docker-compose -f docker-compose.build.yml push```

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).

# To update docker daemon to run with latest images
### To update docker daemon to run with latest images

```docker-compose -f docker-compose.deploy.yml --env-file XXX.env up -d -pull always --force-recreate --remove-orphans```

Replace XXX.env with the environment definition file of the environment for which you are deploying.

# Other Files
### Other Files

* ```example.env```: template of the .env file required by the Docker compose YAML files
* ```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.
* ```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.

# Local Development

### To build images for local development

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.

Add (or merge) the following to your ```/etc/hosts``` file:

```127.0.0.1 localhost workspaces.local api.workspaces.local rapid.workspaces.local osm.workspaces.local pathways.workspaces.local tasks.workspaces.local```

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.

```git clone --recursive https://github.com/TaskarCenterAtUW/workspaces-stack.git```

Comment out the ```osm-log-proxy``` section from ```docker-compose.yml``` as aggregate logging is not available locally.

```docker-compose build```

```cp local.dev.env .env```

```docker-compose up -d```

Now we are ready to finalize configuration on each container.

```
docker-compose run --rm --entrypoint=bash frontend
npm i
exit
```

```
docker-compose run --rm --entrypoint=bash rapid
npm i
exit
```

```
docker-compose run --rm --entrypoint=bash pathways-editor
npm i
exit
```

```
docker-compose run --rm --entrypoint=bash osm-rails
cp /config/example.storage.yml /config/storage.yml
bundle install
exit
```

Note that there are two different ways to run individual containers depending on your dev context.

Using the frontend container as an example:
* To debug / step through run ```docker-compose run --rm frontend```
* To run while working on another service run ```docker-compose up -d frontend```
Loading