diff --git a/.gitea/actions/init-db/mongo-dump/mongo-dump/admin/system.version.bson b/.gitea/actions/init-db/mongo-dump/mongo-dump/admin/system.version.bson new file mode 100644 index 0000000..1d05d10 Binary files /dev/null and b/.gitea/actions/init-db/mongo-dump/mongo-dump/admin/system.version.bson differ diff --git a/.gitea/actions/init-db/mongo-dump/mongo-dump/admin/system.version.metadata.json b/.gitea/actions/init-db/mongo-dump/mongo-dump/admin/system.version.metadata.json new file mode 100644 index 0000000..6f50fa6 --- /dev/null +++ b/.gitea/actions/init-db/mongo-dump/mongo-dump/admin/system.version.metadata.json @@ -0,0 +1 @@ +{"options":{},"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_","ns":"admin.system.version"}],"uuid":"c25383adb2a64a8ca31b3bc5cbcb6690"} \ No newline at end of file diff --git a/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi/project.bson b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi/project.bson new file mode 100644 index 0000000..6b97591 Binary files /dev/null and b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi/project.bson differ diff --git a/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi/project.metadata.json b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi/project.metadata.json new file mode 100644 index 0000000..f315c1f --- /dev/null +++ b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi/project.metadata.json @@ -0,0 +1 @@ +{"options":{},"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_","ns":"tibi.project"},{"v":{"$numberInt":"2"},"key":{"insertTime":{"$numberInt":"1"}},"name":"insertTime_1","ns":"tibi.project"},{"v":{"$numberInt":"2"},"key":{"updateTime":{"$numberInt":"1"}},"name":"updateTime_1","ns":"tibi.project"},{"v":{"$numberInt":"2"},"unique":true,"key":{"name":{"$numberInt":"1"}},"name":"name_1","ns":"tibi.project"},{"v":{"$numberInt":"2"},"key":{"_fts":"text","_ftsx":{"$numberInt":"1"}},"name":"textindex","ns":"tibi.project","weights":{"name":{"$numberInt":"1"}},"default_language":"german","language_override":"language","textIndexVersion":{"$numberInt":"3"}}],"uuid":"a0a6733bdb52400f9f3b17985bc28bcc"} \ No newline at end of file diff --git a/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi/user.bson b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi/user.bson new file mode 100644 index 0000000..cc6ba71 Binary files /dev/null and b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi/user.bson differ diff --git a/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi/user.metadata.json b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi/user.metadata.json new file mode 100644 index 0000000..6e2b321 --- /dev/null +++ b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi/user.metadata.json @@ -0,0 +1 @@ +{"options":{},"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_","ns":"tibi.user"},{"v":{"$numberInt":"2"},"key":{"insertTime":{"$numberInt":"1"}},"name":"insertTime_1","ns":"tibi.user"},{"v":{"$numberInt":"2"},"key":{"updateTime":{"$numberInt":"1"}},"name":"updateTime_1","ns":"tibi.user"},{"v":{"$numberInt":"2"},"unique":true,"key":{"username":{"$numberInt":"1"}},"name":"username_1","ns":"tibi.user"},{"v":{"$numberInt":"2"},"key":{"_fts":"text","_ftsx":{"$numberInt":"1"}},"name":"textindex","ns":"tibi.user","weights":{"$**":{"$numberInt":"1"}},"default_language":"german","language_override":"language","textIndexVersion":{"$numberInt":"3"}}],"uuid":"ba627bbd4ac24b3ca92aebdc33b7d4b0"} \ No newline at end of file diff --git a/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/backups.bson b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/backups.bson new file mode 100644 index 0000000..e69de29 diff --git a/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/backups.metadata.json b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/backups.metadata.json new file mode 100644 index 0000000..b4e6af2 --- /dev/null +++ b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/backups.metadata.json @@ -0,0 +1 @@ +{"options":{},"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_","ns":"tibi_allkids_erfurt.backups"},{"v":{"$numberInt":"2"},"key":{"insertTime":{"$numberInt":"1"}},"name":"insertTime_1","ns":"tibi_allkids_erfurt.backups"},{"v":{"$numberInt":"2"},"key":{"updateTime":{"$numberInt":"1"}},"name":"updateTime_1","ns":"tibi_allkids_erfurt.backups"}],"uuid":"4993cf280e844b5b80fe208350713002"} \ No newline at end of file diff --git a/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/banner.bson b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/banner.bson new file mode 100644 index 0000000..1d6ff5c Binary files /dev/null and b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/banner.bson differ diff --git a/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/banner.metadata.json b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/banner.metadata.json new file mode 100644 index 0000000..3ca715a --- /dev/null +++ b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/banner.metadata.json @@ -0,0 +1 @@ +{"options":{},"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_","ns":"tibi_allkids_erfurt.banner"},{"v":{"$numberInt":"2"},"key":{"insertTime":{"$numberInt":"1"}},"name":"insertTime_1","ns":"tibi_allkids_erfurt.banner"},{"v":{"$numberInt":"2"},"key":{"updateTime":{"$numberInt":"1"}},"name":"updateTime_1","ns":"tibi_allkids_erfurt.banner"}],"uuid":"7346de51448b4a27b289a0e32336d0b6"} \ No newline at end of file diff --git a/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/content.bson b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/content.bson new file mode 100644 index 0000000..e9516a0 Binary files /dev/null and b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/content.bson differ diff --git a/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/content.metadata.json b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/content.metadata.json new file mode 100644 index 0000000..89dbd19 --- /dev/null +++ b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/content.metadata.json @@ -0,0 +1 @@ +{"options":{},"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_","ns":"tibi_allkids_erfurt.content"},{"v":{"$numberInt":"2"},"key":{"insertTime":{"$numberInt":"1"}},"name":"insertTime_1","ns":"tibi_allkids_erfurt.content"},{"v":{"$numberInt":"2"},"key":{"updateTime":{"$numberInt":"1"}},"name":"updateTime_1","ns":"tibi_allkids_erfurt.content"},{"v":{"$numberInt":"2"},"key":{"meta.datum":{"$numberInt":"1"}},"name":"meta.datum_1","ns":"tibi_allkids_erfurt.content"}],"uuid":"df9951d7cf964e5e8a22360c09aa27c7"} \ No newline at end of file diff --git a/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/forms.bson b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/forms.bson new file mode 100644 index 0000000..ae99fa2 Binary files /dev/null and b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/forms.bson differ diff --git a/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/forms.metadata.json b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/forms.metadata.json new file mode 100644 index 0000000..98325ff --- /dev/null +++ b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/forms.metadata.json @@ -0,0 +1 @@ +{"options":{},"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_","ns":"tibi_allkids_erfurt.forms"},{"v":{"$numberInt":"2"},"key":{"insertTime":{"$numberInt":"1"}},"name":"insertTime_1","ns":"tibi_allkids_erfurt.forms"},{"v":{"$numberInt":"2"},"key":{"updateTime":{"$numberInt":"1"}},"name":"updateTime_1","ns":"tibi_allkids_erfurt.forms"}],"uuid":"7815c4dfc9d9460c8aac8cf94cc67ea6"} \ No newline at end of file diff --git a/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/navigation.bson b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/navigation.bson new file mode 100644 index 0000000..8a37f2a Binary files /dev/null and b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/navigation.bson differ diff --git a/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/navigation.metadata.json b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/navigation.metadata.json new file mode 100644 index 0000000..1f57bf0 --- /dev/null +++ b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/navigation.metadata.json @@ -0,0 +1 @@ +{"options":{},"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_","ns":"tibi_allkids_erfurt.navigation"},{"v":{"$numberInt":"2"},"key":{"insertTime":{"$numberInt":"1"}},"name":"insertTime_1","ns":"tibi_allkids_erfurt.navigation"},{"v":{"$numberInt":"2"},"key":{"updateTime":{"$numberInt":"1"}},"name":"updateTime_1","ns":"tibi_allkids_erfurt.navigation"}],"uuid":"d989bd0ea7ba4ea4ae728b8a6baa62ba"} \ No newline at end of file diff --git a/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/ssr.bson b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/ssr.bson new file mode 100644 index 0000000..f1cadf7 Binary files /dev/null and b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/ssr.bson differ diff --git a/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/ssr.metadata.json b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/ssr.metadata.json new file mode 100644 index 0000000..420de04 --- /dev/null +++ b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/ssr.metadata.json @@ -0,0 +1 @@ +{"options":{},"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_","ns":"tibi_allkids_erfurt.ssr"},{"v":{"$numberInt":"2"},"key":{"insertTime":{"$numberInt":"1"}},"name":"insertTime_1","ns":"tibi_allkids_erfurt.ssr"},{"v":{"$numberInt":"2"},"key":{"updateTime":{"$numberInt":"1"}},"name":"updateTime_1","ns":"tibi_allkids_erfurt.ssr"},{"v":{"$numberInt":"2"},"unique":true,"key":{"path":{"$numberInt":"1"}},"name":"path_1","ns":"tibi_allkids_erfurt.ssr"}],"uuid":"75869e19f8164beabe53366265b10208"} \ No newline at end of file diff --git a/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/temperature.bson b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/temperature.bson new file mode 100644 index 0000000..e69de29 diff --git a/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/temperature.metadata.json b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/temperature.metadata.json new file mode 100644 index 0000000..308a315 --- /dev/null +++ b/.gitea/actions/init-db/mongo-dump/mongo-dump/tibi_allkids_erfurt/temperature.metadata.json @@ -0,0 +1 @@ +{"options":{},"indexes":[{"v":{"$numberInt":"2"},"key":{"_id":{"$numberInt":"1"}},"name":"_id_","ns":"tibi_allkids_erfurt.temperature"},{"v":{"$numberInt":"2"},"key":{"insertTime":{"$numberInt":"1"}},"name":"insertTime_1","ns":"tibi_allkids_erfurt.temperature"},{"v":{"$numberInt":"2"},"key":{"updateTime":{"$numberInt":"1"}},"name":"updateTime_1","ns":"tibi_allkids_erfurt.temperature"}],"uuid":"eb60c1bc334c4fa2a473fdb6c99b3e6a"} \ No newline at end of file diff --git a/.gitea/workflows/deploy.yaml b/.gitea/workflows/deploy.yaml index dcde9ec..a330c5f 100644 --- a/.gitea/workflows/deploy.yaml +++ b/.gitea/workflows/deploy.yaml @@ -5,18 +5,22 @@ jobs: lighthouse-evaluation: runs-on: ubuntu-latest container: - image: ubuntu-latest + image: gitbase.de/actions/ubuntu:latest + volumes: + - /data:/data services: mongo: image: mongo:4.2 ports: - 27017:27017 + options: --name mongo maildev: image: gitbase.de/robin/maildev:latest ports: - 80:80 - 25:25 + options: --name maildev tibi-server: image: gitbase.de/cms/tibi-server @@ -29,34 +33,169 @@ jobs: SECURITY_ALLOWABSOLUTEPATHS: "true" SECURITY_ALLOWUPPERPATHS: "true" SECURITY_ALLOWRELATIVEPATHS: "true" + options: --name tibi-server + volumes: + - ${{ github.workspace }}:/repo live-server: - image: gitbase.de/robin/live-server:latest + image: gitbase.de/robin/apache-image:latest ports: - - 8081:8081 + - 8081:80 + volumes: + - ${{ github.workspace }}/frontend:/usr/local/apache2/htdocs/ + options: --name live-server + steps: - - name: Checkout code - uses: actions/checkout@v3 - - - name: Set up Node.js - uses: actions/setup-node@v2 + - uses: actions/checkout@v3 with: - node-version: "20" + fetch-depth: 0 - - name: Load .env file - run: | - set -a - source .env - set +a + - name: setup node 18 + uses: actions/setup-node@v3 - name: Initialize database - run: node /.gitea/actions/init-db + uses: ./.github/actions/init-db + with: + TIBI_API_NAMESPACE: allkids_erfurt + TIBI_API_CONFIG_PATH: /repo/api/config.yml + PROJECT_NAME: AllKids + + - name: SERVICE RESTART + uses: docker://docker + with: + args: docker restart live-server tibi-server mongo maildev + + - name: Cache node modules + uses: actions/cache@v3 + with: + path: | + .yarn/cache + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: setup yarn + run: | + corepack enable + corepack prepare yarn@3.2.4 --activate + yarn install + + - name: modify config + run: | + sed -i 's#\(sentryEnvironment.*\)".*"#\1"${GITHUB_REF_NAME}"#g' frontend/src/config.ts + sed -i 's#//\( sentry\\.init.*\)#\1#g' frontend/src/config.ts + export $(cat .env | xargs) + echo "PROJECT_RELEASE=${RELEASE_PROJECT_SLUG}.r`git rev-list HEAD --count`-`git describe --all --long | sed 's+/+-+'`" >> .env + export $(cat .env | xargs) + echo ______ .env ______ + cat .env + echo + sed -i 's#\(const release = \).*#\1"'${PROJECT_RELEASE}'"#g' api/hooks/config-client.js + + # bash scripts/preload-meta.sh frontend/spa.html + # bash scripts/preload-meta.sh frontend/spa.html > frontend/_spa.html + # cp frontend/_spa.html frontend/spa.html + + export stamp=`date +%s` + sed -i s/__TIMESTAMP__/$stamp/g frontend/spa.html + # sed -i s/__TIMESTAMP__/$stamp/g frontend/serviceworker.js + # cat frontend/serviceworker.js + # rm api/templates/spa.html + # cp frontend/spa.html api/templates/spa.html + echo ______ frontend/spa.html ______ + cat frontend/spa.html + + - name: build env: - PROJECT_API_NAMESPACE: $TIBI_NAMESPACE - MONGODB_URI: mongodb://mongo #service name! - TIBI_DB_PREFIX: $TIBI_PREFIX - TIBI_API_URL: http://tibi-server:8080/api/v1 - + FORCE_COLOR: "true" + run: | + yarn build + + - name: build ssr + env: + FORCE_COLOR: "true" + run: | + yarn build:server + + #- name: Load .env file + # run: | + # set -a + # source .env + # set + a + + - name: SERVICE RESTART + uses: docker://docker + with: + args: docker restart live-server tibi-server + + - name: wait for boot + run: | + sleep 15 + + - name: Inspect Service Containers + run: | + for container_id in $(docker ps --format '{{.ID}}'); do + echo "::group:: Container logs:" + docker logs $container_id || true + echo "::endgroup::" + done + #- name: Wait for Live Server + # run: | + # attempts=0 + # max_attempts=5 + # same port since its inside the same network, so not 8081.... + # while ! curl --fail "http://live-server:80"; do + # if [ $attempts -eq $max_attempts ]; then + # echo "Live server not ready after $max_attempts attempts" + # echo "${{ toJson(job) }}" + # curl -v "http://live-server:80" || true + # echo "::group::liveserver logs" + # docker logs live-server + # echo "::endgroup::" + # echo "::group:: tibi-server logs" + # docker logs tibi-server + # echo "::endgroup::" + # echo "::group:: tibi-server curl" + # docker exec live-server cat /var/log/apache2/access.log || true + # docker exec live-server bash -c "apt-get update && apt-get install -y curl" + # docker exec live-server echo $PATH + # docker exec live-server bash -c 'curl -v "http://tibi-server:8080/api/v1/_/allkids_erfurt/ssr?token=owshwerNwoa&url=/noindex"' + # echo "::endgroup::" + # exit 1 + # fi + # attempts=$((attempts+1)) + # echo "Waiting for live-server to be ready... attempt $attempts" + # sleep 5 + # done + + - name: Test HTTP Request + run: | + curl -v http://live-server:80 + + - name: Install Chrome + run: | + wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add - + sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list' + + sudo apt-get update + sudo apt-get install -y google-chrome-stable + + # Lighthouse Analysis Step + - name: Lighthouse Analysis + run: | + yarn add lighthouse + npx lighthouse http://live-server:80 --output json --output-path /tmp/lighthouse-report.json --chrome-flags="--headless --no-sandbox --disable-dev-shm-usage" + + # Notify-Lighthouse Step + - name: Notify Lighthouse + run: | + docker run --rm \ + -e PLUGIN_FROM=noreply@gitbase.de \ + -e PLUGIN_HOST=smtp.basehosts.de \ + -e PLUGIN_RECIPIENT=binkrassdufass@gmail.com \ + -e PLUGIN_SUBJECT="Lighthouse Report" \ + -v ${{ github.workspace }}/tmp:/lighthouse-reports \ + drillster/drone-email /tmp/lighthouse-report.json deploy: name: deploy