The project is designed to create screenshots of a web page on a browser event. Can be used to create preview for later use when posting on social media using the opengraph protocol.
The project uses two containers: chromium-headless and preview-generator. You can optionally use redis or memcached for image caching. When running them directly with Docker you may want to mount two directories for persistent data:
/app/cache- Chromium profile and cache/app/share- output screenshots and PDFs
Deployment is managed by disaster-ninja-cd
Create configmap
kubectl apply -f- <<EOF
apiVersion: v1
kind: ConfigMap
metadata:
name: epig-config
data:
CHROMIUM_HOST: "chromium-headless"
CHROMIUM_PORT: "9222"
CHROMIUM_CACHE_SIZE: "104857600"
CHROMIUM_WIDTH: "1200"
CHROMIUM_HEIGHT: "630"
USE_HEADERS: "TRUE"
SITE_URL: "https://example.com"
EVENT_NAME: "load"
WIDTH: "1200"
HEIGHT: "630"
QS: ""
TIMEOUT: "10000"
CACHE_URL: "redis://redis:6379"
CACHE_TTL: "120"
DEBUG: "FALSE"
PORT: "8000"
EOFGenerate redis password
kubectl create secret generic redis-secret --from-literal=password=$(head -c 512 /dev/urandom | LC_CTYPE=C tr -cd 'a-zA-Z0-9' | head -c 64)Apply config
kubectl apply -f ./k8sConfigmap for Disaster ninja
kubectl apply -f- <<EOF
apiVersion: v1
kind: ConfigMap
metadata:
name: epig-config
data:
CHROMIUM_HOST: "chromium-headless"
CHROMIUM_PORT: "9222"
CHROMIUM_CACHE_SIZE: "104857600"
CHROMIUM_WIDTH: "1200"
CHROMIUM_HEIGHT: "630"
USE_HEADERS: "FALSE"
SITE_URL: "https://test-apps-ninja02.konturlabs.com/active/"
EVENT_NAME: "event_ready_for_screenshot"
WIDTH: "1200"
HEIGHT: "630"
ALLOW_EMPTY_QS: "FALSE"
QS: "app=f29339bd-8049-41ae-9d6b-f726d8451894"
TIMEOUT: "60000"
CACHE_URL: "redis://redis:6379"
CACHE_TTL: "120"
DEBUG: "FALSE"
PORT: "8000"
EOF