-
Notifications
You must be signed in to change notification settings - Fork 77
Add optional automatic TLS Docker Compose example #215
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
Open
LegacyAngel2K9
wants to merge
3
commits into
pelican:main
Choose a base branch
from
LegacyAngel2K9:angel-fix-81
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| # This opt-in example uses Wings' built-in ACME client to issue and renew a | ||
| # Let's Encrypt certificate. The default Compose example remains unchanged. | ||
| # It requires exclusive access to port 80 on the published host address. When | ||
| # Panel or another reverse proxy shares that address, terminate TLS there and | ||
| # proxy to Wings instead, or bind Wings to a separate public address. | ||
| # | ||
| # Before starting: | ||
| # 1. Set WINGS_HOSTNAME to the node FQDN without a scheme or port. | ||
| # 2. Set WINGS_API_PORT and WINGS_SFTP_PORT to the same ports configured in | ||
| # /etc/pelican/config.yml. Port 80 is reserved for the ACME HTTP-01 challenge. | ||
| # 3. Create the Panel node with HTTPS enabled and matching daemon ports. | ||
| # 4. Point the FQDN directly at this host. When using Cloudflare, keep the | ||
| # record DNS only because the configured SFTP port cannot use the proxy. | ||
| # 5. Allow inbound TCP traffic on port 80 and both configured service ports. | ||
| # Every published A and AAAA address must reach this host on those ports. | ||
| # | ||
| # Example .env: | ||
| # WINGS_HOSTNAME=node.example.com | ||
| # WINGS_API_PORT=8080 | ||
| # WINGS_SFTP_PORT=2022 | ||
| # | ||
| # The existing /var/lib/pelican volume persists the ACME account and certificate | ||
| # cache at /var/lib/pelican/.tls-cache across container restarts. | ||
|
|
||
| services: | ||
| wings: | ||
| image: ghcr.io/pelican/wings:latest | ||
| restart: always | ||
| command: | ||
| - /usr/bin/wings | ||
| - --config | ||
| - /etc/pelican/config.yml | ||
| - --auto-tls | ||
| - --tls-hostname | ||
| - "${WINGS_HOSTNAME:?Set WINGS_HOSTNAME to the node FQDN}" | ||
| networks: | ||
| - wings0 | ||
| ports: | ||
| - "80:80" | ||
| - "${WINGS_API_PORT:?Set WINGS_API_PORT to the API port in config.yml}:${WINGS_API_PORT:?Set WINGS_API_PORT to the API port in config.yml}" | ||
| - "${WINGS_SFTP_PORT:?Set WINGS_SFTP_PORT to the SFTP port in config.yml}:${WINGS_SFTP_PORT:?Set WINGS_SFTP_PORT to the SFTP port in config.yml}" | ||
| tty: true | ||
| environment: | ||
| TZ: "UTC" | ||
| WINGS_UID: 988 | ||
| WINGS_GID: 988 | ||
| WINGS_USERNAME: pelican | ||
| volumes: | ||
| - "/var/run/docker.sock:/var/run/docker.sock" | ||
| - "/var/lib/docker/containers/:/var/lib/docker/containers/" | ||
| - "/etc/pelican/:/etc/pelican/" | ||
| - "/var/lib/pelican/:/var/lib/pelican/" | ||
| - "/var/log/pelican/:/var/log/pelican/" | ||
| - "/tmp/pelican/:/tmp/pelican/" | ||
| - "/etc/ssl/certs:/etc/ssl/certs:ro" | ||
| # You may need /srv/daemon-data when upgrading from an old daemon. | ||
| #- "/srv/daemon-data/:/srv/daemon-data/" | ||
|
|
||
| networks: | ||
| wings0: | ||
| name: wings0 | ||
| driver: bridge | ||
| ipam: | ||
| config: | ||
| - subnet: "172.21.0.0/16" | ||
| driver_opts: | ||
| com.docker.network.bridge.name: wings0 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: pelican/wings
Length of output: 5301
🌐 Web query:
Docker Compose interpolation required value syntax :? empty variable and ports host port range duplicate published ports official documentation💡 Result:
Docker Compose supports variable interpolation with a Bash-like syntax. For mandatory variables, you can use the following patterns [1][2][3]: - ${VARIABLE:?error}: Exits with an error message if the variable is unset or empty [1][2][3]. - ${VARIABLE?error}: Exits with an error message if the variable is unset (but allows empty values) [1][2][3]. Regarding port mapping and host port ranges, duplicate ports or overlaps often cause errors because they conflict with network binding rules on the host [4][5]. Docker requires unique port mappings to avoid "address already in use" errors [6][4][7]. If you encounter duplicate port errors: 1. Ensure your service configuration does not inadvertently merge duplicate ports (e.g., when using extends or multiple Compose files) [6][7]. 2. Use docker compose config to inspect the fully resolved configuration and identify where duplicates are occurring [8]. 3. For dynamic port ranges, assigning a range (e.g., 8000-8010:80) allows the engine to select an available port within that range, which helps avoid conflicts when running multiple replicas [4][5]. Avoid hardcoding specific host-side ports if you need to scale services on the same host [4]. If you face specific "must be unique" errors, check that your variables for port mappings do not resolve to the same value across different entries in the ports array [8][7].
Citations:
🏁 Script executed:
Repository: pelican/wings
Length of output: 16803
🏁 Script executed:
Repository: pelican/wings
Length of output: 27635
🏁 Script executed:
Repository: pelican/wings
Length of output: 586
🌐 Web query:
site:docs.docker.com/reference/compose-file/services ports published target ports unique duplicate port mappings💡 Result:
In containerization, specifically within Docker and Docker Compose, port mappings facilitate communication between a host machine and a container [1][2]. Target ports and published ports are defined as follows: - Target: Refers to the specific port on which the service inside the container is listening [1]. - Published: Refers to the port on the host machine that is exposed to the external network [1]. When traffic hits this published port on the host, it is routed to the corresponding target port inside the container [1]. Regarding unique and duplicate port mappings: - Port mappings must be unique per host interface. Because a specific port on a host machine can only be bound by one process at a time, you cannot map multiple containers to the same published host port on the same IP address [1]. - Attempting to map multiple containers to the same published host port will result in a bind error, typically indicating that the address is already in use [1]. - If you do not specify a published port, the container runtime can automatically allocate an unassigned, unique port on the host [1]. - Port mapping should not be used when network_mode is set to host, as the container already shares the host's networking stack directly, making explicit mappings redundant and resulting in a runtime error [1].
Citations:
Reject invalid or conflicting service-port values before Compose starts.
The
${...:? ...}expressions reject only unset or empty variables. They do not reject non-port values, port80, or equalWINGS_API_PORTandWINGS_SFTP_PORTvalues. These values conflict with the ACME binding or with published service bindings. Add a preflight that validates ports from1through65535, excludes80, and requires the service ports to differ. Test unset, non-numeric, boundary, reserved, and duplicate-port cases.🤖 Prompt for AI Agents