Add healthcheck for postgres

This commit is contained in:
Zoe Roux 2023-03-17 01:55:49 +09:00
parent 9ce8043667
commit 5e87a669de
5 changed files with 33 additions and 5 deletions

View File

@ -5,10 +5,14 @@ THEMOVIEDB_APIKEY=
PUBLIC_BACK_URL=http://localhost:5000
AUTHENTICATION_SECRET=
# Following options are optional and only useful for debugging.
# To debug the front end, you can set the following to an external backend
KYOO_URL=https://kyoo.sdg.moe/api
# The library root inside the container.
KYOO_LIBRARY_ROOT=/video
# Database things (optional)
# Database things
POSTGRES_USER=KyooUser
POSTGRES_PASSWORD=KyooPassword
POSTGRES_DB=kyooDB

View File

@ -61,7 +61,7 @@ namespace Kyoo.Core.Tasks
{
ICollection<Provider> providers = await _libraryManager.GetAll<Provider>();
ICollection<string> existings = (await _libraryManager.GetAll<Library>()).SelectMany(x => x.Paths).ToArray();
IEnumerable<Library> newLibraries = Directory.GetDirectories(Environment.GetEnvironmentVariable("LIBRARY_ROOT") ?? "/video")
IEnumerable<Library> newLibraries = Directory.GetDirectories(Environment.GetEnvironmentVariable("KYOO_LIBRARY_ROOT") ?? "/video")
.Where(x => !existings.Contains(x))
.Select(x => new Library
{

View File

@ -16,7 +16,8 @@ services:
- ./back:/app
- /app/out/
- kyoo:/kyoo
- ./video:/video
- ${LIBRARY_ROOT}:/video
front:
build:
context: ./front
@ -34,6 +35,7 @@ services:
environment:
- KYOO_URL=${KYOO_URL:-http://back:5000}
- PUBLIC_BACK_URL=${PUBLIC_BACK_URL}
ingress:
image: nginx
restart: on-failure
@ -48,6 +50,7 @@ services:
- front
ports:
- "8901:8901"
postgres:
image: "postgres"
restart: on-failure
@ -55,6 +58,11 @@ services:
- ./.env
volumes:
- db:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 5
volumes:
kyoo:

View File

@ -11,13 +11,15 @@ services:
volumes:
- kyoo:/kyoo
- ./cache:/kyoo/cached
- ./video:/video
- ${LIBRARY_ROOT}:/video
front:
image: zoriya/kyoo_front:edge
restart: on-failure
environment:
- KYOO_URL=${KYOO_URL:-http://back:5000}
- PUBLIC_BACK_URL=${PUBLIC_BACK_URL}
ingress:
image: nginx
restart: on-failure
@ -32,6 +34,7 @@ services:
- front
ports:
- "8901:8901"
postgres:
image: postgres
restart: on-failure
@ -39,6 +42,11 @@ services:
- ./.env
volumes:
- db:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 5
volumes:
kyoo:

View File

@ -11,13 +11,15 @@ services:
volumes:
- kyoo:/kyoo
- ./cache:/kyoo/cached
- ./video:/video
- ${LIBRARY_ROOT}:/video
front:
build: ./front
restart: on-failure
environment:
- KYOO_URL=${KYOO_URL:-http://back:5000}
- PUBLIC_BACK_URL=${PUBLIC_BACK_URL}
ingress:
image: nginx
restart: on-failure
@ -32,6 +34,7 @@ services:
- front
ports:
- "8901:8901"
postgres:
image: postgres
restart: on-failure
@ -39,6 +42,11 @@ services:
- ./.env
volumes:
- db:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 5s
timeout: 5s
retries: 5
volumes:
kyoo: