deployment prep

This commit is contained in:
Simon Martens
2025-09-30 12:21:57 +02:00
parent fb7231248c
commit 4218db49b5
10 changed files with 63 additions and 15 deletions

23
.dockerignore Normal file
View File

@@ -0,0 +1,23 @@
# Exclude pictures directory from Docker build context (21GB)
pictures/
# Exclude development files
*.dev.json
*.log
.git/
.gitignore
README.md
*.md
# Exclude build artifacts
node_modules/
.npm/
dist/
build/
# Exclude IDE files
.vscode/
.idea/
*.swp
*.swo
*~

2
.gitignore vendored
View File

@@ -8,7 +8,9 @@ cache_gnd/
data_bilder/
/pictures/
config.json
config.staging.json
out.log
kgpz_web
*.log
*.out
*.zip

View File

@@ -3,7 +3,7 @@ services:
web:
build: .
volumes:
- kgpz_data:/app/data_git
- kgpz_data:/app/data
ports:
- "8000:8080"

View File

@@ -159,7 +159,16 @@ func Engine(kgpz *app.KGPZ, c *providers.ConfigProvider) *templating.Engine {
timestamp := time.Now().Unix()
// Add git commit information to global data
globals := fiber.Map{"isDev": c.Config.Debug, "name": "KGPZ", "lang": "de", "timestamp": timestamp}
isDev := c.Config.Environment == "development"
isStaging := c.Config.Environment == "staging"
globals := fiber.Map{
"isDev": isDev,
"isStaging": isStaging,
"noIndex": c.Config.NoIndex,
"name": "KGPZ",
"lang": "de",
"timestamp": timestamp,
}
if kgpz.Repo != nil {
globals["gitCommit"] = kgpz.Repo.Commit
globals["gitDate"] = kgpz.Repo.Date.Format("2006-01-02T15:04:05Z07:00")

View File

@@ -50,6 +50,8 @@ type Config struct {
Debug bool `json:"debug" envconfig:"DEBUG"`
Watch bool `json:"watch" envconfig:"WATCH"`
LogData bool `json:"log_data" envconfig:"LOG_DATA"`
Environment string `json:"environment" envconfig:"ENVIRONMENT"`
NoIndex bool `json:"no_index" envconfig:"NO_INDEX"`
Address string `json:"address" envconfig:"ADDRESS"`
Port string `json:"port" envconfig:"PORT"`
@@ -140,6 +142,14 @@ func readDefaults(cfg *Config) *Config {
cfg.PicturesPath = DEFAULT_PICTURES_DIR
}
if strings.TrimSpace(cfg.Environment) == "" {
if cfg.Debug {
cfg.Environment = "development"
} else {
cfg.Environment = "production"
}
}
return cfg
}

View File

@@ -13,9 +13,9 @@ BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Configuration
QUALITY=95 # WebP quality (0-100) - very high for single page viewer
COMPRESSION=1 # WebP compression level (0-6, lower = less compression, higher quality)
PICTURES_DIR="pictures"
QUALITY=88 # WebP quality (0-100) - high quality with good compression
COMPRESSION=2 # WebP compression level (0-6, lower = less compression, higher quality)
PICTURES_DIR="/app/data/pictures"
# Check if cwebp is installed
if ! command -v cwebp &> /dev/null; then
@@ -33,8 +33,8 @@ if [ ! -d "$PICTURES_DIR" ]; then
fi
echo -e "${BLUE}Generating high-quality WebP originals for single page viewer...${NC}"
echo "Quality: $QUALITY% (near-lossless)"
echo "Compression: $COMPRESSION (minimal compression for maximum quality)"
echo "Quality: $QUALITY% (high quality with compression)"
echo "Compression: $COMPRESSION (balanced compression for good quality)"
echo ""
# Counters

View File

@@ -13,7 +13,7 @@ NC='\033[0m' # No Color
# Configuration
QUALITY=75 # WebP quality (0-100)
COMPRESSION=6 # WebP compression level (0-6, higher = better compression)
PICTURES_DIR="pictures"
PICTURES_DIR="/app/data/pictures"
# Check if cwebp is installed
if ! command -v cwebp &> /dev/null; then
@@ -42,7 +42,7 @@ fi
echo -e "${GREEN}Generating WebP preview images...${NC}"
echo "Quality: $QUALITY%"
echo "Compression: $COMPRESSION"
echo "Resize: 50% (for faster loading)"
echo "Resize: 70% (for faster loading)"
echo ""
# Counters
@@ -70,13 +70,13 @@ process_file() {
echo -e "${YELLOW}Overriding existing preview: $webp_file${NC}"
fi
# Get image dimensions and calculate 50%
# Get image dimensions and calculate 70%
dimensions=$(identify -ping -format "%w %h" "$jpg_file" 2>/dev/null)
if [ $? -eq 0 ] && [ -n "$dimensions" ]; then
width=$(echo $dimensions | cut -d' ' -f1)
height=$(echo $dimensions | cut -d' ' -f2)
new_width=$((width / 2))
new_height=$((height / 2))
new_width=$((width * 70 / 100))
new_height=$((height * 70 / 100))
resize_params="-resize $new_width $new_height"
echo "Processing: $jpg_file -> $webp_file (${width}x${height}${new_width}x${new_height})"
else

View File

@@ -875,7 +875,7 @@ class Y extends HTMLElement {
}));
}
setPointActive(e) {
e.setAttribute("r", "0.8"), e.setAttribute("fill", "#dc2626"), e.setAttribute("stroke", "#b91c1c"), e.setAttribute("stroke-width", "0.12"), e.setAttribute("opacity", "1"), e.setAttribute("filter", "drop-shadow(0 0.05 0.1 rgba(0,0,0,0.2))"), e.parentNode && e.parentNode.appendChild(e);
e.setAttribute("r", "0.6"), e.setAttribute("fill", "#dc2626"), e.setAttribute("stroke", "#b91c1c"), e.setAttribute("stroke-width", "0.12"), e.setAttribute("opacity", "1"), e.setAttribute("filter", "drop-shadow(0 0.05 0.1 rgba(0,0,0,0.2))"), e.parentNode && e.parentNode.appendChild(e);
}
setPointInactive(e) {
e.setAttribute("r", "0.4"), e.setAttribute("fill", "white"), e.setAttribute("stroke", "none"), e.setAttribute("opacity", "0.7"), e.setAttribute("filter", "drop-shadow(0 0.05 0.08 rgba(0,0,0,0.15))");

View File

@@ -1,10 +1,14 @@
<meta charset="UTF-8" />
{{ if .noIndex }}
<meta name="robots" content="noindex, nofollow, noarchive, nosnippet">
<meta name="googlebot" content="noindex, nofollow">
{{ end }}
{{ block "head" . }}
<!-- Default Head elements -->
{{ end }}
{{ if .isDev }}
{{ if or .isDev .isStaging }}
<link rel="icon" href="/assets/logo/dev_favicon.png" />
{{ else }}
<link rel="icon" href="/assets/logo/favicon.png" />

View File

@@ -623,7 +623,7 @@ export class PlacesMap extends HTMLElement {
setPointActive(circle) {
// Active state: darker red circle with wider dark border and small shadow
circle.setAttribute("r", "0.8"); // Bigger radius in % units
circle.setAttribute("r", "0.6"); // Bigger radius in % units
circle.setAttribute("fill", "#dc2626");
circle.setAttribute("stroke", "#b91c1c");
circle.setAttribute("stroke-width", "0.12");