diff --git a/compose.yml b/compose.yml index efd4186..8d19efb 100644 --- a/compose.yml +++ b/compose.yml @@ -469,6 +469,32 @@ services: restart: always command: tunnel --no-autoupdate run --token eyJhIjoiMjUyZjQ3MWZkMzE2ZTg5NjI2ZjEzYzI1YzYwMTJiYzciLCJ0IjoiNWFhMDJlNmEtNDE2Ni00YTJkLTk1YzktMGFmMGY3MjM3YjIzIiwicyI6Ik5tWmhOR1V6WVRZdE5HRXdOaTAwT1RjekxXSTFPV1V0T0RrMU1UWTRabVl4WkRZeCJ9 + torrents-csv: + image: dessalines/torrents-csv-server:latest + restart: unless-stopped + ports: + - "8902:8902" + environment: + TORRENTS_CSV_DB_HOST: "postgres://postgres:password@db" + TORRENTS_CSV_FRONT_END_DIR: /app/dist + RUST_LOG: DEBUG + depends_on: + - db # search at 'http://shaan-server:8902/service/search?q={SEARCH_TERM' + + db: + image: pgautoupgrade/pgautoupgrade:17-alpine + restart: unless-stopped + shm_size: 1gb + volumes: + - ./init-database.sh:/docker-entrypoint-initdb.d/init-database.sh + - ./init-database.sql:/var/lib/postgresql/init-database.sql + - ./torrents.csv:/var/lib/postgresql/torrents.csv + ports: + - "127.0.0.1:5433:5432" + environment: + POSTGRES_PASSWORD: password + POSTGRES_USER: postgres + # caddy: # build: # context: . diff --git a/homepage/bookmarks.yaml b/homepage/bookmarks.yaml index 71ebf86..fcf14b7 100644 --- a/homepage/bookmarks.yaml +++ b/homepage/bookmarks.yaml @@ -5,31 +5,37 @@ - "Icons": - "Plex": - icon: si-plex-#EBAF00 - href: https://github.com/dhaan7/torrent-stack + href: {{HOMEPAGE_VAR_PLEX_HOST}} - "LibreChat": - icon: si-ollama-#FFFFFF - href: https://0.0.0.0 + href: http://shaan-server:7001 - "Sonarr": - icon: si-sonarr-#2596BE - href: https://github.com/dhaan7/torrent-stack + href: {{HOMEPAGE_VAR_SONARR_HOST}} - "Radarr": - icon: si-radarr-#FFCB3D - href: https://github.com/dhaan7/torrent-stack + href: {{HOMEPAGE_VAR_RADARR_HOST}} - "Lidarr": - icon: si-youtubemusic-#499848 - href: https://github.com/dhaan7/torrent-stack + href: {{HOMEPAGE_VAR_LIDARR_HOST}} + - "Tautulli": + - icon: sh-tautulli-light + href: {{HOMEPAGE_VAR_TAUTULLI_HOST}} + - "Tdarr": + - icon: sh-tdarr + href: {{HOMEPAGE_VAR_TDARR_HOST}} - "qBittorrent": - icon: si-qbittorrent-#2F67BA - href: https://github.com/dhaan7/torrent-stack + href: http://shaan-server:2161 - "Seerr": - icon: sh-seerr-light - href: https://github.com/dhaan7/torrent-stack + href: {{HOMEPAGE_VAR_SEERR_HOST}} - "Prowlarr": - icon: sh-prowlarr-light - href: https://github.com/dhaan7/torrent-stack + href: {{HOMEPAGE_VAR_PROWLARR_HOST}} - "pihole": - icon: si-pihole-#96060C - href: https://github.com/dhaan7/torrent-stack + href: http://shaan-server/admin - Bookmarks: - github/dhaan7/torrent-stack: diff --git a/homepage/services.yaml b/homepage/services.yaml index 84599e8..c02e459 100644 --- a/homepage/services.yaml +++ b/homepage/services.yaml @@ -38,17 +38,11 @@ url: "{{HOMEPAGE_VAR_MYSPEED_ADDRESS}}" fields: [download, upload] - "non-torrent-stack": - - "LibreChat": - icon: sh-open-webui-light - href: "{{HOMEPAGE_VAR_WEB_PROTOCOL}}://{{HOMEPAGE_VAR_SERVER_NAME}}:3080" - server: my-docker - container: open-webui + - "Odysseus": + icon: sh-ollama-light + href: "{{HOMEPAGE_VAR_WEB_PROTOCOL}}://{{HOMEPAGE_VAR_SERVER_NAME}}:7001" + siteMonitor: "{{HOMEPAGE_VAR_WEB_PROTOCOL}}://{{HOMEPAGE_VAR_SERVER_NAME}}:7001" description: Local AI Models - - "llama.cpp (thinkcentre)": - icon: sh-llama-cpp-light - href: "http://192.168.50.116:5079" - siteMonitor: http://192.168.50.116:5079 - description: 0GB VRAM + 16GB RAM - "llama.cpp (shaan-pc)": icon: sh-llama-cpp-light href: "http://192.168.50.6:5078" diff --git a/init-database.sh b/init-database.sh new file mode 100644 index 0000000..d4c2365 --- /dev/null +++ b/init-database.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -e + +psql -v ON_ERROR_STOP=1 -U postgres -f init-database.sql diff --git a/init-database.sql b/init-database.sql new file mode 100644 index 0000000..4dc0091 --- /dev/null +++ b/init-database.sql @@ -0,0 +1,38 @@ +-- Create a temp table +CREATE TABLE torrent_tmp ( + infohash text NOT NULL, + name text NOT NULL, + size_bytes bigint NOT NULL, + created_unix bigint NOT NULL, + seeders integer NOT NULL, + leechers integer NOT NULL, + completed integer NOT NULL, + scraped_date bigint NOT NULL, + published bigint NOT NULL +); + +-- Copy from csv +COPY torrent_tmp +FROM + '../torrents.csv' WITH ( + FORMAT csv, + HEADER); + +-- default sort by seeders +CREATE TABLE torrent AS +SELECT + * +FROM + torrent_tmp +ORDER BY + seeders DESC; + +-- Add the identity column +ALTER TABLE torrent + ADD COLUMN id int GENERATED ALWAYS AS IDENTITY, + ADD COLUMN name_search tsvector GENERATED ALWAYS AS (to_tsvector('english', name)) STORED; + +CREATE INDEX idx_name ON torrent USING gin (name_search); + +DROP TABLE torrent_tmp; + diff --git a/startup.sh b/startup.sh old mode 100644 new mode 100755 index 0a84270..e7d8087 --- a/startup.sh +++ b/startup.sh @@ -20,6 +20,7 @@ sleep 5 # 4. Launch Odysseus echo "Spinning up Odysseus Stack..." >> /home/shaan/torrent-stack/startup.log cd /home/shaan/torrent-stack/odysseus || exit -git pull && docker compose up -d >> /home/shaan/torrent-stack/startup.log 2>&1 +git pull . dev +docker compose up -d >> /home/shaan/torrent-stack/startup.log 2>&1 echo "All services initiated successfully at $(date)" >> /home/shaan/torrent-stack/startup.log diff --git a/torrents-csv-data b/torrents-csv-data new file mode 160000 index 0000000..a48af42 --- /dev/null +++ b/torrents-csv-data @@ -0,0 +1 @@ +Subproject commit a48af42e1fc83b830b89b7bf600811d30c5879c6 diff --git a/torrents.csv b/torrents.csv new file mode 120000 index 0000000..ac3d888 --- /dev/null +++ b/torrents.csv @@ -0,0 +1 @@ +torrents-csv-data/torrents.csv \ No newline at end of file