New recipe added: staticweb_filebrowser.
This commit is contained in:
parent
aaf493f13c
commit
05431b716d
1
.recipes/staticweb_filebrowser/config/filebrowser-config
Symbolic link
1
.recipes/staticweb_filebrowser/config/filebrowser-config
Symbolic link
@ -0,0 +1 @@
|
||||
../storage/volumes/filebrowser_data
|
28
.recipes/staticweb_filebrowser/docker-compose.yml
Normal file
28
.recipes/staticweb_filebrowser/docker-compose.yml
Normal file
@ -0,0 +1,28 @@
|
||||
# Static website with Filebrowser as an admin tool.
|
||||
#
|
||||
services:
|
||||
# https://github.com/filebrowser/filebrowser
|
||||
# https://hub.docker.com/r/filebrowser/filebrowser
|
||||
filebrowser:
|
||||
image: filebrowser/filebrowser:latest
|
||||
restart: unless-stopped
|
||||
# Take care a possible public port collision.
|
||||
ports:
|
||||
- 8201:80
|
||||
# The same Linux user running the reverse proxy webserver.
|
||||
user: 33:1001
|
||||
environment:
|
||||
TZ: Europe/Budapest
|
||||
# Default credentials: admin/admin
|
||||
# Note, FB_NOAUTH only matters if the database is still empty.
|
||||
#FB_NOAUTH: true
|
||||
FB_BASEURL: "/"
|
||||
volumes:
|
||||
# The Linux user defined above must have R/W access here.
|
||||
- ./storage/volumes/staticweb:/srv
|
||||
- ./storage/volumes/filebrowser_data/filebrowser.json:/.filebrowser.json
|
||||
- ./storage/volumes/filebrowser_data/database.db:/.database.db
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
labels:
|
||||
com.centurylinklabs.watchtower.enable: true
|
@ -0,0 +1,8 @@
|
||||
{
|
||||
"port": 80,
|
||||
"baseURL": "/",
|
||||
"address": "",
|
||||
"log": "stdout",
|
||||
"database": "/.database.db",
|
||||
"root": "/srv"
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test page</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>It works!</h1>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,93 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# A service script to backup the web storage of a static website.
|
||||
# Creates a tarball in $BASE_DIR/storage/backups/tarballs folder
|
||||
# (by default). Optional parameters may change the source and/or
|
||||
# target folder.
|
||||
#
|
||||
# Author: Kovács Zoltán <kovacsz@marcusconsulting.hu>
|
||||
# License: GNU/GPL 3+ https://www.gnu.org/licenses/gpl-3.0.en.html
|
||||
# 2025-01-22 Initial version.
|
||||
|
||||
# Accepted environment variables and their defaults.
|
||||
#
|
||||
PAR_BASEDIR=${PAR_BASEDIR:-""} # Service's base folder
|
||||
PAR_BACKUPDIR=${PAR_BACKUPDIR:-""} # Folder to dump within
|
||||
PAR_SOURCEDIR=${PAR_SOURCEDIR:-""} # Folder to save
|
||||
|
||||
# Messages (maybe overridden by configuration).
|
||||
#
|
||||
MSG_MISSINGDEP="Fatal: missing dependency"
|
||||
MSG_NONREAD="The source directory isn't readable"
|
||||
MSG_NONWRITE="The target directory isn't writable"
|
||||
|
||||
# Other initialisations.
|
||||
#
|
||||
BACKUPDIR="storage/backups/tarballs" # Folder to dump within
|
||||
SOURCEDIR="storage/volumes/staticweb" # Folder to backup
|
||||
USER=${USER:-LOGNAME} # Fix for cron enviroment only
|
||||
YMLFILE="docker-compose.yml"
|
||||
|
||||
# Checks the dependencies.
|
||||
#
|
||||
TR=$(which tr 2>/dev/null)
|
||||
if [ -z "$TR" ]; then echo "$MSG_MISSINGDEP tr."; exit 1 ; fi
|
||||
for item in basename cat cut date dirname hostname pwd tar
|
||||
do
|
||||
if [ -n "$(which $item)" ]
|
||||
then export $(echo $item | "$TR" '[:lower:]' '[:upper:]' | "$TR" '-' '_')=$(which $item)
|
||||
else echo "$MSG_MISSINGDEP $item." >&2; exit 1; fi
|
||||
done
|
||||
# All dependencies are available via "$THECOMMAND" (upper case) call.
|
||||
|
||||
# Where I'm?
|
||||
# https://gist.github.com/TheMengzor/968e5ea87e99d9c41782
|
||||
SOURCE="$0"
|
||||
while [ -h "$SOURCE" ]; do
|
||||
# resolve $SOURCE until the file is no longer a symlink
|
||||
SCRPATH="$( cd -P "$("$DIRNAME" "$SOURCE" )" && echo "$PWD" )" #"
|
||||
SOURCE="$("$READLINK" "$SOURCE")"
|
||||
# if $SOURCE was a relative symlink, we need to resolve it
|
||||
# relative to the path where the symlink file was located
|
||||
[[ $SOURCE != /* ]] && SOURCE="$SCRPATH/$SOURCE"
|
||||
done; SCRPATH="$( cd -P "$("$DIRNAME" "$SOURCE" )" && echo "$PWD" )" #"
|
||||
|
||||
# Searches the base folder, containing a docker-compose.yml file.
|
||||
#
|
||||
# Called from the base folder (./)?
|
||||
BASE_DIR="$PAR_BASEDIR"
|
||||
TEST_DIR="$SCRPATH"
|
||||
[[ -z "$BASE_DIR" ]] && [[ -r "$TEST_DIR/$YMLFILE" ]] && BASE_DIR="$TEST_DIR"
|
||||
# Called from ./tools?
|
||||
TEST_DIR="$("$DIRNAME" "$TEST_DIR")"
|
||||
[[ -z "$BASE_DIR" ]] && [[ -r "$TEST_DIR/$YMLFILE" ]] && BASE_DIR="$TEST_DIR"
|
||||
# Called from ./tools/*.d?
|
||||
TEST_DIR="$("$DIRNAME" "$TEST_DIR")"
|
||||
[[ -z "$BASE_DIR" ]] && [[ -r "$TEST_DIR/$YMLFILE" ]] && BASE_DIR="$TEST_DIR"
|
||||
# On failure gives it up here.
|
||||
if [ -z "$BASE_DIR" -o ! -r "$BASE_DIR/$YMLFILE" ]; then
|
||||
echo "$MSG_MISSINGYML" >&2; exit 1
|
||||
fi
|
||||
# Sets the absolute paths.
|
||||
BACKUPDIR="${PAR_BACKUPDIR:-$BASE_DIR/$BACKUPDIR}"
|
||||
SOURCEDIR="${PAR_SOURCEDIR:-$BASE_DIR/$SOURCEDIR}"
|
||||
|
||||
# The dump target folder must be writable.
|
||||
#
|
||||
[[ ! -w "$BACKUPDIR" ]] \
|
||||
&& echo "$MSG_NONWRITE: $BACKUPDIR" >&2 && exit 1
|
||||
|
||||
# The source folder must be readable.
|
||||
#
|
||||
[[ ! -r "$SOURCEDIR" ]] \
|
||||
&& echo "$MSG_NONREAD: $SOURCEDIR" >&2 && exit 1
|
||||
|
||||
# Tries the FS backup.
|
||||
#
|
||||
if [ -w "$BACKUPDIR" ]; then
|
||||
BACKUP_NAME=$("$BASENAME" "$SOURCEDIR").$("$DATE" '+%Y%m%d_%H%M%S').$("$HOSTNAME")
|
||||
(cd $SOURCEDIR; "$TAR" cz . \
|
||||
> "$BACKUPDIR/$BACKUP_NAME.tgz" 2>>"$BACKUPDIR/$BACKUP_NAME.log")
|
||||
fi
|
||||
|
||||
# That's all, Folks! :)
|
Loading…
x
Reference in New Issue
Block a user