From 59e0204edb16cc34e063fc9e8e438cf07a4bc349 Mon Sep 17 00:00:00 2001 From: Harm Jongedijk Date: Tue, 23 Jul 2024 06:41:17 +0200 Subject: [PATCH] Added missing docker files for port specific and network_mode: host - SQLite and Postgres (#556) * Added missing docker files for port specific and network_mode: host - SQLite and Postgres * combined all docker composes to 1 file & updated readme * update info * updated info --- README.md | 68 ++++++-------------------------- docker-compose-postgres-host.yml | 54 ------------------------- docker-compose.yml | 52 +++++++++++++++++++----- 3 files changed, 55 insertions(+), 119 deletions(-) delete mode 100644 docker-compose-postgres-host.yml diff --git a/README.md b/README.md index 8ab5095e..84aa785b 100644 --- a/README.md +++ b/README.md @@ -103,48 +103,7 @@ services: - /mnt:/mnt ``` -docker-compose.yml (Frontend + Backend + SQLite) -```yml ---- -services: - riven-frontend: - image: spoked/riven-frontend:latest - container_name: riven-frontend - restart: unless-stopped - network_mode: host - tty: true - environment: - - PUID=1000 - - PGID=1000 - - ORIGIN=http://localhost:3000 - - BACKEND_URL=http://127.0.0.1:8080 - - TZ=Europe/Amsterdam - depends_on: - riven: - condition: service_healthy - - riven: - image: spoked/riven:latest - container_name: riven - restart: unless-stopped - network_mode: host - tty: true - environment: - - PUID=1000 - - PGID=1000 - - TZ=Europe/Amsterdam - - RIVEN_DATABASE_HOST=sqlite:////riven/data/media.db - healthcheck: - test: curl -s http://localhost:8080 >/dev/null || exit 1 - interval: 30s - timeout: 10s - retries: 10 - volumes: - - ./riven-data:/riven/data - - /mnt:/mnt -``` - -docker-compose.yml (Frontend + Backend + Postgres) +docker-compose.yml (Frontend + Backend + Postgress / SQLite + ports: / network_mode: host) ```yml --- services: @@ -154,29 +113,33 @@ services: restart: unless-stopped ports: - "3000:3000" + #network_mode: host tty: true environment: - PUID=1000 - PGID=1000 - ORIGIN=http://localhost:3000 - BACKEND_URL=http://127.0.0.1:8080 - - TZ=Europe/Amsterdam + - TZ=America/New_York depends_on: riven: condition: service_healthy - + riven: image: spoked/riven:latest container_name: riven restart: unless-stopped ports: - "8080:8080" + #network_mode: host tty: true environment: - PUID=1000 - PGID=1000 - - TZ=Europe/Amsterdam - - RIVEN_DATABASE_HOST=postgresql+psycopg2://postgres:postgres@riven_postgres/riven + - TZ=America/New_York + - RIVEN_DATABASE_HOST=postgresql+psycopg2://postgres:postgres@riven_postgres/riven #Postgres database + #- RIVEN_DATABASE_HOST=postgresql+psycopg2://postgres:postgres@localhost/riven #nework_mode: host {use @localhost} + #- RIVEN_DATABASE_HOST=sqlite:////riven/data/media.db #SQLite database healthcheck: test: curl -s http://localhost:8080 >/dev/null || exit 1 interval: 30s @@ -185,11 +148,11 @@ services: volumes: - ./riven-data:/riven/data - /mnt:/mnt - depends_on: + depends_on: # Add # before all {depend: riven_postgress} lines when using SQLite riven_postgres: condition: service_healthy - - riven_postgres: + + riven_postgres: # Add # before all {riven_postgres} lines when using SQLite image: postgres:16.3-alpine3.20 container_name: riven-db environment: @@ -201,12 +164,7 @@ services: interval: 30s timeout: 10s retries: 5 - networks: - - postgres-internal - -networks: - postgres-internal: - default: + #network_mode: host ``` Then run `docker compose up -d` to start the container in the background. You can then access the web interface at `http://localhost:3000` or whatever port and origin you set in the `docker-compose.yml` file. diff --git a/docker-compose-postgres-host.yml b/docker-compose-postgres-host.yml deleted file mode 100644 index 3e92d484..00000000 --- a/docker-compose-postgres-host.yml +++ /dev/null @@ -1,54 +0,0 @@ ---- -services: - riven-frontend: - image: spoked/riven-frontend:latest - container_name: riven-frontend - restart: unless-stopped - network_mode: host - tty: true - environment: - - PUID=1000 - - PGID=1000 - - ORIGIN=http://localhost:3000 - - BACKEND_URL=http://127.0.0.1:8080 - - TZ=Europe/Amsterdam - depends_on: - riven: - condition: service_healthy - - riven: - image: spoked/riven:latest - container_name: riven - restart: unless-stopped - network_mode: host - tty: true - environment: - - PUID=1000 - - PGID=1000 - - TZ=Europe/Amsterdam - - RIVEN_DATABASE_HOST=postgresql+psycopg2://postgres:postgres@localhost/riven - healthcheck: - test: curl -s http://localhost:8080 >/dev/null || exit 1 - interval: 30s - timeout: 10s - retries: 10 - volumes: - - ./riven-data:/riven/data - - /mnt:/mnt - depends_on: - riven_postgres: - condition: service_healthy - - riven_postgres: - image: postgres:16.3-alpine3.20 - container_name: riven-db - environment: - POSTGRES_USER: postgres - POSTGRES_PASSWORD: postgres - POSTGRES_DB: riven - healthcheck: - test: ["CMD-SHELL", "pg_isready -U postgres"] - interval: 30s - timeout: 10s - retries: 5 - network_mode: host \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 06dd1aa7..93c59731 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,28 +1,60 @@ +--- services: + riven-frontend: + image: spoked/riven-frontend:latest + container_name: riven-frontend + restart: unless-stopped + ports: + - "3000:3000" + #network_mode: host + tty: true + environment: + - PUID=1000 + - PGID=1000 + - ORIGIN=http://localhost:3000 + - BACKEND_URL=http://127.0.0.1:8080 + - TZ=America/New_York + depends_on: + riven: + condition: service_healthy + riven: image: spoked/riven:latest container_name: riven restart: unless-stopped + ports: + - "8080:8080" + #network_mode: host tty: true environment: - PUID=1000 - PGID=1000 - - ORIGIN=http://localhost:3000 - - BACKEND_URL=http://127.0.0.1:8080 - TZ=America/New_York - - RIVEN_DATABASE_HOST=postgresql+psycopg2://postgres:postgres@riven_postgres/riven + - RIVEN_DATABASE_HOST=postgresql+psycopg2://postgres:postgres@riven_postgres/riven #Postgres database + #- RIVEN_DATABASE_HOST=postgresql+psycopg2://postgres:postgres@localhost/riven #nework_mode: host {use @localhost} + #- RIVEN_DATABASE_HOST=sqlite:////riven/data/media.db #SQLite database + healthcheck: + test: curl -s http://localhost:8080 >/dev/null || exit 1 + interval: 30s + timeout: 10s + retries: 10 volumes: - - ./data:/riven/data + - ./riven-data:/riven/data - /mnt:/mnt - ports: - - "3000:3000" - - riven_postgres: + depends_on: # Add # before all {depend: riven_postgress} lines when using SQLite + riven_postgres: + condition: service_healthy + + riven_postgres: # Add # before all {riven_postgres} lines when using SQLite image: postgres:16.3-alpine3.20 container_name: riven-db environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: postgres POSTGRES_DB: riven - networks: - - postgres-internal \ No newline at end of file + healthcheck: + test: ["CMD-SHELL", "pg_isready -U postgres"] + interval: 30s + timeout: 10s + retries: 5 + #network_mode: host \ No newline at end of file