Fix remove app sudo rights

This commit is contained in:
Nicolas Meienberger 2022-05-03 20:55:55 +00:00
parent 8f5f2c09e8
commit a2842ff5c5
25 changed files with 238 additions and 30 deletions

2
.gitignore vendored
View file

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

View file

@ -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": {}
}

View file

View file

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

View file

@ -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
apps/jackett/config.json Normal file
View file

@ -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": {
}
}

View file

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

View file

@ -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
apps/joplin/README.md Normal file
View file

@ -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
apps/joplin/config.json Normal file
View file

@ -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": {}
}

View file

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

View file

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

View file

@ -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
apps/sonarr/config.json Normal file
View file

@ -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": {
}
}

View file

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

View file

@ -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
media/data/tv/.gitkeep Normal file
View file

View file

@ -122,7 +122,7 @@ if [[ "$command" = "uninstall" ]]; then
echo "Deleting app data for app ${app}..."
if [[ -d "${app_data_dir}" ]]; then
rm -rf "${app_data_dir}"
sudo rm -rf "${app_data_dir}"
fi
echo "Successfully uninstalled app ${app}"

View file

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

View file

@ -18,6 +18,7 @@
"node-port-scanner": "^3.0.1",
"p-iteration": "^1.1.8",
"public-ip": "^5.0.0",
"su-exec": "^0.1.5",
"systeminformation": "^5.11.9",
"tcp-port-used": "^1.0.2"
},
@ -13199,6 +13200,15 @@
"node": "^12.13.0 || ^14.15.0 || >=16"
}
},
"node_modules/su-exec": {
"version": "0.1.5",
"resolved": "https://registry.npmjs.org/su-exec/-/su-exec-0.1.5.tgz",
"integrity": "sha1-1syxaV8z4QJbDItWOLW+a/TBAaY=",
"hasInstallScript": true,
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/subscriptions-transport-ws": {
"version": "0.9.19",
"resolved": "https://registry.npmjs.org/subscriptions-transport-ws/-/subscriptions-transport-ws-0.9.19.tgz",
@ -23833,6 +23843,11 @@
"stylelint-config-recommended": "^6.0.0"
}
},
"su-exec": {
"version": "0.1.5",
"resolved": "https://registry.npmjs.org/su-exec/-/su-exec-0.1.5.tgz",
"integrity": "sha1-1syxaV8z4QJbDItWOLW+a/TBAaY="
},
"subscriptions-transport-ws": {
"version": "0.9.19",
"resolved": "https://registry.npmjs.org/subscriptions-transport-ws/-/subscriptions-transport-ws-0.9.19.tgz",

View file

@ -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
system-api/src/declarations.d.ts vendored Normal file
View file

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

View file

@ -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]);

View file

@ -1,5 +1,6 @@
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';
@ -7,6 +8,8 @@ import appsRoutes from './modules/apps/apps.routes';
import systemRoutes from './modules/system/system.routes';
import networkRoutes from './modules/network/network.routes';
// suExec.init();
const app = express();
const port = 3001;

View file

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