-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat: add wildcard domain support with DNS challenge #3929
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
base: canary
Are you sure you want to change the base?
Changes from all commits
ed3764e
494fbea
2bbb612
80c23dc
af1bce3
33cb7b7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -35,11 +35,30 @@ type Schema = z.infer<typeof schema>; | |||||||||||||||||||||||||
| interface Props { | ||||||||||||||||||||||||||
| children?: React.ReactNode; | ||||||||||||||||||||||||||
| serverId?: string; | ||||||||||||||||||||||||||
| autoOpen?: boolean; | ||||||||||||||||||||||||||
| showDnsGuide?: boolean; | ||||||||||||||||||||||||||
| onOpenChange?: (open: boolean) => void; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| export const EditTraefikEnv = ({ children, serverId }: Props) => { | ||||||||||||||||||||||||||
| export const EditTraefikEnv = ({ | ||||||||||||||||||||||||||
| children, | ||||||||||||||||||||||||||
| serverId, | ||||||||||||||||||||||||||
| autoOpen = false, | ||||||||||||||||||||||||||
| showDnsGuide = false, | ||||||||||||||||||||||||||
| onOpenChange: onOpenChangeProp, | ||||||||||||||||||||||||||
| }: Props) => { | ||||||||||||||||||||||||||
| const [isOpen, setIsOpen] = useState(autoOpen); | ||||||||||||||||||||||||||
| const [canEdit, setCanEdit] = useState(true); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| useEffect(() => { | ||||||||||||||||||||||||||
| setIsOpen(autoOpen); | ||||||||||||||||||||||||||
| }, [autoOpen]); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| const handleOpenChange = (open: boolean) => { | ||||||||||||||||||||||||||
| setIsOpen(open); | ||||||||||||||||||||||||||
| onOpenChangeProp?.(open); | ||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| const { data } = api.settings.readTraefikEnv.useQuery({ | ||||||||||||||||||||||||||
| serverId, | ||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||
|
|
@@ -100,17 +119,33 @@ export const EditTraefikEnv = ({ children, serverId }: Props) => { | |||||||||||||||||||||||||
| }, [form, onSubmit, isPending, canEdit]); | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||
| <Dialog> | ||||||||||||||||||||||||||
| <DialogTrigger asChild>{children}</DialogTrigger> | ||||||||||||||||||||||||||
| <Dialog open={isOpen} onOpenChange={handleOpenChange}> | ||||||||||||||||||||||||||
| {children && <DialogTrigger asChild>{children}</DialogTrigger>} | ||||||||||||||||||||||||||
| <DialogContent className="sm:max-w-4xl"> | ||||||||||||||||||||||||||
| <DialogHeader> | ||||||||||||||||||||||||||
| <DialogTitle>Update Traefik Environment</DialogTitle> | ||||||||||||||||||||||||||
| <DialogDescription> | ||||||||||||||||||||||||||
| Update the traefik environment variables | ||||||||||||||||||||||||||
| Update the traefik environment variables. For wildcard | ||||||||||||||||||||||||||
| SSL certificates, configure your DNS provider credentials | ||||||||||||||||||||||||||
| below. | ||||||||||||||||||||||||||
| </DialogDescription> | ||||||||||||||||||||||||||
|
Comment on lines
126
to
131
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Dialog description unconditionally references wildcard certificates The updated Consider making the description conditional on
Suggested change
|
||||||||||||||||||||||||||
| </DialogHeader> | ||||||||||||||||||||||||||
| {isError && <AlertBlock type="error">{error?.message}</AlertBlock>} | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| {showDnsGuide && ( | ||||||||||||||||||||||||||
| <AlertBlock type="info"> | ||||||||||||||||||||||||||
| <strong>DNS Challenge for Wildcard Certificates:</strong>{" "} | ||||||||||||||||||||||||||
| To use wildcard domains (e.g., *.example.com) with HTTPS, | ||||||||||||||||||||||||||
| add your DNS provider API credentials here. Common providers: | ||||||||||||||||||||||||||
| <ul className="mt-1 ml-4 list-disc text-xs space-y-0.5"> | ||||||||||||||||||||||||||
| <li><strong>Cloudflare:</strong> <code>CF_DNS_API_TOKEN=your_token</code></li> | ||||||||||||||||||||||||||
| <li><strong>Route53:</strong> <code>AWS_ACCESS_KEY_ID</code> + <code>AWS_SECRET_ACCESS_KEY</code></li> | ||||||||||||||||||||||||||
| <li><strong>DigitalOcean:</strong> <code>DO_AUTH_TOKEN=your_token</code></li> | ||||||||||||||||||||||||||
| <li><strong>Hetzner:</strong> <code>HETZNER_API_KEY=your_key</code></li> | ||||||||||||||||||||||||||
| </ul> | ||||||||||||||||||||||||||
| </AlertBlock> | ||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||
|
Comment on lines
+135
to
+147
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. DNS guide omits the required The guide correctly shows per-provider API credentials ( provider: process.env.TRAEFIK_DNS_PROVIDER || "cloudflare",A user who follows the Route 53, DigitalOcean, or Hetzner rows, sets the correct API credentials in the Traefik Env dialog, but never sets The guide should mention that |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| <Form {...form}> | ||||||||||||||||||||||||||
| <form | ||||||||||||||||||||||||||
| id="hook-form-update-server-traefik-config" | ||||||||||||||||||||||||||
|
|
@@ -128,14 +163,16 @@ export const EditTraefikEnv = ({ children, serverId }: Props) => { | |||||||||||||||||||||||||
| <CodeEditor | ||||||||||||||||||||||||||
| language="properties" | ||||||||||||||||||||||||||
| wrapperClassName="h-[35rem] font-mono" | ||||||||||||||||||||||||||
| placeholder={`TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT_ACME_EMAIL=test@localhost.com | ||||||||||||||||||||||||||
| TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT_STORAGE=/etc/dokploy/traefik/dynamic/acme.json | ||||||||||||||||||||||||||
| TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT_HTTP_CHALLENGE=true | ||||||||||||||||||||||||||
| TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT_HTTP_CHALLENGE_PRETTY=true | ||||||||||||||||||||||||||
| TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT_HTTP_CHALLENGE_ENTRYPOINT=web | ||||||||||||||||||||||||||
| TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT_HTTP_CHALLENGE_DNS_CHALLENGE=true | ||||||||||||||||||||||||||
| TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT_HTTP_CHALLENGE_DNS_PROVIDER=cloudflare | ||||||||||||||||||||||||||
| `} | ||||||||||||||||||||||||||
| placeholder={ | ||||||||||||||||||||||||||
| showDnsGuide | ||||||||||||||||||||||||||
| ? `# DNS Challenge credentials for wildcard certificates | ||||||||||||||||||||||||||
| CF_DNS_API_TOKEN=your_cloudflare_api_token | ||||||||||||||||||||||||||
| CF_API_EMAIL=your_cloudflare_email` | ||||||||||||||||||||||||||
| : `TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT_ACME_EMAIL=test@localhost.com | ||||||||||||||||||||||||||
| TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT_ACME_STORAGE=/etc/dokploy/traefik/dynamic/acme.json | ||||||||||||||||||||||||||
| TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT_ACME_HTTPCHALLENGE=true | ||||||||||||||||||||||||||
| TRAEFIK_CERTIFICATESRESOLVERS_LETSENCRYPT_ACME_HTTPCHALLENGE_ENTRYPOINT=web` | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| {...field} | ||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||
| </FormControl> | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.