1515# along with this program. If not, see <https://www.gnu.org/licenses/>.
1616
1717# Docker Compose configuration
18-
1918services :
2019 frontend :
21- entrypoint : ["docker-entrypoint.sh"] # Frontend webapp
20+
2221 container_name : frontend
2322 # image: library-system/frontend
2423 build :
@@ -28,14 +27,14 @@ services:
2827 - " 443:443" # HTTPS traffic for serving webapp
2928 networks :
3029 - backend
31- - casdoor
30+ - logto
3231 restart : unless-stopped
3332 depends_on :
3433 backend :
3534 condition : service_started
3635 command : ["python","/src/__main__.py"]
3736 backend : # Backend
38- entrypoint : ["docker-entrypoint.sh"]
37+
3938 container_name : backend
4039 # image: library-system/backend
4140 build :
@@ -44,53 +43,63 @@ services:
4443 networks :
4544 - backend
4645 - db
47- - casdoor
4846 restart : unless-stopped
4947 environment :
5048 DB_HOST : db
5149 DB_PORT : 5432
5250 command : ["python","/src/__main__.py"]
53- secrets :
54- - db_pass
5551 depends_on :
5652 db :
5753 condition : service_healthy
54+ ports :
55+ - " 8000:8000"
5856 db : # Database
57+ # entrypoint: ['docker-entrypoint.sh']
5958 image : postgres:17.5-alpine3.21 # Using alpine Postgres image
59+ container_name : db
6060 networks :
6161 - db
6262 restart : unless-stopped
6363 volumes :
6464 - pgdata:/var/lib/postgresql/data
6565 - db-init:/docker-entrypoint-initdb.d:ro # Init scripts for postgres
6666 environment :
67- POSTGRES_USER : library
68- POSTGRES_PASSWORD_FILE : /run/secrets/db_pass
67+ POSTGRES_USER : library
68+ POSTGRES_PASSWORD : ${DB_PASS}
6969 POSTGRES_DB : library
7070
71- secrets :
72- - db_pass
73- - casbin_login_pass
74-
7571 healthcheck :
7672 test : ["CMD", "pg_isready", "-U", "library"]
7773 interval : 10s
7874 retries : 5
79- casdoor :
80- image : casbin/casdoor:v1.960.0
75+
76+ logto :
77+ depends_on :
78+ db :
79+ condition : service_healthy
80+ image : svhd/logto:${TAG-latest}
81+ entrypoint : ["sh", "-c", "npm run cli db seed -- --swe && npm start"]
82+ ports :
83+ - 3001:3001
84+ - 3002:3002
85+ environment :
86+ - TRUST_PROXY_HEADER=1
87+ - DB_URL=postgres://library:$DB_PASS@db:5432/library
88+ - NODE_ENV=test
89+ - PORT=3001
90+ - ADMIN_PORT=3002
91+ - ADMIN_ENDPOINT=http://localhost:3002
8192 networks :
82- - casdoor
93+ - db
94+ - logto
8395 restart : unless-stopped
84- depends_on :
85- backend :
86- condition : service_started
8796
88- networks :
89- backend :
97+ networks : # Frontend and DB MUST NEVER be on the same network.
98+ backend : # For all containers that must communicate with backend. MUST include backend.
9099 driver : bridge
91- db :
100+ db : # For all containers that must communicate with the database. MUST include db. CANNOT include frontend.
92101 driver : bridge
93- casdoor :
102+ logto :
94103 driver : bridge
95104
96105volumes :
@@ -99,6 +108,6 @@ volumes:
99108
100109secrets :
101110 casbin_login_pass :
102- file : ./secrets/casbin_login_pass.txt
111+ environment : CASBIN_LOGIN_PASS
103112 db_pass :
104- file : ./secrets/db_pass.txt
113+ environment : DB_PASS
0 commit comments