first install
This commit is contained in:
parent
a8813e57da
commit
5dd26db2be
BIN
.filecache/cache.db
Normal file
BIN
.filecache/cache.db
Normal file
Binary file not shown.
BIN
.filecache/cache.db-shm
Normal file
BIN
.filecache/cache.db-shm
Normal file
Binary file not shown.
0
.filecache/cache.db-wal
Normal file
0
.filecache/cache.db-wal
Normal file
3
.gitignore
vendored
3
.gitignore
vendored
@ -1 +1,2 @@
|
|||||||
/venv
|
/venv
|
||||||
|
/filecache
|
||||||
|
|||||||
BIN
__pycache__/app.cpython-311.pyc
Normal file
BIN
__pycache__/app.cpython-311.pyc
Normal file
Binary file not shown.
4
app.py
Normal file → Executable file
4
app.py
Normal file → Executable file
@ -7,12 +7,12 @@ import mimetypes
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from urllib.parse import unquote
|
from urllib.parse import unquote
|
||||||
import diskcache
|
import diskcache
|
||||||
cache = diskcache.Cache('./filecache', size_limit= 124**3) # 124MB limit
|
cache = diskcache.Cache('./filecache', size_limit= 32 * 1024**3) # 32 GB limit
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
# Use a raw string for the UNC path.
|
# Use a raw string for the UNC path.
|
||||||
app.config['MP3_ROOT'] = r'\\192.168.10.10\docker2\sync-bethaus\syncfiles\folders'
|
app.config['MP3_ROOT'] = r'/mp3_root'
|
||||||
app.config['SECRET_KEY'] = os.urandom(24)
|
app.config['SECRET_KEY'] = os.urandom(24)
|
||||||
app.config['ALLOWED_SECRETS'] = {
|
app.config['ALLOWED_SECRETS'] = {
|
||||||
'test': datetime(2026, 3, 31, 23, 59, 59),
|
'test': datetime(2026, 3, 31, 23, 59, 59),
|
||||||
|
|||||||
0
apply_correction.py
Normal file → Executable file
0
apply_correction.py
Normal file → Executable file
73
check_ssh_tunnel.sh
Normal file → Executable file
73
check_ssh_tunnel.sh
Normal file → Executable file
@ -1,19 +1,62 @@
|
|||||||
# SSH Tunnel Check Script (batch script for cron)
|
|
||||||
# Add to cron: */5 * * * * /path/to/check_ssh_tunnel.sh
|
|
||||||
|
|
||||||
# --- Script to ensure SSH Tunnel is active ---
|
|
||||||
|
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
SSH_USER="your_ssh_user"
|
# SSH and NFS Tunnel Configuration
|
||||||
SSH_SERVER="ssh-server-address"
|
SSH_USER="root"
|
||||||
LOCAL_PORT="2049"
|
SSH_SERVER="bethaus-speyer.de"
|
||||||
REMOTE_NFS_SERVER="nfs-server-address"
|
SSH_SERVER_PORT=1122 # Remote SSH server SSH port
|
||||||
|
LOCAL_PORT=2022 # Local port for NFS tunnel
|
||||||
|
REMOTE_NFS_PORT=2049 # Remote NFS server port
|
||||||
|
MOUNT_POINT="/mnt/app.bethaus/Gottesdienste Speyer"
|
||||||
|
NFS_SHARE="/volume1/Aufnahme-stereo/010 Gottesdienste ARCHIV"
|
||||||
|
|
||||||
# Check if tunnel is active
|
# Function to check if the SSH tunnel is active
|
||||||
if ! nc -z localhost $LOCAL_PORT; then
|
is_tunnel_active() {
|
||||||
echo "SSH Tunnel is down! Reconnecting..."
|
timeout 1 bash -c "</dev/tcp/localhost/${LOCAL_PORT}" &>/dev/null
|
||||||
ssh -f -N -L ${LOCAL_PORT}:$SSH_SERVER:2049 ${SSH_USER}@${SSH_SERVER}
|
}
|
||||||
|
|
||||||
|
# Function to check if the NFS share is mounted
|
||||||
|
is_nfs_mounted() {
|
||||||
|
mount | grep -q "${MOUNT_POINT}"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Restart the SSH tunnel if it's not running
|
||||||
|
if ! is_tunnel_active; then
|
||||||
|
echo "[INFO] SSH Tunnel is down. Attempting to reconnect..."
|
||||||
|
|
||||||
|
ssh -f -N -L "${LOCAL_PORT}:localhost:${REMOTE_NFS_PORT}" \
|
||||||
|
-o ExitOnForwardFailure=yes \
|
||||||
|
-p "${SSH_SERVER_PORT}" \
|
||||||
|
"${SSH_USER}@${SSH_SERVER}"
|
||||||
|
|
||||||
|
if is_tunnel_active; then
|
||||||
|
echo "[SUCCESS] SSH Tunnel established on local port ${LOCAL_PORT}, forwarding to remote NFS port ${REMOTE_NFS_PORT}."
|
||||||
|
else
|
||||||
|
echo "[ERROR] Failed to establish SSH tunnel!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "SSH Tunnel is active."
|
echo "[INFO] SSH Tunnel is already active on port ${LOCAL_PORT}."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Ensure mount point exists
|
||||||
|
if [ ! -d "${MOUNT_POINT}" ]; then
|
||||||
|
echo "[INFO] Creating mount point: ${MOUNT_POINT}"
|
||||||
|
sudo mkdir -p "${MOUNT_POINT}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Mount the NFS share if it's not already mounted
|
||||||
|
if ! is_nfs_mounted; then
|
||||||
|
echo "[INFO] NFS is not mounted. Attempting to mount..."
|
||||||
|
|
||||||
|
sudo mount -t nfs -o port=${LOCAL_PORT},nolock,soft 127.0.0.1:"${NFS_SHARE}" "${MOUNT_POINT}"
|
||||||
|
|
||||||
|
if is_nfs_mounted; then
|
||||||
|
echo "[SUCCESS] NFS mounted successfully at ${MOUNT_POINT}."
|
||||||
|
else
|
||||||
|
echo "[ERROR] Failed to mount NFS share!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "[INFO] NFS is already mounted at ${MOUNT_POINT}."
|
||||||
|
fi
|
||||||
|
|
||||||
|
|||||||
21
docker-compose.yml
Normal file → Executable file
21
docker-compose.yml
Normal file → Executable file
@ -1,29 +1,20 @@
|
|||||||
services:
|
services:
|
||||||
flask-app:
|
flask-app:
|
||||||
image: python:3.11-slim
|
image: python:3.11-slim
|
||||||
container_name: flask-app
|
container_name: bethaus-app
|
||||||
restart: always
|
restart: always
|
||||||
working_dir: /app
|
working_dir: /app
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/app
|
- ./:/app
|
||||||
- filecache:/app/filecache
|
- ./filecache:/app/filecache
|
||||||
- templates:/app/templates
|
- ./templates:/app/templates
|
||||||
- mp3_root:/mp3_root
|
- /mnt/app.bethaus:/mp3_root:ro
|
||||||
environment:
|
environment:
|
||||||
- FLASK_APP=app.py
|
- FLASK_APP=app.py
|
||||||
- FLASK_RUN_HOST=0.0.0.0
|
- FLASK_RUN_HOST=0.0.0.0
|
||||||
|
- FLASK_ENV=production
|
||||||
- MP3_ROOT=/mp3_root
|
- MP3_ROOT=/mp3_root
|
||||||
ports:
|
ports:
|
||||||
- "5000:5000"
|
- "5000:5000"
|
||||||
command: >
|
command: >
|
||||||
sh -c "pip install flask pillow diskcache && flask run"
|
sh -c "pip install -r requirements.txt && flask run"
|
||||||
|
|
||||||
volumes:
|
|
||||||
filecache:
|
|
||||||
templates:
|
|
||||||
mp3_root:
|
|
||||||
driver: local
|
|
||||||
driver_opts:
|
|
||||||
type: nfs
|
|
||||||
o: addr=127.0.0.1,rw,nolock,soft
|
|
||||||
device: ":/path/to/your/nfs/export"
|
|
||||||
|
|||||||
0
error_correction.json
Normal file → Executable file
0
error_correction.json
Normal file → Executable file
3
requirements.txt
Normal file
3
requirements.txt
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
flask
|
||||||
|
pillow
|
||||||
|
diskcache
|
||||||
0
transcribe_all.py
Normal file → Executable file
0
transcribe_all.py
Normal file → Executable file
Loading…
x
Reference in New Issue
Block a user