Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
62a3707
feat(template): frappe HR, open source HR & Payroll software
NagariaHussain Jan 29, 2025
79fca72
Merge branch 'canary' into template-frappe-hr
Siumauricio Jan 31, 2025
6f2148c
feat: add deployable option to randomize and prevent colission in dup…
Siumauricio Feb 3, 2025
d424524
refactor: lint
Siumauricio Feb 3, 2025
65780ee
feat: make db configurable
NagariaHussain Feb 4, 2025
82cf064
fix: site volume configurable
NagariaHussain Feb 4, 2025
46411a5
fix: create site should use configured db
NagariaHussain Feb 4, 2025
4864297
chore: make erpnext template more configurable
NagariaHussain Feb 4, 2025
bd809c8
feat: added bulk actions for services start and stop and added servic…
vishalkadam47 Feb 5, 2025
7a472df
Merge pull request #1239 from NagariaHussain/template-frappe-hr
Siumauricio Feb 6, 2025
a9e3a65
Merge branch 'canary' into 1004-network-conflict
Siumauricio Feb 6, 2025
56b26ce
refactor: use appname in network connect
Siumauricio Feb 6, 2025
b024060
refactor: delete unneeded container_name
Siumauricio Feb 6, 2025
a71de72
refactor: remove services
Siumauricio Feb 6, 2025
8379068
refactor: remove services
Siumauricio Feb 6, 2025
f44512a
refactor: add condition to deploy on remote servers
Siumauricio Feb 6, 2025
17ce03e
Merge branch 'Dokploy:canary' into feat/bulk-actions
vishalkadam47 Feb 8, 2025
0a0f53e
chore: update unsend version to v1.3.2
mohabgabber Feb 9, 2025
b2d5090
Merge branch 'canary' of https://github.com/mohabgabber/dokploy into …
mohabgabber Feb 9, 2025
3e2cfe6
refactor: agroupate utilities
Siumauricio Feb 9, 2025
a8f9454
refactor: lint
Siumauricio Feb 9, 2025
c0a00f4
refactor: remove dokploy-network
Siumauricio Feb 9, 2025
3a5ecb2
refactor: remove unused imports
Siumauricio Feb 9, 2025
92c03bb
Merge pull request #1276 from Dokploy/1004-network-conflict
Siumauricio Feb 9, 2025
7e99baa
Merge branch 'canary' into canary
Siumauricio Feb 9, 2025
78e6068
Merge pull request #1297 from mohabgabber/canary
Siumauricio Feb 9, 2025
fcc5535
refactor: add catch to prevent throw error
Siumauricio Feb 9, 2025
0a6554c
refactor: add loading action
Siumauricio Feb 9, 2025
7e36433
Merge pull request #1282 from wish-oss/feat/bulk-actions
Siumauricio Feb 9, 2025
6b9fd59
feat: add openalternative
Siumauricio Feb 9, 2025
030c8a3
Update package.json
Siumauricio Feb 10, 2025
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
Binary file added .github/sponsors/openalternative.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ For detailed documentation, visit [docs.dokploy.com](https://docs.dokploy.com).
<a href="https://cloudblast.io/?ref=dokploy "><img src="https://cloudblast.io/img/logo-icon.193cf13e.svg" width="250px" alt="Cloudblast.io"/></a>
<a href="https://startupfa.me/?ref=dokploy "><img src=".github/sponsors/startupfame.png" width="65px" alt="Startupfame"/></a>
<a href="https://itsdb-center.com?ref=dokploy "><img src=".github/sponsors/its.png" width="65px" alt="Itsdb-center"/></a>
<a href="https://openalternative.co/?ref=dokploy "><img src=".github/sponsors/openalternative.png" width="65px" alt="Openalternative"/></a>
</div>

### Community Backers 🀝
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { useForm } from "react-hook-form";
import { toast } from "sonner";
import { z } from "zod";
import { validateAndFormatYAML } from "../../application/advanced/traefik/update-traefik-config";
import { RandomizeCompose } from "./randomize-compose";
import { ShowUtilities } from "./show-utilities";

interface Props {
composeId: string;
Expand Down Expand Up @@ -125,7 +125,7 @@ services:
</Form>
<div className="flex justify-between flex-col lg:flex-row gap-2">
<div className="w-full flex flex-col lg:flex-row gap-4 items-end">
<RandomizeCompose composeId={composeId} />
<ShowUtilities composeId={composeId} />
</div>
<Button
type="submit"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
import { AlertBlock } from "@/components/shared/alert-block";
import { CodeEditor } from "@/components/shared/code-editor";
import { Button } from "@/components/ui/button";
import {
DialogDescription,
DialogHeader,
DialogTitle,
} from "@/components/ui/dialog";
import {
Form,
FormControl,
FormDescription,
FormField,
FormItem,
FormLabel,
} from "@/components/ui/form";
import { Label } from "@/components/ui/label";
import { Switch } from "@/components/ui/switch";
import { api } from "@/utils/api";
import { zodResolver } from "@hookform/resolvers/zod";
import { AlertTriangle } from "lucide-react";
import { useEffect, useState } from "react";
import { useForm } from "react-hook-form";
import { toast } from "sonner";
import { z } from "zod";

interface Props {
composeId: string;
}

const schema = z.object({
isolatedDeployment: z.boolean().optional(),
});

type Schema = z.infer<typeof schema>;

export const IsolatedDeployment = ({ composeId }: Props) => {
const utils = api.useUtils();
const [compose, setCompose] = useState<string>("");
const { mutateAsync, error, isError } =
api.compose.isolatedDeployment.useMutation();

const { mutateAsync: updateCompose } = api.compose.update.useMutation();

const { data, refetch } = api.compose.one.useQuery(
{ composeId },
{ enabled: !!composeId },
);

console.log(data);

const form = useForm<Schema>({
defaultValues: {
isolatedDeployment: false,
},
resolver: zodResolver(schema),
});

useEffect(() => {
randomizeCompose();
if (data) {
form.reset({
isolatedDeployment: data?.isolatedDeployment || false,
});
}
}, [form, form.reset, form.formState.isSubmitSuccessful, data]);

const onSubmit = async (formData: Schema) => {
await updateCompose({
composeId,
isolatedDeployment: formData?.isolatedDeployment || false,
})
.then(async (data) => {
randomizeCompose();
refetch();
toast.success("Compose updated");
})
.catch(() => {
toast.error("Error updating the compose");
});
};

const randomizeCompose = async () => {
await mutateAsync({
composeId,
suffix: data?.appName || "",
})
.then(async (data) => {
await utils.project.all.invalidate();
setCompose(data);
toast.success("Compose Isolated");
})
.catch(() => {
toast.error("Error isolating the compose");
});
};

return (
<>
<DialogHeader>
<DialogTitle>Isolate Deployment</DialogTitle>
<DialogDescription>
Use this option to isolate the deployment of this compose file.
</DialogDescription>
</DialogHeader>
<div className="text-sm text-muted-foreground flex flex-col gap-2">
<span>
This feature creates an isolated environment for your deployment by
adding unique prefixes to all resources. It establishes a dedicated
network based on your compose file's name, ensuring your services run
in isolation. This prevents conflicts when running multiple instances
of the same template or services with identical names.
</span>
<div className="space-y-4">
<div>
<h4 className="font-medium mb-2">
Resources that will be isolated:
</h4>
<ul className="list-disc list-inside">
<li>Docker volumes</li>
<li>Docker networks</li>
</ul>
</div>
</div>
</div>
{isError && <AlertBlock type="error">{error?.message}</AlertBlock>}
<Form {...form}>
<form
onSubmit={form.handleSubmit(onSubmit)}
id="hook-form-add-project"
className="grid w-full gap-4"
>
{isError && (
<div className="flex flex-row gap-4 rounded-lg items-center bg-red-50 p-2 dark:bg-red-950">
<AlertTriangle className="text-red-600 dark:text-red-400" />
<span className="text-sm text-red-600 dark:text-red-400">
{error?.message}
</span>
</div>
)}

<div className="flex flex-col lg:flex-col gap-4 w-full ">
<div>
<FormField
control={form.control}
name="isolatedDeployment"
render={({ field }) => (
<FormItem className="mt-4 flex flex-row items-center justify-between rounded-lg border p-3 shadow-sm">
<div className="space-y-0.5">
<FormLabel>Enable Randomize ({data?.appName})</FormLabel>
<FormDescription>
Enable randomize to the compose file.
</FormDescription>
</div>
<FormControl>
<Switch
checked={field.value}
onCheckedChange={field.onChange}
/>
</FormControl>
</FormItem>
)}
/>
</div>

<div className="flex flex-col lg:flex-row gap-4 w-full items-end justify-end">
<Button
form="hook-form-add-project"
type="submit"
className="lg:w-fit"
>
Save
</Button>
</div>
</div>
<div className="flex flex-col gap-4">
<Label>Preview</Label>
<pre>
<CodeEditor
value={compose || ""}
language="yaml"
readOnly
height="50rem"
/>
</pre>
</div>
</form>
</Form>
</>
);
};
Loading