diff --git a/.dockerignore b/.dockerignore index ca42186d..7a40d12d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,8 +3,13 @@ .git .gitignore node_modules -invidious-source json.sqlite *.md -docker-compose.yml -Dockerfile \ No newline at end of file +/docker-compose.yml +/Dockerfile +/config.json +/january +/pokevidious +/p +/t +/sdk diff --git a/Dockerfile b/Dockerfile index 605becdb..589cc4f5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,10 +2,14 @@ ## docker build -t poketube . ## To run the image, run: -## docker run -d -p 6003:6003 poketube +## docker run -p 6003:6003 -v ./config.json:/poketube/config.json:ro poketube +## but preferably, use the docker-compose.yml file -# Base (Debian) -FROM debian +# Base +FROM node:16-alpine + +# Install dependencies +RUN apk add --no-cache git build-base python3 # Set Work Directory WORKDIR /poketube @@ -14,21 +18,8 @@ COPY . /poketube # Expose Ports EXPOSE 6003 -# Install Requirements -RUN apt-get update && apt-get -y install \ - libcurl4-openssl-dev make g++ ca-certificates curl gnupg - -# Install NodeJS v18 -RUN mkdir -p /etc/apt/keyrings -RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg - -RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_16.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list - -RUN apt-get update -RUN apt-get -y install nodejs npm - -# Install Packages +# Install Dependencies RUN npm install -# Run -CMD npm start \ No newline at end of file +# Start the app +CMD ["npm", "start"] diff --git a/config.json b/config.json index 8482680b..b48cf3f3 100644 --- a/config.json +++ b/config.json @@ -1,17 +1,17 @@ { - "tubeApi": "https://inner-api.poketube.fun/api/", - "invapi": "https://invid-api.poketube.fun/api/v1", - "dislikes": "https://returnyoutubedislikeapi.com/votes?videoId=", - "invchannel": "https://invid-api.poketube.fun/api/v1", - "p_url":"https://p.poketube.fun", - "media_proxy": "https://image-proxy.poketube.fun", - "videourl":"https://eu-proxy.poketube.fun", - "email_main_url":"https://email-server.poketube.fun", - "mastodon_client_url":"https://fediverse.poketube.fun", - "libreoffice_online_url":"https://office.poketube.fun", - "cacher_max_age": "864000", - "enablealwayshttps": false, - "proxylocation":"USA", - "t_url": "https://t.poketube.fun/", - "server_port": "6003" - } \ No newline at end of file + "tubeApi": "http://lighttube:80/api", + "invapi": "http://invidious:3000/api/v1", + "dislikes": "https://returnyoutubedislikeapi.com/votes?videoId=", + "invchannel": "http://invidious:3000/api/v1", + "p_url": "http://p.poketube.test", + "media_proxy": "http://image-proxy.poketube.test", + "videourl": "http://eu-proxy.poketube.test", + "email_main_url": "https://email-server.poketube.fun", + "mastodon_client_url": "https://fediverse.poketube.fun", + "libreoffice_online_url": "https://office.poketube.fun", + "cacher_max_age": "864000", + "enablealwayshttps": false, + "proxylocation": "USA", + "t_url": "https://t.poketube.fun/", + "server_port": "6003" +} diff --git a/docker-compose.yml b/docker-compose.yml index 3a9b4b8a..e02fb6fc 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,9 +1,92 @@ -# To run, please do either docker compose up -d (for docker's own version) or docker-compose up -d (for your OSes package managers verison) +# To run this entire stack (contains all services): + +# 1. Verify you have docker and docker-compose +# 2. Make sure this repository is cloned recursively (check if the `pokevidious` folder has stuff in it) +# 3. Adjust domains in `docker/Caddyfile` and `config.json` +# DO NOT touch tubeApi, invapi, invchannel, videourl in `config.json` unless you know what you are doing +# 4. Optionally replace `build` with `image` in some services to save time on building +# 5. Run `docker-compose up -d` or `docker compose up -d` (notice the dash) + services: - poketube: - image: quay.io/sudovanilla/poketube + poketube: # port 6003 + # image: quay.io/sudovanilla/poketube + build: + context: . + dockerfile: Dockerfile + depends_on: + - invidious + - lighttube + - january restart: unless-stopped volumes: - - ./config.json:/poketube/config.json + - ./config.json:/poketube/config.json:ro + + # lighttube - tubeApi + lighttube: # port 80 + image: docker.io/kuylar/lighttube:20220711 + depends_on: + - mongo + restart: unless-stopped + volumes: + - ./docker/lighttube.yaml:/etc/lighttube.yml:ro + mongo: # port 27017 + image: docker.io/mongo:latest + env_file: ./docker/mongo.env + restart: unless-stopped + volumes: + - ./docker/data/mongo:/data/db + + # invidious - invapi, invchannel and videourl + invidious: # port 3000 + image: quay.io/invidious/invidious:latest + # build: + # context: pokevidious + # dockerfile: docker/Dockerfile + depends_on: + - postgres + restart: unless-stopped + deploy: + replicas: 2 # Adjust number depending on server load + volumes: + - ./docker/invidious.yaml:/invidious/config/config.yml:ro + postgres: # port 5432 + image: docker.io/library/postgres:14 + env_file: ./docker/postgres.env + restart: unless-stopped + volumes: + - ./docker/data/postgres:/var/lib/postgresql/data + - ./pokevidious/config/sql:/config/sql:ro + - ./pokevidious/docker/init-invidious-db.sh:/docker-entrypoint-initdb.d/init-invidious-db.sh:ro + + # january - media_proxy + january: # port 7000 + # image: ghcr.io/revoltchat/january:latest + build: + context: january + dockerfile: Dockerfile + restart: unless-stopped + + # p / pproxy - some kind of proxy idk + pproxy: # port 6014 + build: + context: p + dockerfile: Dockerfile + volumes: + - ./docker/pproxy.json:/pproxy/whitelist.json:ro + restart: unless-stopped + + # caddy - reverse proxy to connect everything together + caddy: # exposed ports 80, 443 / 8090 + image: docker.io/caddy:latest + restart: unless-stopped + volumes: + - ./docker/Caddyfile:/etc/caddy/Caddyfile:ro + - ./docker/data/caddy:/data ports: - - "6003:6003" \ No newline at end of file + # Notice this is the only service with ports exposed + - 80:80 + - 443:443 + # If you are running another proxy on the host and the ports are taken + # ... use this instead, and proxy the relevant domains to 127.0.0.1:8090 + # Be aware that browsers will refuse + # - 127.0.0.1:8090:80 diff --git a/docker/.gitignore b/docker/.gitignore new file mode 100644 index 00000000..3af0ccb6 --- /dev/null +++ b/docker/.gitignore @@ -0,0 +1 @@ +/data diff --git a/docker/Caddyfile b/docker/Caddyfile new file mode 100644 index 00000000..a9ac870e --- /dev/null +++ b/docker/Caddyfile @@ -0,0 +1,23 @@ +# You may want to remove the http:// part for automatic HTTPS +# This is needed here because we're testing locally + +http://poketube.test { + reverse_proxy poketube:6003 +} + +http://image-proxy.poketube.test { + reverse_proxy january:7000 +} + +http://eu-proxy.poketube.test { + @invidious { + path /videoplayback* + path /latest_version* + } + + reverse_proxy @invidious invidious:3000 +} + +http://p.poketube.test { + reverse_proxy pproxy:6014 +} diff --git a/docker/invidious.yaml b/docker/invidious.yaml new file mode 100644 index 00000000..c3d33c10 --- /dev/null +++ b/docker/invidious.yaml @@ -0,0 +1,8 @@ +db: + dbname: invidious + user: postgres + password: postgres + host: postgres + port: 5432 +check_tables: true +hmac_key: ujZnZzcMoxg2pEjdV52c diff --git a/docker/lighttube.yaml b/docker/lighttube.yaml new file mode 100644 index 00000000..cddd2ed0 --- /dev/null +++ b/docker/lighttube.yaml @@ -0,0 +1,8 @@ +Interface: + MessageOfTheDay: meow +Credentials: + UseCredentials: false + Sapisid: + Psid: +Database: + MongoConnectionString: mongodb://lighttube:lighttube@mongo:27017/ diff --git a/docker/mongo.env b/docker/mongo.env new file mode 100644 index 00000000..d2ebf37e --- /dev/null +++ b/docker/mongo.env @@ -0,0 +1,2 @@ +MONGO_INITDB_ROOT_USERNAME=lighttube +MONGO_INITDB_ROOT_PASSWORD=lighttube diff --git a/docker/postgres.env b/docker/postgres.env new file mode 100644 index 00000000..7e67fa44 --- /dev/null +++ b/docker/postgres.env @@ -0,0 +1,3 @@ +POSTGRES_DB=invidious +POSTGRES_USER=postgres +POSTGRES_PASSWORD=postgres diff --git a/docker/pproxy.json b/docker/pproxy.json new file mode 100644 index 00000000..ddf64568 --- /dev/null +++ b/docker/pproxy.json @@ -0,0 +1,32 @@ +[ + "i.ytimg.com", + "yt3.googleusercontent.com", + "cdn.glitch.global", + "cdn.statically.io", + "site-assets.fontawesome.com", + "fonts.gstatic.com", + "cdn.jsdelivr.net", + "yt3.ggpht.com", + "tube.kuylar.dev", + "lh3.googleusercontent.com", + "is4-ssl.mzstatic.com", + "is2-ssl.mzstatic.com", + "is1-ssl.mzstatic.com", + "fonts.bunny.net", + "demo.matomo.org", + "is5-ssl.mzstatic.com", + "is3-ssl.mzstatic.com", + "twemoji.maxcdn.com", + "unpkg.com", + "lite.duckduckgo.com", + "youtube.com", + "returnyoutubedislikeapi.com", + "cdn.zptr.cc", + "inv.vern.cc", + "invidious.privacydev.net", + "inv.zzls.xyz", + "vid.puffyan.us", + "invidious.lidarshield.cloud", + "invidious.epicsite.xyz", + "invidious.esmailelbob.xyz" +]