Overview
Web Scraping Hub uses environment variables to configure runtime behavior, especially in Docker and production deployments. This allows you to customize settings without modifying the source code.Environment Variables Reference
Docker Environment Variables
When deploying with Docker, the following environment variables are available:Process Group ID for the container. Used for file permissions.
Process User ID for the container. Used for file permissions.
Timezone for the container. Affects logging timestamps and scheduled tasks.Common values:
America/New_YorkEurope/LondonAsia/TokyoUTC
Flask Environment Variables
Flask environment mode. Controls various Flask behaviors.Options:
production- Production mode (recommended for deployment)development- Development mode with hot reload
Enable or disable Flask debug mode.
Docker Compose Configuration
The complete environment configuration indocker-compose.yml:
Resource Limits
CPU Configuration
Relative weight for CPU allocation. Higher values get more CPU time.
Memory Configuration
Maximum memory allocation for the container.
Adjust this based on your server’s available resources. For lighter loads, 1GB may be sufficient.
Volume Mounts
Persistent data is stored in mounted volumes:Configuration Volume
Logs Volume
Health Check Configuration
The container includes health checks to ensure the service is running:Command to run for health checking. Tests if the API is responding.
Time between health checks.
Maximum time to wait for health check response.
Number of consecutive failures before marking as unhealthy.
Grace period before starting health checks (allows for startup time).
Network Configuration
Port Mapping
Custom Network
Development Environment
For local development without Docker:Python Virtual Environment
Install Dependencies
flask- Web frameworkflask-cors- CORS supportbeautifulsoup4- HTML parsingadblockparser- Ad blockingcloudscraper- Cloudflare bypasspytest- Testing framework
Run Development Server
app.py:
Production Environment
Docker Deployment
For production deployment, use the provided Docker configuration:Environment File
Create a.env file for easier environment management:
docker-compose.yml:
CasaOS Configuration
Special configuration for CasaOS deployment:CasaOS uses these metadata fields to properly display and configure the application in its UI.
Environment-Specific Configuration
Development
Staging
Production
Troubleshooting
Container won't start
Container won't start
- Check if port 1234 is already in use
- Verify volume paths exist and are accessible
- Check Docker logs:
docker logs anxerstudios-streaming - Ensure required dependencies are installed in the image
Permission errors in container
Permission errors in container
- Verify
PUIDandPGIDmatch your user - Check volume mount permissions
- Run:
docker exec anxerstudios-streaming idto verify user
Health check failing
Health check failing
- Verify the container has fully started (wait for start_period)
- Check if port 1234 is accessible inside container
- Test manually:
docker exec anxerstudios-streaming curl localhost:1234/api/secciones - Review Flask logs for errors
Timezone not updating
Timezone not updating
- Verify
TZenvironment variable is set correctly - Restart the container after changing timezone
- Check timezone inside container:
docker exec anxerstudios-streaming date
Environment Variables Best Practices
Use .env Files
Keep environment variables in
.env files for easier management and keep them out of version control.Secure Sensitive Data
Never commit sensitive environment variables to version control. Use
.gitignore to exclude .env files.Document All Variables
Provide an
.env.example file with all required variables (without sensitive values).Related Resources
Backend Configuration
Configure the Flask backend server
Docker Deployment
Deploy with Docker and Docker Compose