init docker cofig,

This commit is contained in:
louiscklaw
2025-05-11 07:59:35 +08:00
parent 9739583f43
commit 6e576919ab
10 changed files with 372 additions and 0 deletions

14
002_source/.env Normal file
View File

@@ -0,0 +1,14 @@
# THIS IS env file for use with docker-compose.yml
# cms
# doc
# ionic_mobile
# api_ts
# pocketbase
PB_HOSTNAME=pocketbase
PB_USERNAME=admin@123.com
PB_PASSWORD=Aa12345678

4
002_source/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
**/*.del
**/*.log
**/_archive
**/_del

74
002_source/README.md Normal file
View File

@@ -0,0 +1,74 @@
# README
## to start production
```bash
# start docker before hand
$ ./dc_build.sh
$ ./dc_up.sh
```
## to start develop
```bash
#
$ ./dc_build.sh
$ ./dc_dev.sh
$ docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d pocketbase api_ts --remove-orphans
$ docker compose logs -f pocketbase api_ts
```
## test api endpoint
```bash
# browse to http://localhost:3000/helloworld
```
```bash
# start docker before hand
$ cd 002_source
$ ./dev.sh
# docker containers up
```
---
## deprecated
```bash
# mobile
$ cd 002_source/mobile
$ pnpm run dev
# cms
$ cd 002_source/cms
$ npm run dev
```
ideation
prototyping
testing
production deployment
evaluation
monitoring
## addresses
```
mobile:
http://localhost:5173
pocketbase:
http://localhost:8090/_
cms:
http://localhost:3000
documentation
http://localhost:3001
```
extend to vocabularies

View File

@@ -0,0 +1,33 @@
services:
cms:
environment:
- NODE_ENV=development
# command: "sleep infinity"
deploy:
resources:
limits:
cpus: "1"
doc:
environment:
- NODE_ENV=development
deploy:
resources:
limits:
cpus: "1"
ionic_mobile:
environment:
- NODE_ENV=development
deploy:
resources:
limits:
cpus: "1"
api_ts:
environment:
- NODE_ENV=development
deploy:
resources:
limits:
cpus: "1"

View File

@@ -0,0 +1,149 @@
volumes:
shared:
dist:
services:
cms:
image: 192.168.10.61:5000/cms_ubuntu
# build: ./cms
env_file:
- .env
volumes:
- ./cms:/app
ports:
- 3000:3000
working_dir: /app
command: ./scripts/docker/entrypoint.sh
depends_on:
pocketbase:
condition: service_healthy
healthcheck:
#optional (recommended) since v0.10.0
test: wget --no-verbose --tries=1 --spider http://localhost:3000 || exit 1
interval: 5s
timeout: 5s
retries: 5
deploy:
resources:
limits:
cpus: "0.5"
reservations:
cpus: "0.01"
doc:
build: ./doc
env_file:
- .env
volumes:
- ./doc:/app
ports:
- 3001:3000
working_dir: /app
command: ./scripts/docker/entrypoint.sh
healthcheck:
#optional (recommended) since v0.10.0
test: wget --no-verbose --tries=1 --spider http://localhost:3000 || exit 1
interval: 5s
timeout: 5s
retries: 5
deploy:
resources:
limits:
cpus: "0.5"
reservations:
cpus: "0.01"
ionic_mobile:
# image: node:20-bullseye-slim
# build: ./ionic_mobile
image: 192.168.10.61:5000/ionic_mobile_ubuntu
# user: 1000:1000
env_file:
- .env
volumes:
- ./ionic_mobile:/app
ports:
- 5173:5173
working_dir: /app
command: ./scripts/docker/entrypoint.sh
depends_on:
pocketbase:
condition: service_healthy
healthcheck:
#optional (recommended) since v0.10.0
test: wget --no-verbose --tries=1 --spider http://localhost:5173 || exit 1
interval: 5s
timeout: 5s
retries: 5
deploy:
resources:
limits:
cpus: "0.5"
reservations:
cpus: "0.01"
api_ts:
image: 192.168.10.61:5000/api_ts_ubuntu
# build: ./api_ts
volumes:
- ./api_ts:/app
working_dir: /app
# env_file:
# - .env
environment:
- NODE_ENV=production
- PB_HOSTNAME=pocketbase
- PB_USERNAME=admin@123.com
- PB_PASSWORD=Aa12345678
ports:
- 8080:3000
# command: sleep infinity
command: ./entrypoint.sh
# depends_on:
# pocketbase:
# condition: service_healthy
# healthcheck:
# #optional (recommended) since v0.10.0
# test: wget --no-verbose --tries=1 --spider http://localhost:3000 || exit 1
# interval: 5s
# timeout: 5s
# retries: 5
deploy:
resources:
limits:
cpus: 0.5
reservations:
cpus: 0.01
pocketbase:
# image: ghcr.io/muchobien/pocketbase:latest
build:
context: ./pocketbase/docker
args:
- VERSION=0.26.6 # Specify the PocketBase version here
# hostname: pocketbase
restart: always
# environment:
# ENCRYPTION: example #optional
ports:
- 8090:8090
volumes:
- ./pocketbase/volumes/pb_data:/pb_data
- ./pocketbase/pb_hooks:/pb_hooks
- ./pocketbase/pb_migrations:/pb_migrations
# healthcheck:
# #optional (recommended) since v0.10.0
# test: wget --no-verbose --tries=1 --spider http://localhost:8090/api/health || exit 1
# interval: 5s
# timeout: 5s
# retries: 5
deploy:
resources:
limits:
cpus: 0.5
reservations:
cpus: 0.01

