11include .env
2- DEV_CONTAINER_NAME = "sesame-orchestrator"
3- APPNAME = "sesame"
2+ APP_PORT = 4002
3+ IMG_NAME = "ghcr.io/libertech-fr/sesame-orchestrator"
4+ APP_NAME = "sesame-orchestrator"
5+ PLATFORM = "linux/amd64"
46
57.DEFAULT_GOAL := help
68help :
79 @printf " \033[33mUsage:\033[0m\n make [target] [arg=\" val\" ...]\n\n\033[33mTargets:\033[0m\n"
810 @grep -E ' ^[-a-zA-Z0-9_\.\/]+:.*?## .*$$' $(MAKEFILE_LIST ) \
911 | sort | awk ' BEGIN {FS = ":.*?## "}; {printf " \033[32m%-15s\033[0m %s\n", $$1, $$2}'
1012
11- dev : # # Run development server
12- @docker compose --project-directory docker run -d --rm \
13- --service-ports \
14- --use-aliases \
15- --name $(DEV_CONTAINER_NAME ) \
16- $(DEV_CONTAINER_NAME ) yarn start:dev
17- @docker logs -f $(DEV_CONTAINER_NAME )
13+ build : # # Build the container
14+ @docker build --platform $(PLATFORM ) -t $(IMG_NAME ) .
1815
19- exec : # # Execute a command in the development container
20- @docker compose --project-directory docker run -it --rm $(DEV_CONTAINER_NAME ) bash
16+ dev : # # Start development environment
17+ @docker run --rm -it \
18+ -e NODE_ENV=development \
19+ -e NODE_TLS_REJECT_UNAUTHORIZED=0 \
20+ --add-host host.docker.internal:host-gateway \
21+ --network dev \
22+ --platform $(PLATFORM ) \
23+ --name $(APP_NAME ) \
24+ -p $(APP_PORT ) :4000 \
25+ -v $(CURDIR ) :/data \
26+ $(IMG_NAME ) yarn start:dev
2127
22- run-docs : # # Execute a command in the development container
23- @docker compose --project-directory docker run -p 8080:8080 -it --rm $(DEV_CONTAINER_NAME ) yarn generate:docServer
28+ install : # # Install dependencies
29+ @docker run -it --rm \
30+ -e NODE_ENV=development \
31+ -e NODE_TLS_REJECT_UNAUTHORIZED=0 \
32+ --add-host host.docker.internal:host-gateway \
33+ --platform $(PLATFORM ) \
34+ --network dev \
35+ -v $(CURDIR ) :/data \
36+ $(IMG_NAME ) yarn install
2437
25- install : # # Execute a command in the development container
26- @docker compose --project-directory docker run -it --rm $(DEV_CONTAINER_NAME ) yarn install
38+ exec : # # Run a shell in the container
39+ @docker run -it --rm \
40+ -e NODE_ENV=development \
41+ -e NODE_TLS_REJECT_UNAUTHORIZED=0 \
42+ --add-host host.docker.internal:host-gateway \
43+ --platform $(PLATFORM ) \
44+ --network dev \
45+ -v $(CURDIR ) :/data \
46+ $(IMG_NAME ) sh
2747
28- dbs : # # Run dependencies for development
29- @docker volume create $(APPNAME ) -mongo
30- @docker compose --project-directory docker up -d $(APPNAME ) -redis
31- @docker compose --project-directory docker up -d $(APPNAME ) -mongo
32- @docker exec -it $(APPNAME ) -mongo mongo --eval " rs.initiate({_id: 'rs0', members: [{_id: 0, host: '127.0.0.1:27017'}]})" || true
48+ dbs : # # Start databases
49+ @docker volume create $(APP_NAME ) -mongodb
50+ @docker run -d --rm \
51+ --name $(APP_NAME ) -mongodb \
52+ -v $(APP_NAME ) -mongodb:/data/db \
53+ -p 27017:27017 \
54+ -e MONGODB_REPLICA_SET_MODE=primary \
55+ -e MONGODB_REPLICA_SET_NAME=rs0 \
56+ -e ALLOW_EMPTY_PASSWORD=yes \
57+ --platform $(PLATFORM ) \
58+ --network dev \
59+ --health-interval=5s \
60+ --health-timeout=3s \
61+ --health-start-period=5s \
62+ --health-retries=3 \
63+ --health-cmd=" mongo --eval \" db.stats().ok\" || exit 1" \
64+ mongo:7.0 --replSet rs0 --wiredTigerCacheSizeGB 1.5 || true
65+ @docker volume create $(APP_NAME ) -redis
66+ @docker run -d --rm \
67+ --name $(APP_NAME ) -redis \
68+ -v $(APP_NAME ) -redis:/data \
69+ --platform $(PLATFORM ) \
70+ --network dev \
71+ -p 6379:6379 \
72+ --health-interval=5s \
73+ --health-timeout=3s \
74+ --health-start-period=5s \
75+ --health-retries=3 \
76+ --health-cmd=" redis-cli ping || exit 1" \
77+ redis || true
78+ @docker exec -it $(APP_NAME ) -mongodb mongo --eval " rs.initiate({_id: 'rs0', members: [{_id: 0, host: '127.0.0.1:27017'}]})" || true
3379
34- stop : # # Stop all containers
35- @docker compose --project-directory docker down $(DEV_CONTAINER_NAME ) $(APPNAME ) -redis $(APPNAME ) -mongo --remove-orphans
36- @docker compose --project-directory rm -f
37-
38- stop-dev : # # Stop development container
39- @docker compose --project-directory docker down $(DEV_CONTAINER_NAME ) --remove-orphans
40- @docker compose --project-directory rm -f $(DEV_CONTAINER_NAME )
41-
42- stop-dbs : # # Stop dependencies for development
43- @docker compose --project-directory docker down $(APPNAME ) -redis $(APPNAME ) -mongo --remove-orphans
44- @docker compose --project-directory docker rm -f $(APPNAME ) -redis $(APPNAME ) -mongo
80+ stop : # # Stop the container
81+ @docker stop $(APP_NAME ) || true
82+ @docker stop $(APP_NAME ) -mongodb || true
83+ @docker stop $(APP_NAME ) -redis || true
4584
4685run-test : # # Run tests
4786 act --container-architecture=" linux/arm64" -j test
4887
4988gen-doc :
50- npx @compodoc/compodoc -p tsconfig.json -s -d docs --includes ./markdowns -n " Sesame Orchestrator"
89+ @ npx @compodoc/compodoc -p tsconfig.json -s -d docs --includes ./markdowns -n " Sesame Orchestrator"
0 commit comments