docker:start

This commit is contained in:
Sebastian Frank 2022-09-15 15:56:54 +00:00
parent fef4d3b023
commit ac7eec418c
8 changed files with 142 additions and 0 deletions

1
.basic-auth-code Normal file
View File

@ -0,0 +1 @@
code:$apr1$AeePIAei$E9E6E6jtFFtwmtGhIEG.Y/

2
.basic-auth-web Normal file
View File

@ -0,0 +1,2 @@
code:$apr1$AeePIAei$E9E6E6jtFFtwmtGhIEG.Y/
web:$apr1$/zc/TBtD$ZGr3RqPiULYMD0kJUup5E0

3
.env Normal file
View File

@ -0,0 +1,3 @@
PROJECT_NAME=tibi-svelte-starter
TIBI_PREFIX=tibi
TIBI_NAMESPACE=__NAMESPACE__

1
.gitignore vendored
View File

@ -15,3 +15,4 @@ cypress/screenshots
.~lock.*
coverage/
.nyc_output/
/tmp/

Binary file not shown.

View File

@ -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

113
docker-compose-local.yml Normal file
View File

@ -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

View File

@ -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",