-
-
Notifications
You must be signed in to change notification settings - Fork 556
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #367 from Dokploy/canary
v0.7.1
- Loading branch information
Showing
70 changed files
with
673 additions
and
578 deletions.
There are no files selected for viewing
This file contains 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 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,26 @@ | ||
# License | ||
|
||
## Core License (Apache License 2.0) | ||
|
||
Copyright 2024 Mauricio Siu. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and limitations under the License. | ||
|
||
## Additional Terms for Specific Features | ||
|
||
The following additional terms apply to the multi-node support and Docker Compose file support features of Dokploy. In the event of a conflict, these provisions shall take precedence over those in the Apache License: | ||
|
||
- **Self-Hosted Version Free**: All features of Dokploy, including multi-node support and Docker Compose file support, will always be free to use in the self-hosted version. | ||
- **Restriction on Resale**: The multi-node support and Docker Compose file support features cannot be sold or offered as a service by any party other than the copyright holder without prior written consent. | ||
- **Modification Distribution**: Any modifications to the multi-node support and Docker Compose file support features must be distributed freely and cannot be sold or offered as a service. | ||
|
||
For further inquiries or permissions, please contact us directly. |
This file contains 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 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 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
146 changes: 146 additions & 0 deletions
146
apps/dokploy/components/dashboard/settings/web-server/edit-traefik-env.tsx
This file contains 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,146 @@ | ||
import { AlertBlock } from "@/components/shared/alert-block"; | ||
import { CodeEditor } from "@/components/shared/code-editor"; | ||
import { Button } from "@/components/ui/button"; | ||
import { | ||
Dialog, | ||
DialogContent, | ||
DialogDescription, | ||
DialogFooter, | ||
DialogHeader, | ||
DialogTitle, | ||
DialogTrigger, | ||
} from "@/components/ui/dialog"; | ||
import { | ||
Form, | ||
FormControl, | ||
FormField, | ||
FormItem, | ||
FormLabel, | ||
FormMessage, | ||
} from "@/components/ui/form"; | ||
import { api } from "@/utils/api"; | ||
import { zodResolver } from "@hookform/resolvers/zod"; | ||
import { useEffect, useState } from "react"; | ||
import { useForm } from "react-hook-form"; | ||
import { toast } from "sonner"; | ||
import { z } from "zod"; | ||
|
||
const schema = z.object({ | ||
env: z.string(), | ||
}); | ||
|
||
type Schema = z.infer<typeof schema>; | ||
|
||
interface Props { | ||
children?: React.ReactNode; | ||
} | ||
|
||
export const EditTraefikEnv = ({ children }: Props) => { | ||
const [canEdit, setCanEdit] = useState(true); | ||
|
||
const { data } = api.settings.readTraefikEnv.useQuery(); | ||
|
||
const { mutateAsync, isLoading, error, isError } = | ||
api.settings.writeTraefikEnv.useMutation(); | ||
|
||
const form = useForm<Schema>({ | ||
defaultValues: { | ||
env: data || "", | ||
}, | ||
disabled: canEdit, | ||
resolver: zodResolver(schema), | ||
}); | ||
|
||
useEffect(() => { | ||
if (data) { | ||
form.reset({ | ||
env: data || "", | ||
}); | ||
} | ||
}, [form, form.reset, data]); | ||
|
||
const onSubmit = async (data: Schema) => { | ||
await mutateAsync(data.env) | ||
.then(async () => { | ||
toast.success("Traefik Env Updated"); | ||
}) | ||
.catch(() => { | ||
toast.error("Error to update the traefik env"); | ||
}); | ||
}; | ||
|
||
return ( | ||
<Dialog> | ||
<DialogTrigger asChild>{children}</DialogTrigger> | ||
<DialogContent className="max-h-screen overflow-y-auto sm:max-w-4xl"> | ||
<DialogHeader> | ||
<DialogTitle>Update Traefik Env</DialogTitle> | ||
<DialogDescription>Update the traefik env</DialogDescription> | ||
</DialogHeader> | ||
{isError && <AlertBlock type="error">{error?.message}</AlertBlock>} | ||
|
||
<Form {...form}> | ||
<form | ||
id="hook-form-update-server-traefik-config" | ||
onSubmit={form.handleSubmit(onSubmit)} | ||
className="w-full space-y-4 relative overflow-auto" | ||
> | ||
<div className="flex flex-col"> | ||
<FormField | ||
control={form.control} | ||
name="env" | ||
render={({ field }) => ( | ||
<FormItem className="relative"> | ||
<FormLabel>Env</FormLabel> | ||
<FormControl> | ||
<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 | ||
`} | ||
{...field} | ||
/> | ||
</FormControl> | ||
|
||
<pre> | ||
<FormMessage /> | ||
</pre> | ||
<div className="flex justify-end absolute z-50 right-6 top-0"> | ||
<Button | ||
className="shadow-sm" | ||
variant="secondary" | ||
type="button" | ||
onClick={async () => { | ||
setCanEdit(!canEdit); | ||
}} | ||
> | ||
{canEdit ? "Unlock" : "Lock"} | ||
</Button> | ||
</div> | ||
</FormItem> | ||
)} | ||
/> | ||
</div> | ||
</form> | ||
|
||
<DialogFooter> | ||
<Button | ||
isLoading={isLoading} | ||
disabled={canEdit} | ||
form="hook-form-update-server-traefik-config" | ||
type="submit" | ||
> | ||
Update | ||
</Button> | ||
</DialogFooter> | ||
</Form> | ||
</DialogContent> | ||
</Dialog> | ||
); | ||
}; |
This file contains 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
Oops, something went wrong.