Skip to content

Commit 1173fc9

Browse files
author
billy clark
committed
Merge branch 'develop'
2 parents d0543e3 + 8120f77 commit 1173fc9

17 files changed

+662
-692
lines changed

.github/pull_request_template.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,23 @@ Only keep lines below that describe this change, then delete the rest.
1919

2020
Please provide screenshots / animations for any change that involves the UI. Please provide animations to demonstrate user interaction / behavior changes
2121

22-
## How Has This Been Tested?
22+
## Testing on your branch
2323

24-
Please describe the manual tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
24+
Please describe how to test and/or verify your changes. Provide instructions so we can reproduce. Please also provide relevant test data as necessary. These instructions will be used for QA testing below.
2525

2626
- [ ] Test A
2727
- [ ] Test B
2828

29-
## Checklist:
29+
## Checklist
3030

3131
- [ ] I have performed a self-review of my own code
3232
- [ ] I have reviewed the title/description of this PR which will be used as the squashed PR commit message
3333
- [ ] I have commented my code, particularly in hard-to-understand areas
3434
- [ ] I have added tests that prove my fix is effective or that my feature works
35+
36+
## qa.languageforge.org testing
37+
38+
Reviewers: add/replace your name below and check the box to sign-off/attest the feature works as expected on qa.languageforge.org
39+
40+
- [ ] Reviewer1 (YYYY-MM-DD HH:MM)
41+
- [ ] Reviewer2 (YYYY-MM-DD HH:MM)

.github/workflows/build-and-deploy-images.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.github/workflows/deployment-staging.yml

Lines changed: 0 additions & 59 deletions
This file was deleted.
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Integrate changes and deploy
2+
3+
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#on
4+
on:
5+
workflow_call:
6+
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#onworkflow_callinputs
7+
inputs:
8+
image-tag:
9+
type: string
10+
required: true
11+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#onworkflow_callsecrets
12+
secrets:
13+
kube-context:
14+
required: true
15+
image-repo-username:
16+
required: true
17+
image-repo-password:
18+
required: true
19+
20+
jobs:
21+
integrate:
22+
runs-on: ubuntu-latest
23+
24+
env:
25+
# https://docs.docker.com/develop/develop-images/build_enhancements/
26+
DOCKER_BUILDKIT: 1
27+
28+
defaults:
29+
run:
30+
working-directory: docker
31+
32+
steps:
33+
-
34+
uses: actions/checkout@v2
35+
-
36+
run: |
37+
docker --version
38+
docker-compose --version
39+
-
40+
name: Establish image name
41+
id: image
42+
run: |
43+
echo ::set-output name=NAMESPACE::sillsdev/web-languageforge
44+
echo ::set-output name=TAG::${{ inputs.image-tag }}
45+
-
46+
name: Build app
47+
run: docker-compose build --build-arg ENVIRONMENT=production --build-arg BUILD_VERSION=${{ steps.image.outputs.TAG }} app
48+
-
49+
run: docker-compose run --rm app cat /var/www/html/build-version.txt /var/www/html/version.php
50+
-
51+
name: Check unit tests
52+
run: make unit-tests-ci
53+
-
54+
name: Check e2e tests
55+
run: make e2e-tests-ci
56+
-
57+
name: Log in to Docker Hub
58+
uses: docker/login-action@v1
59+
with:
60+
username: ${{ secrets.image-repo-username }}
61+
password: ${{ secrets.image-repo-password }}
62+
-
63+
name: Tag image
64+
run: docker tag lf-app ${{ steps.image.outputs.NAMESPACE }}:${{ steps.image.outputs.TAG }}
65+
-
66+
name: Publish image
67+
run: docker push ${{ steps.image.outputs.NAMESPACE }}:${{ steps.image.outputs.TAG }}
68+
69+
outputs:
70+
IMAGE: ${{ steps.image.outputs.NAMESPACE }}:${{ steps.image.outputs.TAG }}
71+
72+
deploy:
73+
runs-on: [self-hosted, languageforge]
74+
75+
needs: integrate
76+
77+
steps:
78+
-
79+
uses: sillsdev/common-github-actions/install-kubectl@v1
80+
-
81+
run: kubectl --context ${{ secrets.kube-context }} set image deployment/app app=${{ needs.integrate.outputs.IMAGE }}

.github/workflows/production.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Deploy to production
2+
3+
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#on
4+
on:
5+
push:
6+
tags:
7+
- v*
8+
9+
jobs:
10+
staging:
11+
if: github.event.base_ref == 'refs/heads/master'
12+
13+
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_iduses
14+
uses: sillsdev/web-languageforge/.github/workflows/integrate-and-deploy.yml@master
15+
with:
16+
image-tag: $(echo ${{ github.ref }} | sed 's/refs\/tags\///')
17+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idsecrets
18+
secrets:
19+
kube-context: ${{ secrets.LTOPS_K8S_PRODUCTION_CONTEXT }}
20+
image-repo-username: ${{ secrets.DOCKERHUB_USERNAME }}
21+
image-repo-password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}

.github/workflows/staging.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Deploy to staging
2+
3+
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#on
4+
on:
5+
push:
6+
branches:
7+
- develop
8+
9+
jobs:
10+
staging:
11+
# https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#jobsjob_iduses
12+
uses: sillsdev/web-languageforge/.github/workflows/integrate-and-deploy.yml@develop
13+
with:
14+
image-tag: develop-$(date +%Y%m%d)-${{ github.sha }}
15+
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idsecrets
16+
secrets:
17+
kube-context: ${{ secrets.LTOPS_K8S_STAGING_CONTEXT }}
18+
image-repo-username: ${{ secrets.DOCKERHUB_USERNAME }}
19+
image-repo-password: ${{ secrets.DOCKERHUB_ACCESS_TOKEN }}