19
002_source/scripts/backup.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -ex
# GLOBAL_EXCLUDE="--exclude={'**/.git','**/node_modules','**/.pnpm','**//**'}"
# tar -zcvf _archive/cms/018.tar.gz \
# --exclude "node_modules" \
# --exclude ".next" \
# cms
rsync -avzh \
--exclude ".next" \
--exclude "node_modules" \
--exclude ".pnpm" \
--exclude ".git" \
cms _archive/006_cms_start_categories_edit
echo "done"

36
002_source/scripts/dc_build.sh Executable file
View File

@@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -ex
# cms_ubuntu use nvm docker image
cd ../005_references/nvm
# docker build -t 192.168.10.61:5000/nvm_ubuntu:latest .
# docker tag nvm_ubuntu 192.168.10.61:5000/nvm_ubuntu
# docker build -t nvm_ubuntu:latest .
# docker run -it nvm_ubuntu:latest bash
# docker run -it 192.168.10.61:5000/nvm_ubuntu:latest bash
cd -
cd ./cms
docker build -t 192.168.10.61:5000/cms_ubuntu:latest .
cd -
# ionic_mobile
cd ./ionic_mobile
docker build -t 192.168.10.61:5000/ionic_mobile_ubuntu:latest .
cd -
# api_ts
cd ./api_ts
docker build -t 192.168.10.61:5000/api_ts_ubuntu:latest .
cd -
# # pocketbase
# echo "done"
docker push 192.168.10.61:5000/nvm_ubuntu:latest
docker push 192.168.10.61:5000/cms_ubuntu:latest
docker push 192.168.10.61:5000/api_ts_ubuntu:latest
docker push 192.168.10.61:5000/ionic_mobile_ubuntu:latest

17
002_source/scripts/dc_dev.sh Executable file
View File

@@ -0,0 +1,17 @@
#!/usr/bin/env bash
set -ex
docker compose kill
docker compose down
docker compose -f docker-compose.yml -f docker-compose.dev.yml up -d pocketbase api_ts --remove-orphans
# docker compose logs -f pocketbase api_ts
echo "done"
echo "please run yourself !!!!"
echo "nodemon -w /pb_hooks --exec "pocketbase seed""
echo ""
docker compose exec -it pocketbase sh

20
002_source/scripts/dc_up.sh Executable file
View File

@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -ex
# docker compose build
# cd cms
# # nvm use 18
# npm run build
# cd -
# cd ionic_mobile
# npm run build
# cd -
docker compose up -d
docker compose logs -f
echo "done"

6
002_source/scripts/run.sh Executable file
View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -ex
docker compose exec -it cms bash
echo "done"