This repository has been archived by the owner on Nov 3, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/SC-3505/add-attachment-service
- Loading branch information
Showing
16 changed files
with
278 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
config/secrets.json filter=git-crypt diff=git-crypt | ||
backup/setup/*.secrets.json filter=git-crypt diff=git-crypt | ||
backup/setup/*.secrets.json filter=git-crypt diff=git-crypt | ||
|
||
# Fix end-of-lines in Git versions older than 2.10 | ||
# https://github.com/git/git/blob/master/Documentation/RelNotes/2.10.0.txt#L248 | ||
* text=auto eol=lf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
{ | ||
"host": "localhost", | ||
"port": 4001, | ||
"protocol": "http", | ||
"mongodb": "mongodb://localhost:27017/schulcloud-editor", | ||
"routes": { | ||
"server": { | ||
"baseURL": "http://localhost:3030", | ||
"coursePermissionsUri": "/courses/:courseId/userPermissions", | ||
"meUri": "/me", | ||
"courseMembersUri": "/courses/:courseId/members" | ||
}, | ||
"timeout": "30000" | ||
}, | ||
"testsecret": "secret", | ||
"redis": "REDIS_URI" | ||
} | ||
{ | ||
"host": "localhost", | ||
"port": 4001, | ||
"protocol": "http", | ||
"mongodb": "mongodb://localhost:27017/schulcloud-editor", | ||
"routes": { | ||
"server": { | ||
"baseURL": "http://localhost:3030", | ||
"coursePermissionsUri": "/courses/:courseId/userPermissions", | ||
"meUri": "/me", | ||
"courseMembersUri": "/courses/:courseId/members" | ||
}, | ||
"timeout": "30000" | ||
}, | ||
"testsecret": "secret", | ||
"redis": "REDIS_URI", | ||
"redis_key": "REDIS_KEY" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
{ | ||
"host": "localhost", | ||
"port": "PORT", | ||
"protocol": "http", | ||
"mongodb": "MONGO_URI", | ||
"routes": { | ||
"server": { | ||
"baseURL": "SERVER_API_URL" | ||
}, | ||
"timeout": "TIMEOUT" | ||
}, | ||
"testsecret": "TESTSECRET" | ||
} | ||
{ | ||
"host": "localhost", | ||
"port": "PORT", | ||
"protocol": "http", | ||
"mongodb": "MONGO_URI", | ||
"routes": { | ||
"server": { | ||
"baseURL": "SERVER_API_URL" | ||
}, | ||
"timeout": "TIMEOUT" | ||
}, | ||
"testsecret": "TESTSECRET" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM node:lts as builder | ||
RUN mkdir /app && chown -R node:node /app | ||
WORKDIR '/app' | ||
COPY ./package.json ./ | ||
COPY ./package-lock.json ./ | ||
USER node | ||
RUN npm ci --only=production | ||
COPY --chown=node:node . /app/ | ||
EXPOSE 4001 | ||
CMD npm run start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#! /bin/bash | ||
|
||
# ---------------- | ||
# DECLERATIONS | ||
# ---------------- | ||
|
||
set -e # fail with exit 1 on any error | ||
|
||
echo "DOCKERTAG" $DOCKERTAG | ||
echo "GITSHA" $GIT_SHA | ||
|
||
# ---------------- | ||
# SCRIPTS | ||
# ---------------- | ||
|
||
dockerPush(){ | ||
# $1: Project Name | ||
# $2: docker tag to use | ||
|
||
# Log in to the docker CLI | ||
echo "$MY_DOCKER_PASSWORD" | docker login -u "$DOCKER_ID" --password-stdin | ||
|
||
# Push Image | ||
docker push schulcloud/schulcloud-$1:$2 | ||
} | ||
|
||
# BUILD SCRIPTS | ||
|
||
buildeditor(){ | ||
docker build \ | ||
-t schulcloud/schulcloud-editor:$DOCKERTAG \ | ||
-t schulcloud/schulcloud-editor:$GIT_SHA \ | ||
-f Dockerfile \ | ||
../ | ||
|
||
dockerPush "editor" $DOCKERTAG | ||
dockerPush "editor" $GIT_SHA | ||
} | ||
|
||
# ---------------- | ||
# MAIN SCRIPT | ||
# ---------------- | ||
cd deploy | ||
|
||
source ./buildAndDeployFilter.sh | ||
buildAndDeployFilter | ||
|
||
bash ./decryptSecrets.sh | ||
|
||
buildeditor | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#! /bin/bash | ||
|
||
buildAndDeployFilter () { | ||
if [ "$TRAVIS_PULL_REQUEST" != "false" ] | ||
then | ||
echo "Pull Requests are not build/deployed. (Pull #$TRAVIS_PULL_REQUEST)" | ||
exit 0 | ||
fi | ||
|
||
if ! [[ $TRAVIS_BRANCH = master || $TRAVIS_BRANCH = develop || $TRAVIS_BRANCH = release* || $TRAVIS_BRANCH = hotfix* ]] | ||
then | ||
echo "Branch $TRAVIS_BRANCH is not supposed to be build/deployed.". | ||
exit 0 | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
echo "decrypt secrets" | ||
|
||
openssl aes-256-cbc -K $encrypted_dd6f15d73ffd_key -iv $encrypted_dd6f15d73ffd_iv -in travis_rsa.enc -out travis_rsa -d | ||
chmod 600 travis_rsa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#! /bin/bash | ||
|
||
# ---------------- | ||
# DECLERATIONS | ||
# ---------------- | ||
|
||
set -e # fail with exit 1 on any error | ||
|
||
# ---------------- | ||
# SCRIPTS | ||
# ---------------- | ||
|
||
inform_live() { | ||
# $1: Project Name (client, storybook, vuepress) | ||
if [[ "$TRAVIS_EVENT_TYPE" != "cron" ]] | ||
then | ||
curl -X POST -H 'Content-Type: application/json' --data '{"text":":rocket: Die Produktivsysteme können aktualisiert werden: Schul-Cloud editor! Dockertag: '$DOCKERTAG'"}' $WEBHOOK_URL_CHAT | ||
fi | ||
} | ||
|
||
inform_staging() { | ||
if [[ "$TRAVIS_EVENT_TYPE" != "cron" ]] | ||
then | ||
curl -X POST -H 'Content-Type: application/json' --data '{"text":":boom: Das Staging-System wurde aktualisiert: Schul-Cloud editor! (Dockertag: '$DOCKERTAG')"}' $WEBHOOK_URL_CHAT | ||
fi | ||
} | ||
|
||
deploy(){ | ||
SYSTEM=$1 # [staging, test, demo] | ||
|
||
DOCKER_IMAGE=$2 # (editor), autoprefixed with "schulcloud-" | ||
DOCKER_TAG=$3 # version/tag of the image to use. Usually the branch name or a GIT_SHA | ||
DOCKER_SERVICE_NAME=$4 # docker service name on server | ||
|
||
echo "deploy " $DOCKER_IMAGE ":" $DOCKER_TAG " to " $SYSTEM " as " $DOCKER_SERVICE_NAME | ||
|
||
# deploy new dockerfile | ||
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -i travis_rsa linux@$SYSTEM.schul-cloud.org /usr/bin/docker service update --force --image schulcloud/schulcloud-$DOCKER_IMAGE:$DOCKER_TAG $DOCKER_SERVICE_NAME | ||
} | ||
|
||
# ---------------- | ||
# MAIN SCRIPT | ||
# ---------------- | ||
cd deploy | ||
|
||
source ./buildAndDeployFilter.sh | ||
buildAndDeployFilter | ||
|
||
bash ./decryptSecrets.sh | ||
|
||
echo "DOCKERTAG" $DOCKERTAG | ||
|
||
if [ -z "$DOCKERTAG" ]; | ||
then | ||
echo "DOCKERTAG env is missing. Abort deployment." | ||
exit 1; | ||
fi | ||
|
||
|
||
case "$TRAVIS_BRANCH" in | ||
|
||
master) | ||
inform_live | ||
;; | ||
|
||
develop) | ||
echo "develop" | ||
# deploy $SYSTEM $DOCKERFILE $DOCKERTAG $DOCKER_SERVICENAME $COMPOSE_DUMMY $COMPOSE_FILE $COMPOSE_SERVICENAME | ||
deploy "test" "editor" $DOCKERTAG "test-schul-cloud_editor" | ||
;; | ||
release* | hotfix*) | ||
echo "release/hotfix" | ||
deploy "staging" "editor" $DOCKERTAG "staging_editor" | ||
;; | ||
esac | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
version: "3.7" | ||
|
||
# example compose file | ||
|
||
services: | ||
editor-mongodb: | ||
image: mongo:4.2 | ||
deploy: | ||
replicas: 1 | ||
restart_policy: | ||
condition: always | ||
ports: | ||
- 27017:27017 | ||
volumes: | ||
- data-editor-mongodb:/data/db | ||
restart: unless-stopped | ||
|
||
redis: | ||
image: redis:5.0.3 | ||
|
||
schulcloud-editor: | ||
build: | ||
context: ../ | ||
dockerfile: deploy/Dockerfile | ||
environment: | ||
- NODE_ENV=production | ||
- MONGO_URI=mongodb://editor-mongodb:27017/schulcloud-editor | ||
- PORT=4101 | ||
- SERVER_API_URL=http://server:3030 | ||
- TIMEOUT=30000 | ||
- REDIS_URI=redis://redis:6379 | ||
- REDIS_KEY=schulcloud-editor-sync | ||
ports: | ||
- 4101:4101 | ||
depends_on: | ||
- editor-mongodb | ||
- redis | ||
restart: unless-stopped | ||
|
||
volumes: | ||
data-editor-mongodb: |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters