Started dockerfile
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
- Use in local mode without relying on a Invidious instance.
|
||||
- [Invidious companion support.](./docs/DOCKER.md#invidious-companion-support)
|
||||
- [Invidious API extended integration.](https://github.com/Materialious/api-extended)
|
||||
- [YouTube.js](https://github.com/LuanRT/YouTube.js) fallback if Invidious fails loading videos for Desktop & Android.
|
||||
- [YouTube.js](https://github.com/LuanRT/YouTube.js) fallback if Invidious fails loading videos.
|
||||
- Android TV support
|
||||
- Support for disabling certificate validation for homelab users.
|
||||
- Sync your watch progress between Invidious sessions.
|
||||
@@ -41,14 +41,12 @@
|
||||
- PWA support.
|
||||
- YT path redirects (So your redirect plugins should still work!)
|
||||
|
||||
# Support table
|
||||
| | Dash | HLS | Local video fallback | API-Extended | Dearrow | RYD | Watch Parties |
|
||||
|---------|------|-----|----------------------|--------------|---------|-----|----------------|
|
||||
| Web | ✅ | ✅ | ❌ | ✅ | ✅ | ✅ | ✅ |
|
||||
| Desktop | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
|
||||
| Android | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ |
|
||||
# Docker deployment
|
||||
[Please read the guide here](./docs/DOCKER-FULL.md)
|
||||
|
||||
# Legacy Docker deployment, Invidious only.
|
||||
This version of Materialious is still **fully** supported, but is purely just a Invidious frontend without any fancy bells and whistles.
|
||||
|
||||
# Deploying as a website via docker
|
||||
[Please read the guide here](./docs/DOCKER.md)
|
||||
|
||||
# Installing as a app
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
services:
|
||||
materialious:
|
||||
image: wardpearce/materialious
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- 3001:80
|
||||
environment:
|
||||
VITE_DEFAULT_INVIDIOUS_INSTANCE: "https://invidious.materialio.us"
|
||||
VITE_DEFAULT_RETURNYTDISLIKES_INSTANCE: "https://returnyoutubedislikeapi.com"
|
||||
VITE_DEFAULT_SPONSERBLOCK_INSTANCE: "https://sponsor.ajay.app"
|
||||
VITE_DEFAULT_DEARROW_INSTANCE: "https://sponsor.ajay.app"
|
||||
VITE_DEFAULT_DEARROW_THUMBNAIL_INSTANCE: "https://dearrow-thumb.ajay.app"
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
## Step 1: Docker
|
||||
|
||||
This Guide is for the docker image `wardpearce/materialious-full` **NOT** `wardpearce/materialious`
|
||||
|
||||
### Docker Compose
|
||||
|
||||
```yaml
|
||||
services:
|
||||
materialious:
|
||||
image: wardpearce/materialious-full:latest
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- 3000:3000
|
||||
environment:
|
||||
# Secure secret for signing cookies
|
||||
# Not required if VITE_INTERNAL_AUTH is false
|
||||
COOKIE_SECRET: ""
|
||||
|
||||
# Database connectiong URI
|
||||
# Not required if VITE_INTERNAL_AUTH is false
|
||||
# postgresql, mysql2, mariadb & sqlite supported
|
||||
# guide here for URL structure https://docs.preset.io/docs/uri-connection-strings
|
||||
DATABASE_CONNECTION_URI: "sqlite://materialious.db"
|
||||
|
||||
# Use Materialious account system.
|
||||
VITE_INTERNAL_AUTH: "true"
|
||||
|
||||
# If Auth is required to use this instance.
|
||||
# Should be left as true, otherwise anyone can use Materialious proxy.
|
||||
VITE_REQUIRE_AUTH: "true"
|
||||
|
||||
# Allow anyone to register
|
||||
VITE_REGISTRATION_ALLOWED: "false"
|
||||
|
||||
# Allow any domain in proxy
|
||||
# This shouldn't be used unless you KNOW what your doing
|
||||
# requires VITE_REGISTRATION_ALLOWED to be false
|
||||
# VITE_REQUIRE_AUTH to be true
|
||||
# VITE_INTERNAL_AUTH to be true
|
||||
# to take effect.
|
||||
VITE_DANGEROUS_ALLOW_ANY_PROXY: "false"
|
||||
|
||||
# Optionally set a default Invidious instance
|
||||
# This will also whitelist this instance in the proxy.
|
||||
VITE_DEFAULT_INVIDIOUS_INSTANCE: "https://invidious.materialio.us"
|
||||
|
||||
# URL Companion instance
|
||||
# This will also whitelist this instance in the proxy.
|
||||
VITE_DEFAULT_COMPANION_INSTANCE: "https://companion.materialio.us"
|
||||
|
||||
# URL TO RYD (Return YouTube Dislike / https://github.com/Anarios/return-youtube-dislike)
|
||||
# Leave blank to disable completely.
|
||||
# This will also whitelist this instance in the proxy.
|
||||
VITE_DEFAULT_RETURNYTDISLIKES_INSTANCE: "https://returnyoutubedislikeapi.com"
|
||||
|
||||
# URL to Sponsorblock
|
||||
# Leave blank to completely disable sponsorblock.
|
||||
# This will also whitelist this instance in the proxy.
|
||||
VITE_DEFAULT_SPONSERBLOCK_INSTANCE: "https://sponsor.ajay.app"
|
||||
|
||||
# URL to DeArrow
|
||||
# This will also whitelist this instance in the proxy.
|
||||
VITE_DEFAULT_DEARROW_INSTANCE: "https://sponsor.ajay.app"
|
||||
|
||||
# URL to DeArrow thumbnail instance
|
||||
# This will also whitelist this instance in the proxy.
|
||||
VITE_DEFAULT_DEARROW_THUMBNAIL_INSTANCE: "https://dearrow-thumb.ajay.app"
|
||||
|
||||
# Look at "Overwriting Materialious defaults" for all the accepted values.
|
||||
# This will also whitelist this instance in the proxy.
|
||||
VITE_DEFAULT_SETTINGS: '{"themeColor": "#2596be","region": "US"}'
|
||||
|
||||
volumes:
|
||||
- materialious-data:/materialious.db
|
||||
|
||||
volumes:
|
||||
materialious-data:
|
||||
```
|
||||
|
||||
### Overwriting Materialious defaults
|
||||
Materialious allows you to overwrite the default values using `VITE_DEFAULT_SETTINGS`, see [SETTINGS](./SETTINGS.md) for more details.
|
||||
|
||||
**Please note:** These overwrites only apply on 1st load & won't replace existing configuration stored in browser local storage.
|
||||
|
||||
## Step 2 (Optional, but recommended): Self-host RYD-Proxy
|
||||
#### With TOR (Recommended)
|
||||
```yml
|
||||
tor-proxy:
|
||||
image: 1337kavin/alpine-tor:latest
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
- tors=15
|
||||
|
||||
ryd-proxy:
|
||||
image: 1337kavin/ryd-proxy:latest
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- tor-proxy
|
||||
environment:
|
||||
- PROXY=socks5://tor-proxy:5566
|
||||
ports:
|
||||
- 3003:3000
|
||||
```
|
||||
#### Without TOR
|
||||
```yml
|
||||
ryd-proxy:
|
||||
image: 1337kavin/ryd-proxy:latest
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- 3003:3000
|
||||
```
|
||||
|
||||
Modify/add `VITE_DEFAULT_RETURNYTDISLIKES_INSTANCE` for Materialious to be the reverse proxied URL of RYD-Proxy.
|
||||
|
||||
## Step 3 (Optional, but recommended): Self-host Invidious API extended
|
||||
```yaml
|
||||
services:
|
||||
api_extended:
|
||||
image: wardpearce/invidious_api_extended:latest
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- 3004:80
|
||||
environment:
|
||||
api_extended_postgre: '{"host": "invidious-db", "port": 5432, "database": "invidious", "user": "kemal", "password": "kemal"}'
|
||||
api_extended_allowed_origins: '["https://materialious.example.com"]'
|
||||
api_extended_debug: false
|
||||
|
||||
# No trailing backslashes!
|
||||
api_extended_invidious_instance: "https://invidious.example.com"
|
||||
api_extended_production_instance: "https://syncious.example.com"
|
||||
```
|
||||
|
||||
Add these additional environment variables to Materialious.
|
||||
```yaml
|
||||
VITE_DEFAULT_API_EXTENDED_INSTANCE: "https://syncious.example.com"
|
||||
```
|
||||
|
||||
## Step 6 (Optional): Self-host PeerJS
|
||||
[Read the official guide.](https://github.com/peers/peerjs-server?tab=readme-ov-file#docker)
|
||||
|
||||
Add these additional environment variables to Materialious.
|
||||
```yaml
|
||||
# Will differ depending on how you self-host peerjs.
|
||||
VITE_DEFAULT_PEERJS_HOST: "peerjs.example.com"
|
||||
VITE_DEFAULT_PEERJS_PATH: "/"
|
||||
VITE_DEFAULT_PEERJS_PORT: 443
|
||||
```
|
||||
@@ -1,5 +1,7 @@
|
||||
# Setup
|
||||
|
||||
This Guide is for the docker image `wardpearce/materialious` **NOT** `wardpearce/materialious-full`
|
||||
|
||||
### CORS
|
||||
To assure browsers they are allowed to access your Materialious instance
|
||||
despite their default [same-origin policy][wp-sop], the instance's webserver
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
.git
|
||||
.gitignore
|
||||
.gitattributes
|
||||
README.md
|
||||
.npmrc
|
||||
.prettierrc
|
||||
.eslintrc.cjs
|
||||
.graphqlrc
|
||||
.editorconfig
|
||||
.svelte-kit
|
||||
.vscode
|
||||
node_modules
|
||||
build
|
||||
package
|
||||
**/.env
|
||||
@@ -1,3 +1,5 @@
|
||||
# This is the docker file for legacy deployment wardpearce/materialious
|
||||
|
||||
FROM node:latest AS builder
|
||||
|
||||
# Set the working directory
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
FROM node:24-alpine AS builder
|
||||
WORKDIR /app
|
||||
|
||||
COPY . .
|
||||
|
||||
RUN npm ci
|
||||
|
||||
# Tell SvelteKit to use node adapter.
|
||||
ENV VITE_BUILD_WITH_BACKEND="true"
|
||||
|
||||
RUN npm run build
|
||||
RUN npm prune --omit=dev
|
||||
|
||||
FROM node:24-alpine
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY --from=builder /app/build build/
|
||||
COPY --from=builder /app/node_modules node_modules/
|
||||
|
||||
COPY package.json .
|
||||
EXPOSE 3000
|
||||
ENV NODE_ENV=production
|
||||
|
||||
CMD ["node", "build"]
|
||||
Generated
+185
-325
File diff suppressed because it is too large
Load Diff
+10
-10
@@ -30,23 +30,13 @@
|
||||
"@types/jsdom": "^27.0.0",
|
||||
"@types/mousetrap": "^1.6.15",
|
||||
"@vite-pwa/sveltekit": "^1.0.0",
|
||||
"altcha-lib": "^1.4.1",
|
||||
"eslint": "^9.39.1",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-svelte": "^3.13.0",
|
||||
"jsdom": "^28.0.0",
|
||||
"mariadb": "^3.4.5",
|
||||
"mysql2": "^3.17.1",
|
||||
"patch-package": "^8.0.1",
|
||||
"pg": "^8.18.0",
|
||||
"pg-hstore": "^2.3.4",
|
||||
"prettier": "^3.6.2",
|
||||
"prettier-plugin-svelte": "^3.4.0",
|
||||
"psl": "^1.15.0",
|
||||
"sequelize": "^6.37.7",
|
||||
"sqlite3": "^5.1.7",
|
||||
"svelte": "^5.47.0",
|
||||
"svelte-awesome-color-picker": "^4.1.1",
|
||||
"svelte-check": "^4.3.3",
|
||||
"tslib": "^2.7.0",
|
||||
"typescript": "^5.9.3",
|
||||
@@ -68,6 +58,7 @@
|
||||
"@macfja/serializer": "^1.1.4",
|
||||
"@macfja/svelte-persistent-store": "^2.4.2",
|
||||
"altcha": "^2.3.0",
|
||||
"altcha-lib": "^1.4.1",
|
||||
"beercss": "^4.0.2",
|
||||
"bgutils-js": "^3.2.0",
|
||||
"buffer": "^6.0.3",
|
||||
@@ -84,14 +75,23 @@
|
||||
"i18next": "^25.7.2",
|
||||
"iso-3166": "^4.4.0",
|
||||
"iso-639-1": "^3.1.5",
|
||||
"jsdom": "^28.0.0",
|
||||
"libsodium-wrappers-sumo": "^0.8.2",
|
||||
"mariadb": "^3.4.5",
|
||||
"material-dynamic-colors": "^1.1.1",
|
||||
"media-captions": "^1.0.4",
|
||||
"melt": "^0.44.0",
|
||||
"mousetrap": "^1.6.5",
|
||||
"mysql2": "^3.17.1",
|
||||
"peerjs": "^1.5.5",
|
||||
"pg": "^8.18.0",
|
||||
"pg-hstore": "^2.3.4",
|
||||
"psl": "^1.15.0",
|
||||
"sequelize": "^6.37.7",
|
||||
"shaka-player": "^4.16.14",
|
||||
"sponsorblock-api": "^0.2.4",
|
||||
"sqlite3": "^5.1.7",
|
||||
"svelte-awesome-color-picker": "^4.1.1",
|
||||
"svelte-infinite-loading": "^1.4.0",
|
||||
"youtubei.js": "^16.0.1",
|
||||
"zod": "^4.3.6"
|
||||
|
||||
@@ -11,12 +11,12 @@ sodium.ready.then(() => {
|
||||
|
||||
let sequelizeAuthenticated = false;
|
||||
export async function handle({ event, resolve }) {
|
||||
event.locals.captchaKey = captchaKey;
|
||||
|
||||
if (!isOwnBackend()?.internalAuth) {
|
||||
return await resolve(event);
|
||||
}
|
||||
|
||||
event.locals.captchaKey = captchaKey;
|
||||
|
||||
const sequelize = getSequelize();
|
||||
if (!sequelizeAuthenticated) {
|
||||
await sequelize.sequelize.sync();
|
||||
@@ -28,6 +28,10 @@ export async function handle({ event, resolve }) {
|
||||
throw new Error('Cookie secret must be set');
|
||||
}
|
||||
|
||||
if (env.COOKIE_SECRET.length < 16) {
|
||||
throw new Error('COOKIE_SECRET must be at least 16 characters long');
|
||||
}
|
||||
|
||||
const signedUserId = event.cookies.get('userid');
|
||||
if (signedUserId) {
|
||||
const userId = unsign(signedUserId, env.COOKIE_SECRET);
|
||||
|
||||
@@ -23,11 +23,11 @@ export function getSequelize(): {
|
||||
};
|
||||
}
|
||||
|
||||
sequelizeInstance = new Sequelize(
|
||||
env.DATABASE_CONNECTION_URI ? env.DATABASE_CONNECTION_URI : 'sqlite::memory:'
|
||||
);
|
||||
if (!env.DATABASE_CONNECTION_URI) {
|
||||
throw new Error('DATABASE_CONNECTION_URI must be set');
|
||||
}
|
||||
|
||||
console.log('sequelizeInstance');
|
||||
sequelizeInstance = new Sequelize(env.DATABASE_CONNECTION_URI);
|
||||
|
||||
UserTable = sequelizeInstance.define(
|
||||
'User',
|
||||
|
||||
@@ -19,7 +19,8 @@ const dynamicAllowDomains = [
|
||||
env.VITE_DEFAULT_INVIDIOUS_INSTANCE,
|
||||
env.VITE_DEFAULT_RETURNYTDISLIKES_INSTANCE,
|
||||
env.VITE_DEFAULT_API_EXTENDED_INSTANCE,
|
||||
env.VITE_DEFAULT_SYNCIOUS_INSTANCE
|
||||
env.VITE_DEFAULT_SYNCIOUS_INSTANCE,
|
||||
env.VITE_DEFAULT_COMPANION_INSTANCE
|
||||
];
|
||||
|
||||
dynamicAllowDomains.forEach((domain) => {
|
||||
|
||||
@@ -6,7 +6,7 @@ import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
||||
const useSsr = process.env.VITE_BUILD_WITH_BACKEND === 'true';
|
||||
|
||||
const adapter = useSsr
|
||||
? adapterNode()
|
||||
? adapterNode({ out: 'build', precompress: true })
|
||||
: adapterStatic({
|
||||
fallback: 'index.html'
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user