dockerize the whole thing

This commit is contained in:
wait-what 2024-04-23 00:38:01 +03:00
parent 7d2776584b
commit 74c7e7d051
11 changed files with 199 additions and 43 deletions

View file

@ -3,8 +3,13 @@
.git
.gitignore
node_modules
invidious-source
json.sqlite
*.md
docker-compose.yml
Dockerfile
/docker-compose.yml
/Dockerfile
/config.json
/january
/pokevidious
/p
/t
/sdk

View file

@ -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
# Start the app
CMD ["npm", "start"]

View file

@ -1,11 +1,11 @@
{
"tubeApi": "https://inner-api.poketube.fun/api/",
"invapi": "https://invid-api.poketube.fun/api/v1",
"tubeApi": "http://lighttube:80/api",
"invapi": "http://invidious:3000/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",
"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",

View file

@ -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"
# 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

1
docker/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/data

23
docker/Caddyfile Normal file
View file

@ -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
}

8
docker/invidious.yaml Normal file
View file

@ -0,0 +1,8 @@
db:
dbname: invidious
user: postgres
password: postgres
host: postgres
port: 5432
check_tables: true
hmac_key: ujZnZzcMoxg2pEjdV52c

8
docker/lighttube.yaml Normal file
View file

@ -0,0 +1,8 @@
Interface:
MessageOfTheDay: meow
Credentials:
UseCredentials: false
Sapisid:
Psid:
Database:
MongoConnectionString: mongodb://lighttube:lighttube@mongo:27017/

2
docker/mongo.env Normal file
View file

@ -0,0 +1,2 @@
MONGO_INITDB_ROOT_USERNAME=lighttube
MONGO_INITDB_ROOT_PASSWORD=lighttube

3
docker/postgres.env Normal file
View file

@ -0,0 +1,3 @@
POSTGRES_DB=invidious
POSTGRES_USER=postgres
POSTGRES_PASSWORD=postgres

32
docker/pproxy.json Normal file
View file

@ -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"
]