.github/workflows/tests.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Tests
2+
3+
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#on
4+
on:
5+
pull_request:
6+
7+
defaults:
8+
run:
9+
shell: bash
10+
working-directory: docker
11+
12+
env:
13+
DOCKER_BUILDKIT: 1
14+
15+
jobs:
16+
unit-tests:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
-
21+
uses: actions/checkout@v2
22+
-
23+
name: Run Unit Tests
24+
run: make unit-tests-ci
25+
-
26+
name: Publish Test Results
27+
uses: docker://ghcr.io/enricomi/publish-unit-test-result-action:v1
28+
if: always()
29+
with:
30+
check_name: Unit Test Results
31+
github_token: ${{ github.token }}
32+
files: docker/PhpUnitTests.xml
33+
34+
e2e-tests:
35+
runs-on: ubuntu-latest
36+
37+
steps:
38+
-
39+
uses: actions/checkout@v2
40+
-
41+
name: Build app
42+
run: make build
43+
-
44+
name: Run E2E Tests
45+
run: make e2e-tests-ci
46+
-
47+
name: Publish Test Results
48+
uses: docker://ghcr.io/enricomi/publish-unit-test-result-action:v1
49+
if: always()
50+
with:
51+
check_name: E2E Test Results
52+
github_token: ${{ github.token }}
53+
files: docker/e2e-results.xml

.github/workflows/unit-tests.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
PhpUnitTests.xml
2+
docker/e2e-results.xml
23
src/assets/*
34
!src/assets/.gitkeep
45
src/cache/*

README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,6 @@ After a minute or two, your source or test changes should be applied and you sho
166166

167167
1. `make dev` will start the app in development mode, i.e. changes to source code will immediately be reflected in the locally running app.
168168

169-
### Building for deployment
170-
171-
1. Refer to `/.github/workflows/build-and-deploy-images.yml` for production build commands and `/.github/workflows/deployment-staging.yml` for staging build commands.
172-
173169
### Visual Studio Code ###
174170

175171
Visual Studio Code is a simple, free, cross-platform code editor. You can download VS Code from [here](https://code.visualstudio.com/).
@@ -237,24 +233,26 @@ To debug the tests:
237233
- To debug in VSCode, select the "Node debugger" debug configuration and run it.
238234

239235
## Application deployment ##
240-
Language Forge is built to run in a containerized environment. For now, Kubernetes is the chosen runtime platform. Deployments are not currently automated and must be manually run with the appropriate credentials or from within our CD platform, TeamCity at this time. Deployment scripts for k8s can be found in `docker/deployment`
236+
Language Forge is built to run in a containerized environment. For now, Kubernetes is the chosen runtime platform. Deployments are automated under the right circumstances using GitHub Actions.
241237

242238
### Staging (QA) ###
243-
Staging deployments can be run with `VERSION=<some-docker-tag-or-semver> make deploy-staging`.
239+
Staging deployments can be manually run with `VERSION=<some-docker-tag-or-semver> make deploy-staging`.
244240

245241
Current workflow:
246-
1. merge commits into or make commits on `develop` branch
247-
1. this will kick off the GHA (`.github/workflows/deployment-staging.yml`) to build, publish the necessary images to Docker Hub (https://hub.docker.com/r/sillsdev/web-languageforge/tags) and deploy to the staging environment.
242+
1. merge PR into or make commits on `develop` branch
243+
1. this will kick off the GHA (`.github/workflows/staging.yml`) to build, test and publish the necessary images to Docker Hub (https://hub.docker.com/r/sillsdev/web-languageforge/tags) and deploy this code to the staging environment at https://qa.languageforge.org
248244

249245
### Production ###
250-
Production deployments can be run with `VERSION=<some-docker-tag-or-semver> make deploy-prod`.
246+
Production deployments can be manually run with `VERSION=<some-docker-tag-or-semver> make deploy-prod`.
251247

252248
Current workflow:
253249
1. merge from `develop` into `master`
254250
1. "Draft a new release" on https://github.com/sillsdev/web-languageforge/releases with a `v#.#.#` tag format
255251
1. "Publish" the new release
256-
1. this will kick off the GHA (`.github/workflows/build-and-deploy-images.yml`) to build and publish the necessary images to Docker Hub (https://hub.docker.com/r/sillsdev/web-languageforge/tags)
257-
1. then the deployment scripts can be run either manually or via the TeamCity deploy job
252+
1. this will kick off the GHA (`.github/workflows/production.yml`) to build, test and publish the necessary images to Docker Hub (https://hub.docker.com/r/sillsdev/web-languageforge/tags) and deploy this code to the production environment at https://languageforge.org
253+
254+
### Revert ###
255+
Various tagged images are maintained in Docker Hub. If you need to revert to a previous version, you can do so by running the deployments scripts with the appropriate permissions or utilizing the Kubernetes UI to change the image of a deployment at any time.
258256

259257
### Backup/Restore ###
260258
Backups will be established automatically by LTOps and utilized by LF through the `storageClassName` property in a Persistent Volume Claim. This storage class provided by LTOps establishes both a frequency and retention for a backup. Any time a restoration is needed, the LF team will need to coordinate the effort with LTOps. The process of restoring from a point in time will require the application be brought down for maintenance. The process will roughly follow these steps:

0 commit comments

Comments
 (0)