diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..49eeb6d --- /dev/null +++ b/.gitignore @@ -0,0 +1,18 @@ +# OS files +.DS_Store +Thumbs.db + +# IDE files +.vscode/ +.idea/ +*.swp +*.swo +*~ + +# Docker +*.tar +*.gz + +# Logs +*.log + diff --git a/CloudronManifest.json b/CloudronManifest.json new file mode 100644 index 0000000..691b05e --- /dev/null +++ b/CloudronManifest.json @@ -0,0 +1,20 @@ +{ + "id": "io.flaresolverr.cloudronapp", + "title": "FlareSolverr", + "author": "bradinfluence", + "description": "FlareSolverr is a proxy server to bypass Cloudflare and DDoS-GUARD protection.", + "tagline": "Proxy server to bypass Cloudflare protection", + "version": "1.0.0", + "healthCheckPath": "/health", + "httpPort": 8191, + "addons": { + "localstorage": {} + }, + "manifestVersion": 2, + "website": "https://github.com/FlareSolverr/FlareSolverr", + "contactEmail": "support@example.com", + "icon": "file://icon.png", + "tags": [ "proxy", "cloudflare", "security" ], + "mediaLinks": [] +} + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..b5e758c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,121 @@ +# Build stage - create dummy packages and clone FlareSolverr +FROM --platform=amd64 cloudron/base:5.0.0@sha256:6bec2b5246567ef8b5b13ca0af756e2e596941e440d76b46635211cd84383922 AS build_image + +# Build dummy packages to skip installing them and their dependencies +RUN apt-get update && \ + apt-get install -y --no-install-recommends equivs git && \ + equivs-control libgl1-mesa-dri && \ + printf 'Section: misc\nPriority: optional\nStandards-Version: 3.9.2\nPackage: libgl1-mesa-dri\nVersion: 99.0.0\nDescription: Dummy package for libgl1-mesa-dri\n' >> libgl1-mesa-dri && \ + equivs-build libgl1-mesa-dri && \ + mv libgl1-mesa-dri_*.deb /libgl1-mesa-dri.deb && \ + equivs-control adwaita-icon-theme && \ + printf 'Section: misc\nPriority: optional\nStandards-Version: 3.9.2\nPackage: adwaita-icon-theme\nVersion: 99.0.0\nDescription: Dummy package for adwaita-icon-theme\n' >> adwaita-icon-theme && \ + equivs-build adwaita-icon-theme && \ + mv adwaita-icon-theme_*.deb /adwaita-icon-theme.deb && \ + git clone --depth 1 https://github.com/FlareSolverr/FlareSolverr.git /tmp/flaresolverr && \ + rm -rf /var/lib/apt/lists/* + +# Runtime stage +FROM --platform=amd64 cloudron/base:5.0.0@sha256:6bec2b5246567ef8b5b13ca0af756e2e596941e440d76b46635211cd84383922 + +WORKDIR /app/code/flaresolverr + +# Copy dummy packages from build stage +COPY --from=build_image /libgl1-mesa-dri.deb / +COPY --from=build_image /adwaita-icon-theme.deb / + +# Install dummy packages and runtime dependencies +RUN dpkg -i /libgl1-mesa-dri.deb && \ + dpkg -i /adwaita-icon-theme.deb && \ + apt-get update && \ + apt-get install -y --no-install-recommends \ + wget \ + xz-utils \ + unzip \ + xvfb \ + dumb-init \ + procps \ + curl \ + vim \ + xauth \ + ca-certificates \ + libatk1.0-0 \ + libatk-bridge2.0-0 \ + libcups2 \ + libdrm2 \ + libgtk-3-0 \ + libgbm1 \ + libasound2t64 \ + libxss1 \ + libxrandr2 \ + libxcomposite1 \ + libxdamage1 \ + libxfixes3 \ + libxkbcommon0 \ + libxshmfence1 && \ + # Download Google Chrome .deb package and extract the binary + # Chrome works as a drop-in replacement for Chromium in FlareSolverr + wget -q -O /tmp/chrome.deb "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" && \ + mkdir -p /tmp/chrome-extract && \ + cd /tmp/chrome-extract && \ + dpkg-deb -x ../chrome.deb . && \ + # Copy entire Chrome installation directory (Chrome needs its resources) + mkdir -p /opt/google && \ + cp -r opt/google/chrome /opt/google/ && \ + # Create symlink to chrome binary + ln -sf /opt/google/chrome/chrome /usr/local/bin/chromium && \ + # Download chromedriver from Chrome for Testing + # Get latest stable version and download matching chromedriver + CHROMEDRIVER_VERSION=$(curl -s https://googlechromelabs.github.io/chrome-for-testing/LATEST_RELEASE_STABLE) && \ + wget -q -O /tmp/chromedriver.zip "https://storage.googleapis.com/chrome-for-testing-public/${CHROMEDRIVER_VERSION}/linux64/chromedriver-linux64.zip" && \ + unzip -q -o /tmp/chromedriver.zip -d /tmp && \ + find /tmp -name "chromedriver" -type f -executable -exec cp {} /usr/local/bin/chromedriver \; && \ + chmod +x /usr/local/bin/chromium /usr/local/bin/chromedriver && \ + # Create chromium-browser symlink (FlareSolverr looks for chromium-browser) + ln -sf /usr/local/bin/chromium /usr/local/bin/chromium-browser && \ + ln -sf /usr/local/bin/chromium /usr/bin/chromium && \ + ln -sf /usr/local/bin/chromium-browser /usr/bin/chromium-browser && \ + # Move chromedriver to app directory (FlareSolverr expects it there) + mv /usr/local/bin/chromedriver /app/code/chromedriver && \ + chmod +x /app/code/chromedriver && \ + # Clean up + rm -rf /tmp/chrome* /tmp/chromedriver* /var/lib/apt/lists/* && \ + rm -f /usr/lib/x86_64-linux-gnu/libmfxhw* && \ + rm -f /usr/lib/x86_64-linux-gnu/mfx/* && \ + rm -f /libgl1-mesa-dri.deb /adwaita-icon-theme.deb + +# Copy FlareSolverr code from build stage +COPY --from=build_image /tmp/flaresolverr/src /app/code/flaresolverr +COPY --from=build_image /tmp/flaresolverr/requirements.txt /app/code/flaresolverr/ +COPY --from=build_image /tmp/flaresolverr/package.json /app/code/flaresolverr/ + +# Install Python dependencies +# Using --break-system-packages is acceptable in a Docker container +RUN pip3 install --break-system-packages --no-cache-dir -r /app/code/flaresolverr/requirements.txt && \ + rm -rf /root/.cache/pip + +# Set proper ownership +RUN chown -R cloudron:cloudron /app/code/flaresolverr + +# Copy start script +COPY start.sh /app/code/start.sh +RUN chmod +x /app/code/start.sh && chown cloudron:cloudron /app/code/start.sh + +# Set environment variables +ENV LANG=en_US.UTF-8 +ENV TZ=UTC +ENV LOG_LEVEL=info +ENV PORT=8191 +ENV HOST=0.0.0.0 + +# Expose port +EXPOSE 8191 + +# Use dumb-init to handle signals properly (avoids zombie chromium processes) +ENTRYPOINT ["/usr/bin/dumb-init", "--"] + +# Run as cloudron user +USER cloudron + +CMD ["/app/code/start.sh"] + diff --git a/LICENSE b/LICENSE index b083747..ef7d91e 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2026 bradinfluence +Copyright (c) 2026 BradInfluence Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including diff --git a/README.md b/README.md index 0690ca7..ceacb3c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,104 @@ # cloudron-flaresolverr -Proxy server to bypass Cloudflare protection. Packaged for Cloudron. \ No newline at end of file +Proxy server to bypass Cloudflare protection. Packaged for Cloudron. + +## About FlareSolverr + +FlareSolverr is a proxy server to bypass Cloudflare and DDoS-GUARD protection. It's particularly useful for applications like Radarr, Sonarr, Jackett, and other automation tools that need to access websites protected by Cloudflare. + +## Installation + +### Prerequisites + +You need to install Cloudron CLI: [Cloudron CLI Documentation](https://docs.cloudron.io/packaging/cli/) + +After installation, connect the CLI to your Cloudron instance: +```bash +cloudron login +``` + +### Build and Install + +1. Build the Docker image: + ```bash + docker build -t yourusername/flaresolverr:1.0.0 . + ``` + +2. Push the image to Docker Hub (or your preferred registry): + ```bash + docker push yourusername/flaresolverr:1.0.0 + ``` + +3. Install the app on Cloudron: + ```bash + cloudron install --image yourusername/flaresolverr:1.0.0 + ``` + + **Note:** Make sure you're in the `cloudron-flaresolverr` directory when running this command, as Cloudron CLI needs to read the `CloudronManifest.json` file. + +### Usage + +After installation, FlareSolverr will be available at the URL assigned by Cloudron. The default port is 8191. + +You can test the service by visiting: +- `https://your-app-url.cloudron.app/` - Shows welcome message +- `https://your-app-url.cloudron.app/health` - Health check endpoint + +### Configuration + +FlareSolverr can be configured using environment variables. Key environment variables include: + +- `LOG_LEVEL` - Logging level (default: `info`) +- `HOST` - Host to bind to (default: `0.0.0.0`) +- `PORT` - Port to listen on (default: `8191`) +- `CAPTCHA_SOLVER` - Captcha solver service (optional) +- `PROXY_URL` - Proxy URL (optional) +- `PROXY_USERNAME` - Proxy username (optional) +- `PROXY_PASSWORD` - Proxy password (optional) + +You can set these in your Cloudron app settings under "Environment Variables". + +### Integration with Other Apps + +To use FlareSolverr with other Cloudron apps (like Radarr, Sonarr, etc.), you'll need to: + +1. Get the internal IP address of your FlareSolverr container: + ```bash + docker ps + docker network inspect cloudron + ``` + +2. Configure your application to use FlareSolverr: + - URL: `http://:8191` + - Or use the Cloudron internal DNS if available + +### Features + +- ✅ Bypass Cloudflare protection +- ✅ Bypass DDoS-GUARD protection +- ✅ Headless Chrome/Chromium support +- ✅ Automatic session management +- ✅ Health check endpoint +- ✅ Prometheus metrics support + +### Troubleshooting + +If you encounter issues: + +1. Check the app logs: + ```bash + cloudron logs -f flaresolverr + ``` + +2. Verify Chromium is working correctly inside the container +3. Ensure proper permissions on `/app/data` directory + +### References + +- [FlareSolverr GitHub Repository](https://github.com/FlareSolverr/FlareSolverr) +- [Cloudron Packaging Documentation](https://docs.cloudron.io/packaging/) +- [Cloudron Packaging Tutorial](https://docs.cloudron.io/packaging/tutorial/) + +## License + +MIT License - see LICENSE file for details. diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..54d66cd Binary files /dev/null and b/icon.png differ diff --git a/start.sh b/start.sh new file mode 100755 index 0000000..ecbf894 --- /dev/null +++ b/start.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +set -eu + +# Create necessary directories for Chromium crash reports +# Cloudron mounts /app/data as a volume - try to create dirs, but don't fail if we can't +mkdir -p "/app/data/chromium/Crash Reports/pending" 2>/dev/null || true + +# Set environment variables for Chromium +export DISPLAY=:99 +# Ensure /usr/bin is in PATH so chromium is found before snap wrappers +export PATH="/usr/bin:/usr/local/bin:$PATH" + +# Clean up any stale Xvfb lock files +rm -f /tmp/.X99-lock + +# Start Xvfb for headless Chrome +Xvfb :99 -screen 0 1600x1200x24 -ac +extension GLX +render -noreset & + +# Wait for Xvfb to be ready +sleep 2 + +echo "Starting FlareSolverr..." + +# Change to FlareSolverr directory and start +cd /app/code/flaresolverr + +# Run FlareSolverr (same as official Dockerfile: python -u flaresolverr.py) +exec python3 -u flaresolverr.py +