This document provides instructions for deploying GoScry using Docker and Docker Compose.
- Docker Engine 24.0.0+
- Docker Compose v2.0.0+
- Git (for obtaining the source code)
-
Clone the repository:
git clone https://github.com/copyleftdev/goscry.git cd goscry
-
Create a custom configuration file:
cp config.example.yaml config.yaml
-
Update
config.yaml
with your configuration settings:- Set
security.apiKey
or set it through environment variableGOSCRY_SECURITY_APIKEY
- Configure additional settings as needed
- Set
-
Start the basic stack:
docker compose up -d
-
Access the API at http://localhost:8090
GoScry includes an automated Docker testing script to validate deployment:
# Run the automated test script
./docker-test-auto.sh
This script:
- Builds and starts the Docker container
- Extracts the API key
- Tests the health endpoint with proper authentication
- Validates the DOM AST API by fetching example.com
- Provides useful diagnostics if any step fails
You can also use the interactive test script for manual testing and verification:
./docker-test.sh
The following environment variables can be set in the docker-compose.yml
file or in your host environment:
Variable | Description | Default |
---|---|---|
GOSCRY_API_KEY |
API key for authenticating requests | changeme |
LOG_LEVEL |
Logging level (debug, info, warn, error) | info |
GOSCRY_SERVER_PORT |
Port the server listens on | 8090 |
Mount a custom config.yaml
file to override default settings:
version: '3.8'
services:
goscry:
# ... other settings
volumes:
- ./config.yaml:/etc/goscry/config.yaml:ro
Simple deployment with just the GoScry service:
docker compose up -d
For production with TLS termination and routing:
-
Update Traefik configuration:
- Set your domain in
traefik/config/dynamic.yml
- Set your email in
traefik/traefik.yml
for Let's Encrypt
- Set your domain in
-
Start the stack with the production profile:
docker compose --profile production up -d
Includes Prometheus and Grafana for monitoring:
docker compose --profile monitoring up -d
You can also combine profiles for a complete deployment:
docker compose --profile production --profile monitoring up -d
Access Grafana at http://localhost:3000 (default credentials: admin/admin)
- Minimum: 1 CPU, 1GB RAM
- Recommended: 2 CPUs, 2GB RAM
- Production: 4 CPUs, 4GB RAM (depending on expected load)
The Docker image can be customized by modifying the Dockerfile. Key aspects:
- Base Image: Uses
zenika/alpine-chrome
which provides Chrome/Chromium necessary for the browser automation - Multi-stage build: Optimizes image size by building in one container and copying only necessary files to the runtime container
- Non-root user: Runs as a non-privileged user for better security
- Volumes: Persists data through a Docker volume at
/var/lib/goscry
For high-throughput environments:
- Increase
GOSCRY_BROWSER_MAXSESSIONS
(default: 10) to handle more concurrent browser sessions - Adjust resource limits in
docker-compose.yml
- Consider using a separate database service for task storage (requires code modifications)
-
Container fails to start:
- Check logs:
docker compose logs goscry
- Ensure config.yaml is properly formatted
- Check logs:
-
Browser automation issues:
- Ensure the container has enough resources (memory and CPU)
- Check browser logs:
docker compose exec goscry cat /var/log/chrome_debug.log
-
Network connectivity issues:
- Ensure required ports are not blocked by firewall
- Check Traefik logs for routing issues:
docker compose logs traefik
- API Key: Always change the default API key in production
- TLS: Use the Traefik setup with Let's Encrypt for TLS termination
- Network Isolation: The docker-compose setup uses a dedicated network for service communication
- Regular Updates: Keep the Docker images updated for security patches