ソースを参照

Fix merge conflicts

Nicolas Meienberger 3 年 前
コミット
d8fd99d67c

+ 2 - 0
.gitignore

@@ -16,7 +16,9 @@ tipi.config.json
 !nignx/.gitkeep
 
 media/data/movies/*
+media/data/tv/*
 !media/data/movies/.gitkeep
+!media/data/tv/.gitkeep
 
 media/torrents/*
 !media/torrents/.gitkeep

+ 12 - 0
apps/filebrowser/config.json

@@ -0,0 +1,12 @@
+{
+  "name": "File Browser",
+  "port": 8096,
+  "id": "filebrowser",
+  "description": "Reliable and Performant File Management Desktop Sync and File Sharing",
+  "short_desc": "Access your homeserver files from your browser",
+  "author": "",
+  "website": "https://filebrowser.org/",
+  "source": "https://github.com/filebrowser/filebrowser",
+  "image": "https://avatars.githubusercontent.com/u/35781395?s=200&v=4",
+  "form_fields": {}
+}

+ 0 - 0
apps/filebrowser/data/filebrowser.db


+ 8 - 0
apps/filebrowser/data/settings.json

@@ -0,0 +1,8 @@
+{
+  "port": 80,
+  "baseURL": "",
+  "address": "",
+  "log": "stdout",
+  "database": "/database/filebrowser.db",
+  "root": "/srv"
+}

+ 15 - 0
apps/filebrowser/docker-compose.yml

@@ -0,0 +1,15 @@
+services:
+  filebrowser:
+    container_name: filebrowser
+    image: filebrowser/filebrowser:s6
+    ports:
+      - ${APP_PORT}:80
+    environment:
+      - PUID=1000
+      - PGID=1000
+    volumes:
+      - ${ROOT_FOLDER}:/srv
+      - ${APP_DATA_DIR}/data/filebrowser.db:/database/filebrowser.db
+      - ${APP_DATA_DIR}/data/settings.json:/config/settings.json
+    networks:
+      - tipi_main_network

+ 13 - 0
apps/jackett/config.json

@@ -0,0 +1,13 @@
+{
+  "name": "Jackett",
+  "port": 8097,
+  "id": "jackett",
+  "description": "Jackett works as a proxy server: it translates queries from apps (Sonarr, Radarr, SickRage, CouchPotato, Mylar3, Lidarr, DuckieTV, qBittorrent, Nefarious etc.) into tracker-site-specific http queries, parses the html or json response, and then sends results back to the requesting software. This allows for getting recent uploads (like RSS) and performing searches.",
+  "short_desc": "API Support for your favorite torrent trackers ",
+  "author": "",
+  "source": "https://github.com/Jackett/Jackett",
+  "image": "https://avatars.githubusercontent.com/u/15383019?s=200&v=4",
+  "form_fields": {
+    
+  }
+}

+ 20 - 0
apps/jackett/docker-compose.yml

@@ -0,0 +1,20 @@
+version: "3.7"
+services:
+  jackett:
+    image: lscr.io/linuxserver/jackett
+    container_name: jackett
+    environment:
+      - PUID=1000
+      - PGID=1000
+      - TZ=${TZ}
+      - AUTO_UPDATE=true
+    dns:
+      - ${DNS_IP}
+    volumes:
+      - ${APP_DATA_DIR}/data:/config
+      - ${ROOT_FOLDER}/media/torrents:/downloads
+    ports:
+      - ${APP_PORT}:9117
+    restart: unless-stopped
+    networks:
+      - tipi_main_network

+ 1 - 1
apps/jellyfin/docker-compose.yml

@@ -6,7 +6,7 @@ services:
     container_name: jellyfin
     volumes:
       - ${APP_DATA_DIR}/data/config:/config
-      - ${ROOT_FOLDER}/media/data/movies:/data/media
+      - ${ROOT_FOLDER}/media/data:/data/media
     environment:
       - PUID=1000
       - PGID=1000

+ 13 - 0
apps/joplin/README.md

@@ -0,0 +1,13 @@
+Joplin is a free, open source note taking and to-do application, which can handle a large number of notes organised into notebooks. The notes are searchable, can be copied, tagged and modified either from the applications directly or from your own text editor. The notes are in Markdown format.
+Notes exported from Evernote can be imported into Joplin, including the formatted content (which is converted to Markdown), resources (images, attachments, etc.) and complete metadata (geolocation, updated time, created time, etc.). Plain Markdown files can also be imported.
+
+The notes can be securely synchronised using end-to-end encryption with various cloud services including Nextcloud, Dropbox, OneDrive and Joplin Cloud.
+
+Full text search is available on all platforms to quickly find the information you need. The app can be customised using plugins and themes, and you can also easily create your own.
+
+The application is available for Windows, Linux, macOS, Android and iOS. A Web Clipper, to save web pages and screenshots from your browser, is also available for Firefox and Chrome.
+
+## Credentials
+
+Username: admin@localhost
+Password: admin

+ 12 - 0
apps/joplin/config.json

@@ -0,0 +1,12 @@
+{
+  "name": "Joplin Server",
+  "port": 8099,
+  "id": "joplin",
+  "description": "",
+  "short_desc": "Note taking and to-do application with synchronisation",
+  "author": "https://github.com/laurent22",
+  "source": "https://github.com/laurent22/joplin",
+  "website": "https://joplinapp.org",
+  "image": "https://raw.githubusercontent.com/laurent22/joplin/dev/Assets/LinuxIcons/256x256.png",
+  "form_fields": {}
+}

+ 38 - 0
apps/joplin/docker-compose.yml

@@ -0,0 +1,38 @@
+version: "3.7"
+
+services:
+  db-joplin:
+    container_name: db-joplin
+    image: postgres:14.2
+    volumes:
+      - ${APP_DATA_DIR}/data/postgres:/var/lib/postgresql/data
+    restart: unless-stopped
+    environment:
+      - POSTGRES_PASSWORD=tipi
+      - POSTGRES_USER=tipi
+      - POSTGRES_DB=joplin
+    networks:
+      - tipi_main_network
+
+  joplin:
+    container_name: joplin
+    image: florider89/joplin-server:2.7.4
+    restart: unless-stopped
+    depends_on:
+      - db-joplin
+    ports:
+      - ${APP_PORT}:22300
+    dns:
+      - ${DNS_IP}
+    environment:
+      - APP_PORT=22300
+      - APP_BASE_URL=http://${INTERNAL_IP}:${APP_PORT}
+      - DB_CLIENT=pg
+      - POSTGRES_PASSWORD=tipi
+      - POSTGRES_USER=tipi
+      - POSTGRES_DATABASE=joplin
+      - POSTGRES_PORT=5432
+      - POSTGRES_HOST=db-joplin
+      - MAX_TIME_DRIFT=0
+    networks:
+      - tipi_main_network

+ 1 - 1
apps/pihole/docker-compose.yml

@@ -13,7 +13,7 @@ services:
 
   pihole:
     depends_on: [unbound]
-    container_name: pihole:2022.04.3
+    container_name: pihole
     image: pihole/pihole:latest
     restart: unless-stopped
     hostname: pihole

+ 3 - 18
apps/radarr/docker-compose.yml

@@ -1,22 +1,5 @@
 version: "3.7"
 services:
-  jackett:
-    image: lscr.io/linuxserver/jackett
-    container_name: jackett
-    environment:
-      - PUID=1000
-      - PGID=1000
-      - TZ=${TZ}
-      - AUTO_UPDATE=true
-    volumes:
-      - ${APP_DATA_DIR}/data/jackett:/config
-      - ${ROOT_FOLDER}/media/torrents:/downloads
-    ports:
-      - 9117:9117
-    restart: unless-stopped
-    networks:
-      - tipi_main_network
-
   radarr:
     image: lscr.io/linuxserver/radarr
     container_name: radarr
@@ -24,8 +7,10 @@ services:
       - PUID=1000
       - PGID=1000
       - TZ=${TZ}
+    dns:
+      - ${DNS_IP}
     volumes:
-      - ${APP_DATA_DIR}/data/radarr:/config
+      - ${APP_DATA_DIR}/data:/config
       - ${ROOT_FOLDER}/media/data/movies:/movies #optional
       - ${ROOT_FOLDER}/media/torrents:/downloads #optional
     ports:

+ 13 - 0
apps/sonarr/config.json

@@ -0,0 +1,13 @@
+{
+  "name": "Sonarr",
+  "port": 8098,
+  "id": "sonarr",
+  "description": "",
+  "short_desc": "",
+  "author": "",
+  "source": "",
+  "image": "https://avatars.githubusercontent.com/u/1082903?s=200&v=4",
+  "form_fields": {
+
+  }
+}

+ 20 - 0
apps/sonarr/docker-compose.yml

@@ -0,0 +1,20 @@
+version: "3.7"
+services:
+  radarr:
+    image: lscr.io/linuxserver/sonarr
+    container_name: sonarr
+    environment:
+      - PUID=1000
+      - PGID=1000
+      - TZ=${TZ}
+    dns:
+      - ${DNS_IP}
+    volumes:
+      - ${APP_DATA_DIR}/data:/config
+      - ${ROOT_FOLDER}/media/data/tv:/tv #optional
+      - ${ROOT_FOLDER}/media/torrents:/downloads #optional
+    ports:
+      - ${APP_PORT}:8989
+    restart: unless-stopped
+    networks:
+      - tipi_main_network

+ 2 - 1
apps/syncthing/docker-compose.yml

@@ -1,7 +1,8 @@
 version: "3.7"
 
 services:
-  server:
+  syncthing:
+    container_name: syncthing
     image: syncthing/syncthing:1.19
     stop_grace_period: 1m
     hostname: tipi

+ 0 - 0
media/data/tv/.gitkeep


+ 19 - 7
scripts/start.sh

@@ -1,6 +1,14 @@
 #!/usr/bin/env bash
 set -e  # Exit immediately if a command exits with a non-zero status.
 
+# Get field from json file
+function get_json_field() {
+    local json_file="$1"
+    local field="$2"
+
+    echo $(jq -r ".${field}" "${json_file}")
+}
+
 # use greadlink instead of readlink on osx
 if [[ "$(uname)" == "Darwin" ]]; then
   readlink=greadlink
@@ -10,8 +18,17 @@ fi
 
 ROOT_FOLDER="$($readlink -f $(dirname "${BASH_SOURCE[0]}")/..)"
 STATE_FOLDER="${ROOT_FOLDER}/state"
-
 INTERNAL_IP="$(hostname -I | awk '{print $1}')"
+DNS_IP=9.9.9.9
+
+# Get dns ip if pihole is installed
+str=$(get_json_field ${STATE_FOLDER}/apps.json installed)
+
+# if pihole is present in str add it as DNS
+if [[ $str = *"pihole"* ]]; then
+  DNS_IP=10.21.21.201
+fi
+
 PUID="$(id -u)"
 PGID="$(id -g)"
 TZ="$(cat /etc/timezone | sed 's/\//\\\//g' || echo "Europe/Berlin")"
@@ -50,6 +67,7 @@ ENV_FILE="$ROOT_FOLDER/templates/.env"
 [[ -f "$ROOT_FOLDER/templates/env-sample" ]] && cp "$ROOT_FOLDER/templates/env-sample" "$ENV_FILE"
 
 for template in "${ENV_FILE}"; do
+  sed -i "s/<dns_ip>/${DNS_IP}/g" "${template}"
   sed -i "s/<internal_ip>/${INTERNAL_IP}/g" "${template}"
   sed -i "s/<puid>/${PUID}/g" "${template}"
   sed -i "s/<pgid>/${PGID}/g" "${template}"
@@ -66,13 +84,7 @@ docker-compose --env-file "${ROOT_FOLDER}/.env" up --detach --remove-orphans --b
   exit 1
 }
 
-# Get field from json file
-function get_json_field() {
-    local json_file="$1"
-    local field="$2"
 
-    echo $(jq -r ".${field}" "${json_file}")
-}
 
 str=$(get_json_field ${STATE_FOLDER}/apps.json installed)
 apps_to_start=($str)

+ 18 - 1
system-api/src/config/apps.ts

@@ -1 +1,18 @@
-export const appNames = ['nextcloud', 'freshrss', 'anonaddy', 'filerun', 'wg-easy', 'radarr', 'transmission', 'jellyfin', 'pihole', 'tailscale', 'n8n', 'invidious'];
+export const appNames = [
+  'nextcloud',
+  'syncthing',
+  'freshrss',
+  'anonaddy',
+  'filebrowser',
+  'wg-easy',
+  'jackett',
+  'sonarr',
+  'radarr',
+  'transmission',
+  'jellyfin',
+  'pihole',
+  'tailscale',
+  'n8n',
+  'invidious',
+  'joplin',
+];

+ 4 - 0
system-api/src/declarations.d.ts

@@ -0,0 +1,4 @@
+declare module 'su-exec' {
+  export function execFile(path: string, args: string[], options: {}, callback?: any): void;
+  export function init(): void;
+}

+ 4 - 0
system-api/src/modules/apps/apps.controller.ts

@@ -147,6 +147,10 @@ const startApp = async (req: Request, res: Response, next: NextFunction) => {
     checkAppExists(appName);
     checkEnvFile(appName);
 
+    // Regenerate env file
+    const form = getInitalFormValues(appName);
+    generateEnvFile(appName, form);
+
     // Run script
     await runAppScript(['start', appName]);
 

+ 3 - 0
system-api/src/server.ts

@@ -1,6 +1,7 @@
 /* eslint-disable no-unused-vars */
 import express, { NextFunction, Request, Response } from 'express';
 import compression from 'compression';
+// import suExec from 'su-exec';
 import helmet from 'helmet';
 import cors from 'cors';
 import { isProd } from './constants/constants';
@@ -10,6 +11,8 @@ import authRoutes from './modules/auth/auth.routes';
 import { tradeTokenForUser } from './modules/auth/auth.helpers';
 import cookieParser from 'cookie-parser';
 
+// suExec.init();
+
 const app = express();
 const port = 3001;
 

+ 1 - 0
templates/env-sample

@@ -5,5 +5,6 @@ TZ=<tz>
 PUID=<puid>
 PGID=<pgid>
 INTERNAL_IP=<internal_ip>
+DNS_IP=<dns_ip>