diff --git a/.basic-auth-code b/.basic-auth-code new file mode 100644 index 0000000..6f80b13 --- /dev/null +++ b/.basic-auth-code @@ -0,0 +1 @@ +code:$apr1$AeePIAei$E9E6E6jtFFtwmtGhIEG.Y/ \ No newline at end of file diff --git a/.basic-auth-web b/.basic-auth-web new file mode 100644 index 0000000..c92b939 --- /dev/null +++ b/.basic-auth-web @@ -0,0 +1,2 @@ +code:$apr1$AeePIAei$E9E6E6jtFFtwmtGhIEG.Y/ +web:$apr1$/zc/TBtD$ZGr3RqPiULYMD0kJUup5E0 \ No newline at end of file diff --git a/.env b/.env new file mode 100644 index 0000000..f008d5d --- /dev/null +++ b/.env @@ -0,0 +1,3 @@ +PROJECT_NAME=tibi-svelte-starter +TIBI_PREFIX=tibi +TIBI_NAMESPACE=__NAMESPACE__ diff --git a/.gitignore b/.gitignore index 9780e8f..1acf539 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ cypress/screenshots .~lock.* coverage/ .nyc_output/ +/tmp/ \ No newline at end of file diff --git a/.yarn/install-state.gz b/.yarn/install-state.gz index 194704c..52921cc 100644 Binary files a/.yarn/install-state.gz and b/.yarn/install-state.gz differ diff --git a/README.md b/README.md index 797c3a4..a0b3ecc 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,18 @@ Via Svelte wird eine SPA (Single-Page-App) programmiert. Dazu wird der Code einm Die Navigation innerhalb der APP im Browser löst dagegen nur API-Aufrufe aus ohne jedesmal einen SSR-Prozess anzustoßen. Um die SSR-Last so gering wie möglich zu halten, wurde ein Caching in der "ssr"-Collection der API implementiert. + ## Toolchain + +### git + +nach `git clone ...` + +```sh +git lfs install +git lfs pull +``` + ### Abhängigkeiten laden ```sh @@ -34,6 +45,12 @@ API_BASE=https://login.tibicms.de/api/v1_/__NAMESPACE__ yarn start yarn dev ``` +### Entwickeln auf dem Code-Server mit Docker Compose Stack + +``` +yarn docker:start +``` + ### Testen ```sh diff --git a/docker-compose-local.yml b/docker-compose-local.yml new file mode 100644 index 0000000..0e18c1a --- /dev/null +++ b/docker-compose-local.yml @@ -0,0 +1,113 @@ +version: "3.8" +name: tibi-svelte-starter-local + +services: + yarnstart: + image: node:18 + volumes: + - ./:/data + command: sh -c "cd /data && yarn install && API_BASE=http://tibiserver:8080/api/v1/_/${TIBI_NAMESPACE} yarn start" + # ports: + # - ${PORT:-3000}:3000 + # - ${BROWSERSYNC_PORT:-4001}:3001 + expose: + - 3000 + networks: + - default + - traefik_web + labels: + - traefik.enable=true + - online.testversion.code.subdomain=${PROJECT_NAME} + - traefik.http.routers.${PROJECT_NAME}-yarnstart.middlewares=${PROJECT_NAME}-yarnstart + - traefik.http.middlewares.${PROJECT_NAME}-yarnstart.basicauth.usersfile=${PWD}/.basic-auth-web + + tibiserver: + image: gitbase.de/cms/tibi-server + volumes: + - ./:/data + environment: + # DB_DIAL: mongodb://root:root@mongo/admin + DB_DIAL: mongodb://mongo + DB_PREFIX: ${TIBI_PREFIX} + MAIL_HOST: maildev:25 + depends_on: + - mongo + + tibiadmin: + image: gitbase.de/cms/tibi-admin + environment: + INDEX: spa.html + WEBROOT: /data + API: /api:http://tibiserver:8080/api/v1 + PORT: 80 + depends_on: + - tibiserver + # ports: + # - ${ADMIN_PORT:-3002}:80 + expose: + - 80 + networks: + - default + - traefik_web + labels: + - traefik.enable=true + - online.testversion.code.subdomain=${PROJECT_NAME}-tibiadmin + - traefik.http.routers.${PROJECT_NAME}-tibiadmin.middlewares=${PROJECT_NAME}-tibiadmin + - traefik.http.middlewares.${PROJECT_NAME}-tibiadmin.basicauth.usersfile=${PWD}/.basic-auth-code + + mongo: + image: gitbase.de/server/mongo:4.2 + volumes: + - ./tmp/mongo-data:/data/db + # command: mongod --logpath=/dev/null + # environment: + # MONGO_INITDB_ROOT_USERNAME: root + # MONGO_INITDB_ROOT_PASSWORD: root + + # adminder: + # image: gitbase.de/server/adminer + # ports: + # - ${PORT:-18080}:8080 + + adminmongo: + image: gitbase.de/server/adminmongo + environment: + CONN_NAME: mongo + # DB_USERNAME: root + # DB_PASSWORD: root + DB_HOST: mongo + PORT: 1234 + # ports: + # - ${ADMINMONGO_PORT:-3003}:1234 + expose: + - 1234 + networks: + - default + - traefik_web + labels: + - traefik.enable=true + - online.testversion.code.subdomain=${PROJECT_NAME}-adminmongo + - traefik.http.routers.${PROJECT_NAME}-adminmongo.middlewares=${PROJECT_NAME}-adminmongo + - traefik.http.middlewares.${PROJECT_NAME}-adminmongo.basicauth.usersfile=${PWD}/.basic-auth-code + + maildev: + image: maildev/maildev + restart: always + # ports: + # - ${MAILDEV_PORT:-3004}:80 + command: node bin/maildev --web 1080 --smtp 25 -v --hide-extensions=STARTTLS + expose: + - 1080 + networks: + - default + - traefik_web + labels: + - traefik.enable=true + - online.testversion.code.subdomain=${PROJECT_NAME}-maildev + - traefik.http.services.${PROJECT_NAME}-maildev.loadbalancer.server.port=1080 + - traefik.http.routers.${PROJECT_NAME}-maildev.middlewares=${PROJECT_NAME}-maildev + - traefik.http.middlewares.${PROJECT_NAME}-maildev.basicauth.usersfile=${PWD}/.basic-auth-code + +networks: + traefik_web: + external: true diff --git a/package.json b/package.json index bbf8db4..ae3aaaf 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,11 @@ "validate": "svelte-check && tsc --noEmit", "start": "NAMESPACE=__NAMESPACE__ node scripts/esbuild-wrapper.js start", "start:remoteapi": "API_BASE=https://login.tibicms.de/api/v1/_/__NAMESPACE__ node scripts/esbuild-wrapper.js start", + "docker:start": "docker compose -f docker-compose-local.yml up; docker compose -f docker-compose-local.yml down", + "docker:up": "docker compose -f docker-compose-local.yml up -d", + "docker:down": "docker compose -f docker-compose-local.yml down", + "docker:logs": "docker compose -f docker-compose-local.yml logs -f", + "docker:yarnupgrade": "docker compose -f docker-compose-local.yml run --rm yarnstart sh -c 'cd /data && yarn upgrade-interactive'", "dev": "node scripts/esbuild-wrapper.js watch", "build": "node scripts/esbuild-wrapper.js build", "build:legacy": "node scripts/esbuild-wrapper.js build esbuild.config.legacy.js && babel _temp/index.js -o _temp/index.babeled.js && esbuild _temp/index.babeled.js --outfile=dist/_dist_/index.es5.js --target=es5 --bundle --minify --sourcemap",