replace duckdb-ui with ttyd shell: add /query HTTP endpoint, fix utf-8/locale, region config
- swap DuckDB UI for ttyd web terminal (--writable, -readonly db) - add POST /query endpoint with X-Password auth for curl-based SQL execution - fix UTF-8 rendering: set LANG/LC_ALL=C.UTF-8 in container - pass BUCKET_REGION env var for correct S3 signing region - simplify start.sh: drop Xvfb, views.duckdb generation, blocking duckdb -ui - add less, ncurses-bin to Dockerfile for proper pager/terminal support - update Caddyfile: single route to ttyd with flush_interval -1 for websocket - update README to reflect current architecture and document /query usage - remove duckdb-ui.service, schemas.json, file_tree.md (generated artifacts)
This commit is contained in:
24
start.sh
24
start.sh
@@ -1,20 +1,28 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
|
||||
# DuckDB init: load S3 credentials from env at session start
|
||||
INIT=$(mktemp /tmp/duckdb_init_XXXX.sql)
|
||||
S3_ENDPOINT="${HETZNER_S3_ENDPOINT#https://}"
|
||||
S3_ENDPOINT="${S3_ENDPOINT#http://}"
|
||||
cat > "$INIT" <<SQL
|
||||
INSTALL httpfs; LOAD httpfs;
|
||||
|
||||
# Init SQL para o terminal web (credenciais não ficam expostas como env vars)
|
||||
cat > /app/ssh_init.sql <<SQL
|
||||
LOAD httpfs;
|
||||
SET s3_endpoint='${S3_ENDPOINT}';
|
||||
SET s3_access_key_id='${AWS_ACCESS_KEY_ID}';
|
||||
SET s3_secret_access_key='${AWS_SECRET_ACCESS_KEY}';
|
||||
SET s3_region='${BUCKET_REGION}';
|
||||
SET s3_url_style='path';
|
||||
SET enable_object_cache=true;
|
||||
SET threads=4;
|
||||
SET memory_limit='4GB';
|
||||
SQL
|
||||
chmod 600 /app/ssh_init.sql
|
||||
|
||||
echo "[start] Starting ttyd terminal..."
|
||||
ttyd --port 7681 --writable duckdb -readonly --init /app/ssh_init.sql /app/basedosdados.duckdb &
|
||||
|
||||
echo "[start] Starting auth service..."
|
||||
python3 /app/auth.py &
|
||||
|
||||
echo "[start] Starting Caddy..."
|
||||
caddy start --config /app/Caddyfile --adapter caddyfile
|
||||
|
||||
echo "[start] Starting DuckDB UI..."
|
||||
exec duckdb --ui -init "$INIT" basedosdados.duckdb
|
||||
exec caddy run --config /app/Caddyfile --adapter caddyfile
|
||||
|
||||
Reference in New Issue
Block a user