Skip to content

Commit

Permalink
Merge branch 'deploymentToMerge'
Browse files Browse the repository at this point in the history
  • Loading branch information
megahirt committed Sep 15, 2022
2 parents 1bf4733 + 11e1709 commit 904ed6e
Show file tree
Hide file tree
Showing 32 changed files with 10,451 additions and 15,601 deletions.
33 changes: 18 additions & 15 deletions docker/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@
.PHONY: start
start: build
# starts the entire runtime infrastructure
docker-compose up -d ssl
docker compose up -d ssl

.PHONY: dev
dev: start
docker-compose up -d ui-builder
docker compose up -d ui-builder

.PHONY: playwright-tests
playwright-tests:

# stop any containers that are running
docker compose down

# delete any cached session storage state files if the service isn't running
docker compose ps app-for-playwright > /dev/null 2>&1 || rm -f ../*-storageState.json

docker-compose up -d app-for-playwright
docker compose up -d app-for-playwright

# wait until the app-for-playwright service is serving up HTTP before continuing
until curl localhost:3238 > /dev/null 2>&1; do sleep 1; done
Expand All @@ -24,32 +27,32 @@ playwright-tests:

.PHONY: e2e-tests
e2e-tests:
docker-compose build app-for-e2e test-e2e
docker-compose restart app-for-e2e || docker-compose up -d app-for-e2e
docker-compose run -e TEST_SPECS=$(TEST_SPECS) test-e2e
docker compose build app-for-e2e test-e2e
docker compose restart app-for-e2e || docker compose up -d app-for-e2e
docker compose run -e TEST_SPECS=$(TEST_SPECS) test-e2e

.PHONY: e2e-tests-ci
e2e-tests-ci:
docker-compose build app-for-e2e test-e2e
docker-compose run -e GITHUB_ACTIONS=1 --name e2etests test-e2e
docker compose build app-for-e2e test-e2e
docker compose run -e GITHUB_ACTIONS=1 --name e2etests test-e2e
docker cp e2etests:/data/e2e-output/junitresults.xml e2e-results.xml
docker rm e2etests

.PHONY: unit-tests
unit-tests:
docker-compose build test-php
docker-compose run test-php
docker compose build test-php
docker compose run test-php

.PHONY: unit-tests-ci
unit-tests-ci:
docker-compose run --name unittests test-php
docker compose run --name unittests test-php
docker cp unittests:/var/www/PhpUnitTests.xml .
docker rm unittests

.PHONY: build
build:
npm install
docker-compose build mail app lfmerge ld-api next-proxy next-app
docker compose build mail app lfmerge ld-api next-proxy next-app

.PHONY: scan
# https://docs.docker.com/engine/scan
Expand All @@ -68,14 +71,14 @@ build-next:

.PHONY: clean
clean:
docker-compose down
docker compose down
docker system prune -f

.PHONY: clean-volumes
clean-volumes:
docker-compose down -v
docker compose down -v
docker system prune -f --volumes

.PHONY: clean-powerwash
clean-powerwash: clean-volumes
docker-compose down --rmi all
docker compose down --rmi all
29 changes: 12 additions & 17 deletions docker/deployment/app-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,6 @@ spec:
labels:
app: app
spec:
affinity:
# required to ensure this container makes it to lfmerge's dedicated node
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- preference:
matchExpressions:
- key: dedicated
operator: In
values:
- lfmerge
weight: 1
# required to ensure this container makes it to lfmerge's dedicated node
tolerations:
- effect: NoSchedule
key: dedicated
operator: Equal
value: lfmerge
volumes:
- name: assets
persistentVolumeClaim:
Expand All @@ -92,6 +75,11 @@ spec:
initContainers:
- name: initialize-volume-ownership
image: busybox:1.33
resources:
requests:
memory: 25Mi
limits:
memory: 50Mi
command:
- 'sh'
- '-c'
Expand All @@ -107,6 +95,13 @@ spec:
- name: app
image: sillsdev/web-languageforge:{{VERSION}}
imagePullPolicy: Always
# https://kubernetes.io/docs/concepts/configuration/manage-resources-containers
resources:
requests:
memory: 110Mi
cpu: 0.1
limits:
memory: 200Mi
volumeMounts:
- mountPath: /var/www/html/assets
name: assets
Expand Down
7 changes: 7 additions & 0 deletions docker/deployment/db-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ spec:
containers:
- name: db
image: mongo:4.0
# https://kubernetes.io/docs/concepts/configuration/manage-resources-containers
resources:
requests:
memory: 260Mi
cpu: 0.1
limits:
memory: 400Mi
volumeMounts:
- mountPath: /data/db
name: data
Expand Down
29 changes: 13 additions & 16 deletions docker/deployment/lfmerge-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,6 @@ spec:
app: lfmerge
spec:
affinity:
# required to ensure this container makes it to a dedicated node (so it doesn't crash other containers when it blows up)
nodeAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- preference:
matchExpressions:
- key: dedicated
operator: In
values:
- lfmerge
weight: 1
# need to keep this on the same pod as the app since inotify only gets notification when updates occur on the same kernel
podAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
Expand All @@ -86,19 +76,19 @@ spec:
values:
- app
topologyKey: kubernetes.io/hostname
# required to ensure this container makes it to a dedicated node (so it doesn't crash other containers when it blows up)
tolerations:
- effect: NoSchedule
key: dedicated
operator: Equal
value: lfmerge
volumes:
- name: sendreceive-data
persistentVolumeClaim:
claimName: lfmerge-sendreceive-data
initContainers:
- name: initialize-volume-ownership
image: busybox:1.33
resources:
requests:
memory: 25Mi
cpu: 0.1
limits:
memory: 50Mi
command:
- 'sh'
- '-c'
Expand All @@ -112,6 +102,13 @@ spec:
- name: lfmerge
image: ghcr.io/sillsdev/lfmerge:{{VERSION_LFMERGE}}
imagePullPolicy: Always
# https://kubernetes.io/docs/concepts/configuration/manage-resources-containers
resources:
requests:
memory: 120Mi
cpu: 0.25
limits:
memory: 2.5Gi
volumeMounts:
- mountPath: /var/lib/languageforge/lexicon/sendreceive
name: sendreceive-data
Expand Down
7 changes: 7 additions & 0 deletions docker/deployment/mail-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ spec:
containers:
- name: mail
image: juanluisbaptiste/postfix:1.0.0
# https://kubernetes.io/docs/concepts/configuration/manage-resources-containers
resources:
requests:
memory: 30Mi
cpu: 0.1
limits:
memory: 100Mi
env:
- name: SERVER_HOSTNAME
value: {{SERVER_HOSTNAME}}
Expand Down
7 changes: 7 additions & 0 deletions docker/deployment/next-app-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ spec:
- name: next-app
image: sillsdev/web-languageforge:{{VERSION}}
imagePullPolicy: Always
# https://kubernetes.io/docs/concepts/configuration/manage-resources-containers
resources:
requests:
memory: 16Mi
cpu: 0.1
limits:
memory: 20Mi
env:
- name: API_HOST
value: http://app
7 changes: 7 additions & 0 deletions docker/deployment/next-proxy-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,14 @@ spec:
containers:
- name: next-proxy
image: sillsdev/web-languageforge:{{VERSION}}
# https://kubernetes.io/docs/concepts/configuration/manage-resources-containers
imagePullPolicy: Always
resources:
requests:
memory: 12Mi
cpu: 0.1
limits:
memory: 20Mi
env:
- name: LEGACY_APP
value: app:80
Expand Down
1 change: 1 addition & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ services:
- "host.docker.internal:host-gateway"
volumes:
- ../test/e2e/utils/TestControl.php:/var/www/src/Api/Service/TestControl.php
- ../test/e2e/shared-files:/tmp/e2e-shared-files

test-php:
build:
Expand Down
1 change: 1 addition & 0 deletions docker/test-php/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
cd /var/www/

# optionally add `--filter nameOfTestYouWantToRun`
# where the test name is the class name of the test group e.g. LexEntryModelTest
src/vendor/bin/phpunit --configuration test/php/phpunit.xml --log-junit PhpUnitTests.xml
15 changes: 10 additions & 5 deletions docs/DEVELOPER.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ Welcome! We're glad that you are interested in helping develop Language Forge.

## Development Environment Quick Start ##

1. Install [Docker](https://www.docker.com/get-started) (Linux users will need some additional steps, please visit https://docs.docker.com/compose/install for info on installing the engine and compose)
1. Install [Make](https://www.gnu.org/software/make/). This is actually optional but simplifies things a bit.
1. Install [Node 16.14.0](https://nodejs.org/en/download/). We recommend using a Node version manager e.g. [nvm](https://github.com/nvm-sh/nvm#installation-and-update)
1. Clone the repo: `git clone https://github.com/sillsdev/web-languageforge`
1. `cd web-languageforge/docker`
1. Install [Docker](https://www.docker.com/get-started). Linux users will need some additional steps: Please visit https://docs.docker.com/compose/install for info on installing the engine and compose. Windows users, use Ubuntu and follow these instructions -- https://docs.docker.com/engine/install/ubuntu/ -- and then, to permit specific users (and not just "sudo") to contact the Docker daemon, run `sudo usermod -aG docker $yourUsername` and `sudo chmod 666 /var/run/docker.sock`.
3. Install [Make](https://www.gnu.org/software/make/). This is actually optional but simplifies things a bit.
4. Install [Node 16.14.0](https://nodejs.org/en/download/). We recommend using a Node version manager e.g. [nvm](https://github.com/nvm-sh/nvm#installation-and-update)
5. Clone the repo: `git clone https://github.com/sillsdev/web-languageforge`
6. `cd web-languageforge/docker`

### Running the App Locally

Expand All @@ -32,6 +32,11 @@ Welcome! We're glad that you are interested in helping develop Language Forge.
>
> NOTE: disabling cache on your device may not be trivial, you'll either need to wipe the site settings on your device's browser or you'll need to do it via USB debugging.
### Running Playwright E2E Tests

1. `make playwright-tests`
2. Test results will appear in your terminal

### Running Protractor E2E Tests

1. `make e2e-tests` (⚠️ these do not work on Apple Silicon at this time)
Expand Down
Loading

0 comments on commit 904ed6e

Please sign in to comment.