An alternative front-end to YouTube
- Clone the repository.
- Edit the
docker-compose.yml
file per the installation instructions. - From the root directory, execute
docker-compose up
to start the application and PostgreSQL database. - Generate data for the application.
- Run YugabyteDB in Docker:
docker run -d --name yugabyte -p7000:7000 -p9000:9000 -p15433:15433 -p5433:5433 -p9042:9042 --network db_migration_network \
yugabytedb/yugabyte:2024.1.1.0-b137 bin/yugabyted start \
--background=false \
--enable_pg_parity_tech_preview
- Execute offline migration. Note: Remove UNLOGGED from table definition
- Create
docker-compose-yb.yml
file and point to YugabyteDB instance.... db: dbname: invidious user: yugabyte password: yugabyte host: host.docker.internal port: 5433
- Edit insert function in
channels.cr
.
NOTE: In its original form, this function dynamically queries the database and returns a boolean value based on the xmax
column of the database. This column is part of the PostgreSQL storage layer and is not supported by YugabyteDB. This function can easily be rewritten to work with YugabyteDB.
def insert(video : ChannelVideo, with_premiere_timestamp : Bool = false) : Bool
if with_premiere_timestamp
last_items = "premiere_timestamp = $9, views = $10"
else
last_items = "views = $10"
end
request = <<-SQL
INSERT INTO channel_videos
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
ON CONFLICT (id) DO UPDATE
SET title = $2, published = $3, updated = $4, ucid = $5,
author = $6, length_seconds = $7, live_now = $8, #{last_items}
RETURNING id
SQL
# If a row is returned, the operation was successful
result = PG_DB.query_one?(request, *video.to_tuple, as: String?)
return result.not_nil?
end
- Build Docker image from root directory.
docker build -t invidious-local-image -f ./docker/Dockerfile .
- Update
docker-compose-yb.yml
to use this newly-build Docker image.
...
image: invidious-local-image:latest
- Run application services.
docker-compose up