From da997af64a17d9059b210504be87d6945c101e7c Mon Sep 17 00:00:00 2001 From: iPromKnight <156901906+iPromKnight@users.noreply.github.com> Date: Thu, 18 Jan 2024 08:54:57 +0000 Subject: [PATCH] Move compose to top level Comment out broken scrapers Remove db init scripts and use ENABLE_SYNC env var which the code base uses to specify if Sequelize should create or alter tables on startup, meaning we dont need manual db initialization. There were missing tables anyhow :P --- README.md | 1 - addon/hosted/init/torrentio-pgsql.sql | 53 ------------------- .../docker-compose.yml => docker-compose.yml | 35 ++++++------ scraper/scheduler/scrapers.js | 50 ++++++++--------- 4 files changed, 45 insertions(+), 94 deletions(-) delete mode 100644 addon/hosted/init/torrentio-pgsql.sql rename addon/hosted/docker-compose.yml => docker-compose.yml (64%) diff --git a/README.md b/README.md index e8820a3..ae00267 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,6 @@ ## Self-hosted quickstart ``` -cd addon/hosted docker-compose up -d ``` Then open your browser to `127.0.0.1:7000` \ No newline at end of file diff --git a/addon/hosted/init/torrentio-pgsql.sql b/addon/hosted/init/torrentio-pgsql.sql deleted file mode 100644 index 83c5698..0000000 --- a/addon/hosted/init/torrentio-pgsql.sql +++ /dev/null @@ -1,53 +0,0 @@ -CREATE TABLE "torrents" ( - "infoHash" varchar(64) PRIMARY KEY, - "provider" varchar(32) NOT NULL, - "torrentId" varchar(128), - "title" varchar(256) NOT NULL, - "size" bigint, - "type" varchar(16) NOT NULL, - "uploadDate" date NOT NULL, - "seeders" integer, - "trackers" varchar(4096), - "languages" varchar(4096), - "resolution" varchar(16), - "createdAt" date, - "updatedAt" date, - "reviewed" boolean, - "opened" boolean -); - -CREATE TABLE "files" ( - "id" SERIAL PRIMARY KEY, - "infoHash" varchar(64) NOT NULL, - "fileIndex" integer, - "title" varchar(256) NOT NULL, - "size" bigint, - "imdbId" varchar(32), - "imdbSeason" integer, - "imdbEpisode" integer, - "kitsuId" integer, - "kitsuEpisode" integer, - "createdAt" date, - "updatedAt" date, - FOREIGN KEY("infoHash") REFERENCES torrents("infoHash") ON DELETE CASCADE, - UNIQUE("infoHash","fileIndex") -); - -CREATE TABLE "subtitles" ( - "id" SERIAL PRIMARY KEY, - "infoHash" varchar(64) NOT NULL, - "fileIndex" integer NOT NULL, - "fileId" bigint, - "title" varchar(512) NOT NULL, - "size" bigint, - FOREIGN KEY("infoHash") REFERENCES torrents("infoHash") ON DELETE CASCADE, - FOREIGN KEY("fileId") REFERENCES files("id") ON DELETE SET NULL -); - -CREATE TABLE "contents" ( - "infoHash" varchar(64), - "fileIndex" integer, - "path" varchar(256), - "size" bigint, - FOREIGN KEY("infoHash") REFERENCES torrents("infoHash") ON DELETE CASCADE -); \ No newline at end of file diff --git a/addon/hosted/docker-compose.yml b/docker-compose.yml similarity index 64% rename from addon/hosted/docker-compose.yml rename to docker-compose.yml index 1778d00..b100970 100644 --- a/addon/hosted/docker-compose.yml +++ b/docker-compose.yml @@ -1,44 +1,49 @@ -version: '2' +--- + +version: '3.9' +name: torrentio-self-host services: + mongodb: - restart: always + restart: unless-stopped image: docker.io/bitnami/mongodb:7.0 ports: - "27017:27017" volumes: - - 'mongodb_data:/bitnami/mongodb' + - mongo-data:/bitnami/mongodb + scraper: - build: ../../scraper/ - restart: always - ports: - - "7001:7001" + build: ./scraper + restart: unless-stopped environment: - PORT=7001 - MONGODB_URI=mongodb://mongodb:27017/torrentio - DATABASE_URI=postgres://postgres@postgres:5432/torrentio + - ENABLE_SYNC=true + torrentio: - build: ../ - restart: always + build: ./addon + restart: unless-stopped ports: - "7000:7000" environment: - MONGODB_URI=mongodb://mongodb:27017/torrentio - DATABASE_URI=postgres://postgres@postgres:5432/torrentio + - ENABLE_SYNC=true + postgres: image: postgres:14-alpine + restart: unless-stopped ports: - 5432:5432 volumes: - - pg_data:/var/lib/postgresql/data - - './init:/docker-entrypoint-initdb.d' + - postgres-data:/var/lib/postgresql/data environment: - POSTGRES_HOST_AUTH_METHOD=trust - POSTGRES_USER=postgres - POSTGRES_DB=torrentio volumes: - mongodb_data: - driver: local - pg_data: - driver: local \ No newline at end of file + mongo-data: + postgres-data: \ No newline at end of file diff --git a/scraper/scheduler/scrapers.js b/scraper/scheduler/scrapers.js index aba31f6..22e5bcb 100644 --- a/scraper/scheduler/scrapers.js +++ b/scraper/scheduler/scrapers.js @@ -1,22 +1,22 @@ -const thepiratebayScraper = require('../scrapers/thepiratebay/thepiratebay_scraper'); -const thepiratebayFakeRemoval = require('../scrapers/thepiratebay/thepiratebay_fakes_removal'); +// const thepiratebayScraper = require('../scrapers/thepiratebay/thepiratebay_scraper'); +// const thepiratebayFakeRemoval = require('../scrapers/thepiratebay/thepiratebay_fakes_removal'); const ytsScraper = require('../scrapers/yts/yts_scraper'); const ytsFullScraper = require('../scrapers/yts/yts_full_scraper'); const eztvScraper = require('../scrapers/eztv/eztv_scraper'); const leetxScraper = require('../scrapers/1337x/1337x_scraper'); -const rarbgScraper = require('../scrapers/rarbg/rarbg_scraper'); +// const rarbgScraper = require('../scrapers/rarbg/rarbg_scraper'); const nyaaPantsuScraper = require('../scrapers/nyaapantsu/nyaa_pantsu_scraper'); const nyaaSiScraper = require('../scrapers/nyaasi/nyaa_si_scraper'); -const erairawsScraper = require('../scrapers/erairaws/erairaws_scraper'); -const torrentGalaxyScraper = require('../scrapers/torrentgalaxy/torrentgalaxy_scraper'); -const rutorScraper = require('../scrapers/rutor/rutor_scraper'); -const Comando = require('../scrapers/comando/comando_scraper') -const ComoEuBaixo = require('../scrapers/comoeubaixo/comoeubaixo_scraper') -const Lapumia = require('../scrapers/lapumia/lapumia_scraper') -const OndeBaixa = require('../scrapers/ondebaixa/ondebaixa_scraper'); -const AnimesTorrent = require('../scrapers/animestorrent/animestorrent_scraper') -const DarkMahou = require('../scrapers/darkmahou/darkmahou_scraper') -const torrent9Scraper = require('../scrapers/torrent9/torrent9_scraper'); +// const erairawsScraper = require('../scrapers/erairaws/erairaws_scraper'); +// const torrentGalaxyScraper = require('../scrapers/torrentgalaxy/torrentgalaxy_scraper'); +// const rutorScraper = require('../scrapers/rutor/rutor_scraper'); +// const Comando = require('../scrapers/comando/comando_scraper') +// const ComoEuBaixo = require('../scrapers/comoeubaixo/comoeubaixo_scraper') +// const Lapumia = require('../scrapers/lapumia/lapumia_scraper') +// const OndeBaixa = require('../scrapers/ondebaixa/ondebaixa_scraper'); +// const AnimesTorrent = require('../scrapers/animestorrent/animestorrent_scraper') +// const DarkMahou = require('../scrapers/darkmahou/darkmahou_scraper') +// const torrent9Scraper = require('../scrapers/torrent9/torrent9_scraper'); module.exports = [ { scraper: ytsScraper, name: ytsScraper.NAME, cron: '0 0 */4 ? * *' }, @@ -24,20 +24,20 @@ module.exports = [ { scraper: eztvScraper, name: eztvScraper.NAME, cron: '0 0 */4 ? * *' }, { scraper: nyaaSiScraper, name: nyaaSiScraper.NAME, cron: '0 0 */4 ? * *' }, { scraper: nyaaPantsuScraper, name: nyaaPantsuScraper.NAME, cron: '0 0 */4 ? * *' }, - { scraper: rarbgScraper, name: rarbgScraper.NAME, cron: '0 0 */1 ? * *' }, - { scraper: rutorScraper, name: rutorScraper.NAME, cron: '0 0 */4 ? * *' }, - { scraper: thepiratebayScraper, name: thepiratebayScraper.NAME, cron: '0 0 */2 ? * *' }, - { scraper: thepiratebayFakeRemoval, name: thepiratebayFakeRemoval.NAME, cron: '0 0 */12 ? * *' }, - { scraper: torrentGalaxyScraper, name: torrentGalaxyScraper.NAME, cron: '0 0 */4 ? * *' }, - { scraper: leetxScraper, name: leetxScraper.NAME, cron: '0 0 */4 ? * *' }, - { scraper: torrent9Scraper, name: torrent9Scraper.NAME, cron: '0 0 */4 ? * *' }, - { scraper: Comando, name: Comando.NAME, cron: '0 0 */4 ? * *' }, - { scraper: ComoEuBaixo, name: ComoEuBaixo.NAME, cron: '0 0 */4 ? * *' }, - { scraper: Lapumia, name: Lapumia.NAME, cron: '0 0 */4 ? * *' }, - { scraper: OndeBaixa, name: OndeBaixa.NAME, cron: '0 0 */4 ? * *' }, + // { scraper: rarbgScraper, name: rarbgScraper.NAME, cron: '0 0 */1 ? * *' }, + // { scraper: rutorScraper, name: rutorScraper.NAME, cron: '0 0 */4 ? * *' }, + // { scraper: thepiratebayScraper, name: thepiratebayScraper.NAME, cron: '0 0 */2 ? * *' }, + // { scraper: thepiratebayFakeRemoval, name: thepiratebayFakeRemoval.NAME, cron: '0 0 */12 ? * *' }, + // { scraper: torrentGalaxyScraper, name: torrentGalaxyScraper.NAME, cron: '0 0 */4 ? * *' }, + { scraper: leetxScraper, name: leetxScraper.NAME, cron: '0 0 */4 ? * *' } + // { scraper: torrent9Scraper, name: torrent9Scraper.NAME, cron: '0 0 */4 ? * *' }, + // { scraper: Comando, name: Comando.NAME, cron: '0 0 */4 ? * *' }, + // { scraper: ComoEuBaixo, name: ComoEuBaixo.NAME, cron: '0 0 */4 ? * *' }, + // { scraper: Lapumia, name: Lapumia.NAME, cron: '0 0 */4 ? * *' }, + // { scraper: OndeBaixa, name: OndeBaixa.NAME, cron: '0 0 */4 ? * *' }, // { scraper: AnimesTorrent, name: AnimesTorrent.NAME, cron: '0 0 */4 ? * *' }, // { scraper: DarkMahou, name: DarkMahou.NAME, cron: '0 0 */4 ? * *' }, - { scraper: erairawsScraper, name: erairawsScraper.NAME, cron: '0 0 */4 ? * *' }, + // { scraper: erairawsScraper, name: erairawsScraper.NAME, cron: '0 0 */4 ? * *' }, // { scraper: require('../scrapers/rarbg/rarbg_dump_scraper') } // { scraper: require('../scrapers/1337x/1337x_search_scraper') } // { scraper: require('../scrapers/rarbg/rarbg_dump_scraper') }