Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ feat(cloudflared-web): Add cloudflared-web docker-compose and config #2241

Merged
merged 1 commit into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Apps/cloudflared-web/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "cloudflared-web",
"version": "2024.11.1",
"image": "wisdomsky/cloudflared-web",
"youtube": "",
"docs_link": "",
"big_bear_cosmos_youtube": ""
}
92 changes: 92 additions & 0 deletions Apps/cloudflared-web/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Configuration for cloudflared-web setup

# Name of the big-bear-cloudflared-web application
name: big-bear-cloudflared-web

# Service definitions for the big-bear-cloudflared-web application
services:
# Service name: big-bear-cloudflared-web
# The `big-bear-cloudflared-web` service definition
big-bear-cloudflared-web:
# Name of the container
container_name: big-bear-cloudflared-web

Comment on lines +12 to +13
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add volume mounts for persistence

The configuration lacks volume mounts for persisting tunnel configurations and credentials. Without persistence, tunnel configurations will be lost when the container is recreated.

Add volume mounts:

    container_name: big-bear-cloudflared-web
+   volumes:
+     - ./data:/root/.cloudflared
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
container_name: big-bear-cloudflared-web
container_name: big-bear-cloudflared-web
volumes:
- ./data:/root/.cloudflared

# Image to be used for the container
image: wisdomsky/cloudflared-web:2024.11.1

# Container restart policy
restart: unless-stopped

# Network mode
network_mode: host
Comment on lines +20 to +21
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Security: Reconsider using host network mode

Using network_mode: host gives the container full access to the host's network stack, which violates the principle of least privilege. Consider using bridge networking with specific port mappings instead.

-    network_mode: host
+    networks:
+      - cloudflared_network
+    ports:
+      - "14333:14333"

Committable suggestion skipped: line range outside the PR's diff.


# Environment variables for the container
environment:
- WEBUI_PORT=14333
- EDGE_IP_VERSION=auto
- PROTOCOL=auto
- METRICS_ENABLE=false
- METRICS_PORT=60123
- BASIC_AUTH_USER=admin
- BASIC_AUTH_PASS=""
Comment on lines +30 to +31
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Security: Empty basic auth password is a security risk

The BASIC_AUTH_PASS is set to an empty string, which effectively disables authentication when combined with the default admin username. This could expose the web UI to unauthorized access.

Consider:

  1. Making the password a required configuration
  2. Adding a warning in the installation tips about setting a strong password
  3. Implementing a secure default state


x-casaos: # CasaOS specific configuration
envs:
- container: WEBUI_PORT
description:
en_us: "Web UI Port"
- container: EDGE_IP_VERSION
description:
en_us: "Edge IP Version"
- container: PROTOCOL
description:
en_us: "Protocol"
- container: METRICS_ENABLE
description:
en_us: "Metrics Enable"
- container: METRICS_PORT
description:
en_us: "Metrics Port"
- container: BASIC_AUTH_USER
description:
en_us: "Basic Auth User"
- container: BASIC_AUTH_PASS
ports:
- container: "14333"
description:
en_us: "Container Port: 14333"

Comment on lines +33 to +58
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enhance environment variable configuration

The environment variable definitions could be improved with:

  1. Validation rules for ports and IP versions
  2. Marking sensitive fields (like BASIC_AUTH_PASS)
  3. Default values where appropriate

Add validation and sensitivity markers:

     - container: BASIC_AUTH_PASS
+      sensitive: true
+      description:
+        en_us: "Basic Auth Password (required)"
+    - container: WEBUI_PORT
+      validation:
+        min: 1024
+        max: 65535
+      default: "14333"

Committable suggestion skipped: line range outside the PR's diff.

# CasaOS specific configuration
x-casaos:
# Supported CPU architectures for the application
architectures:
- amd64
- arm64
# Main service of the application
main: big-bear-cloudflared-web
description:
# Description in English
en_us: Cloudflared-web is a docker image that packages both cloudflared cli and a simple Web UI to easily start or stop remotely-managed Cloudflare tunnel.
tagline:
# Short description or tagline in English
en_us: Cloudflared Web
# Developer's name or identifier
developer: "wisdomsky"
# Author of this configuration
author: BigBearTechWorld
# Icon for the application
icon: https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/png/cloudflare.png
# Thumbnail image (currently empty)
thumbnail: ""
title:
# Title in English
en_us: Cloudflared Web
# Application category
category: BigBearCasaOS
# Port mapping information
port_map: "14333"
# Tips
tips:
before_install:
en_us: |
Read this before installing: https://community.bigbeartechworld.com/t/added-cloudflared-web-to-bigbearcasaos/2275?u=dragonfire1119
Comment on lines +89 to +92
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Community link is accessible, but installation tips need enhancement

The community link is valid and accessible (HTTP 200 response). However, the current setup lacks essential information directly in the compose file. Consider:

  • Adding basic inline setup instructions for quick reference
  • Including security recommendations
  • Adding health check configuration as suggested

Example enhancement:

  tips:
    before_install:
      en_us: |
        Quick setup:
        1. Configure your Cloudflare credentials
        2. Set up tunnel authentication
        3. Ensure ports 14333 and 8080 are available

        For detailed instructions: https://community.bigbeartechworld.com/t/added-cloudflared-web-to-bigbearcasaos/2275?u=dragonfire1119

        Security recommendations:
        - Use secure credentials storage
        - Regularly update the image
        - Monitor tunnel status
🔗 Analysis chain

Verify the community link and enhance installation tips

While providing a community link is helpful, consider:

  1. Adding basic setup instructions inline
  2. Including security recommendations
  3. Adding a health check configuration

Add health check configuration:

    image: wisdomsky/cloudflared-web:2024.11.1
+   healthcheck:
+     test: ["CMD", "curl", "-f", "http://localhost:14333"]
+     interval: 30s
+     timeout: 10s
+     retries: 3
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify if the community link is accessible
curl -I "https://community.bigbeartechworld.com/t/added-cloudflared-web-to-bigbearcasaos/2275"

Length of output: 1716

Loading