Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge branch 'release/0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
CordlessWool committed Apr 7, 2020
2 parents 4ab338b + 7926cdb commit 4068efc
Show file tree
Hide file tree
Showing 74 changed files with 3,878 additions and 3,886 deletions.
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

[*.yml]
indent_style = space
indent_size = 2
6 changes: 5 additions & 1 deletion .gitattributes
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
31 changes: 31 additions & 0 deletions .pullapprove.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: 1

pullapprove_conditions:
- condition: "'WIP' not in labels"
unmet_status: pending
explanation: "Work in progress"
- condition: "'- [ ]' not in body"
unmet_status: failure
explanation: "Please finish all the required checklist tasks"

loki:
conditions:
- "'Loki' in labels"
reviews:
required: 1 # 1 approval from this group are required
request: 2 # 2 reviews requests will be sent at a time
request_order: shuffle # reviewers will be chosen in a random order
reviewers:
teams:
- loki

privacy:
conditions:
- "'*model.js' in files or 'src/services/*' not in files or 'src/utils/*' not in files'"
reviewers:
teams:
- editor-core
reviews:
required: 1 # number of approvals required from this group
request: -1 # request from all members a review
author_value: 1
73 changes: 37 additions & 36 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,47 @@
---
dist: xenial
language: node_js
node_js: '8'
node_js:
- '10.16'
branches:
only:
- develop
- master
- /^(?i:release|hotfix).*$/

sudo: required

services:
- docker
- mongodb
stages:
- test
- name: build
if: type = push && (branch = master || branch = develop || branch ~= /^(?i:release|hotfix).*$/)
- name: deploy
if: type = push && (branch = master || branch = develop || branch ~= /^(?i:release|hotfix).*$/)

env:
global:
- TZ=Europe/Berlin
- GIT_SHA=$( git rev-parse HEAD )
- DOCKERTAG=$( echo $TRAVIS_BRANCH | tr -s "[:punct:]" "-" )
- ROCKET_CHAT_URI=http://localhost:5000
cache:
directories:
- node_modules
before_install:
- openssl aes-256-cbc -K $encrypted_2709882c490b_key -iv $encrypted_2709882c490b_iv -in travis_rsa.enc -out travis_rsa -d
script:
- npm test
#- export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi)
- DOCKERTAG="$( echo $TRAVIS_BRANCH | tr -s '[:punct:]' '-' | tr -s '[:upper:]' '[:lower:]' )_v$( jq -r '.version' package.json )_$TRAVIS_COMMIT"

after_success:
#- bash <(curl -s https://codecov.io/bash)
#- bash <(curl -X POST --data "apiKey=$apiKey&branch=$BRANCH" http://$url/update)
jobs:
include:
- stage: test
name: test:mocha
script: npm run test
services:
- mongodb
- redis-server
env:
- REDIS_URI=redis://localhost:6379

after_success:
# because Skipping a deployment with the script provider because the current build is a pull request.
- bash ./deploy.sh
# Build Docker Images
- stage: build
name: build
language: generic
script: bash ./deploy/build.sh

deploy:
provider: script
script: bash ./deploy.sh
on:
all_branches: true
condition: $TRAVIS_BRANCH =~ ^development|N21/merge$
# Deploy
- stage: deploy
name: deploy
language: generic
script: bash ./deploy/deploy.sh

notifications:
slack:
rooms:
- secure: JpP7zgvDI9n/VBnply1c/RhCDUi3htY9jFo/MVfzIgzP1ngxoayHvo+T9gWhTfUHnwak4wu4RRH7Scw7YCyInS9lhFmUG/9MB/rgKpVUKrb+pyfAtmZogyyt5q7pwQmxuOH44dvQqNs78eg3E47fejyvfsOnt9ne1uCF9Ry2LkXHJ/c5cXA8BroVh6vg1M50Ny0Kayx/hpO2f8Oj38vEh4l4KmEcbNPZyZ9cQ4yJjm1hj7zMpG+k1J0BOmN+juNU7aDLAwPP2XP/mG8346E47xZShbkQq+bNZfUUI39GyVY7p2bCePzo5fuzVvQfSYiXlNDvztDdLxJ+XiQJe2ashQUzkQuIyfAfEVQEmRqG5W+2mZ2iQoAvuK4So5QgoUUD3b2d4osiwOQqYaJmHihc6MxT/05hdbM79i+rCEViuuG62LJ3gbRO+PDMZwplv9ArvIRKsh5Tgx6BOYfadDASB2muWx/AhvIhudZOTZjBYc8msvWGKu2fvYL4HbS15C4oh1nxgccDo2PoOJSyZOhFb9BEvTAFe+qDkpk9lmSHw6FNzDIMkv64Z8CqHn3fLkJwsCjsYJLOOSYv28S7anx66KeJwRR7+0DTWlbjBwftyiG+KhHghUF2rYiRiBGmaSSnXFD9X9s0PBl/fwGkkvrclM5vykZ26iPtwv5a36T0t7Q=
on_success: change
on_failure: always
on_pull_requests: false
cache: npm
25 changes: 25 additions & 0 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Checkliste

- Bis die komplette Checkliste abgearbeitet ist muss das PR-Label WIP gesetzt sein

## Allgemein
- [ ] Links zu verwandten PRs anderer Repositories
- https://github.com/schul-cloud/edtrio/pull/????
- Im Ticket (oder PR, wenn kein Ticket): Beschreibung und Begründung der Änderung/Neuerungen
- [ ] Link zum Ticket https://ticketsystem.schul-cloud.org/browse/SC-????

## Code Qualität
- [ ] Code mit Hinblick auf Security und Datensicherheit betrachten
- [ ] Linter darf keine Probleme bei veränderten Dateien aufweisen

## Tests
- [ ] Test-Coverage darf durch PR nicht sinken
- [ ] Unit-Tests und Integrations-Tests schreiben / ändern
- [ ] Keine offenen bekannten Bugs im entwickelten Code

## Freigabe zum Review
- [ ] Die Änderungen wurden mit dem Ticket-Ersteller, Support-Team oder PO besprochen und erfüllen die Ticket-Anforderungen
- [ ] WIP PR-Label entfernt, wenn die Checkliste abgearbeitet wurde

## Mehr
Weitere Informationen zur DoD [hier im Confluence](https://docs.schul-cloud.org/pages/viewpage.action?pageId=92831762)
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# schulcloud-editor

[![Greenkeeper badge](https://badges.greenkeeper.io/schul-cloud/schulcloud-editor.svg)](https://greenkeeper.io/)

MicroService for editor documents.


Expand All @@ -11,6 +14,8 @@ MicroService for editor documents.
- MONGO_URI (required)
- DB_USERNAME (optional)
- DB_PASSWORD (optional)
- SC_DOMAIN (optional)
- EDITOR_BACKEND_SENTRY_DSN (optional)

- TEST_SECRET (optional for tests)

Expand Down
34 changes: 18 additions & 16 deletions config/default.json
Original file line number Diff line number Diff line change
@@ -1,16 +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"
}
{
"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"
}
26 changes: 13 additions & 13 deletions config/production.json
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"
}
10 changes: 10 additions & 0 deletions deploy/Dockerfile
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
52 changes: 52 additions & 0 deletions deploy/build.sh
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
15 changes: 15 additions & 0 deletions deploy/buildAndDeployFilter.sh
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
}
4 changes: 4 additions & 0 deletions deploy/decryptSecrets.sh
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
Loading

0 comments on commit 4068efc

Please sign in to comment.