mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
feat: add replica sets migration
This commit is contained in:
@@ -18,6 +18,7 @@ import { DropdownMenuItem } from "@/components/ui/dropdown-menu";
|
|||||||
import {
|
import {
|
||||||
Form,
|
Form,
|
||||||
FormControl,
|
FormControl,
|
||||||
|
FormDescription,
|
||||||
FormField,
|
FormField,
|
||||||
FormItem,
|
FormItem,
|
||||||
FormLabel,
|
FormLabel,
|
||||||
@@ -550,13 +551,14 @@ export const AddDatabase = ({ projectId, projectName }: Props) => {
|
|||||||
name="replicaSets"
|
name="replicaSets"
|
||||||
render={({ field }) => {
|
render={({ field }) => {
|
||||||
return (
|
return (
|
||||||
<FormItem>
|
<FormItem className="flex flex-row items-center justify-between p-3 mt-4 border rounded-lg shadow-sm">
|
||||||
<FormLabel>Use Replica Sets</FormLabel>
|
<div className="space-y-0.5">
|
||||||
|
<FormLabel>Use Replica Sets</FormLabel>
|
||||||
|
</div>
|
||||||
<FormControl>
|
<FormControl>
|
||||||
<Switch
|
<Switch
|
||||||
checked={field.value}
|
checked={field.value}
|
||||||
onCheckedChange={field.onChange}
|
onCheckedChange={field.onChange}
|
||||||
aria-readonly
|
|
||||||
/>
|
/>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
|
|||||||
1
apps/dokploy/drizzle/0052_short_thunderbolt_ross.sql
Normal file
1
apps/dokploy/drizzle/0052_short_thunderbolt_ross.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE "mongo" ADD COLUMN "replicaSets" boolean DEFAULT false;
|
||||||
4247
apps/dokploy/drizzle/meta/0052_snapshot.json
Normal file
4247
apps/dokploy/drizzle/meta/0052_snapshot.json
Normal file
File diff suppressed because it is too large
Load Diff
@@ -365,6 +365,13 @@
|
|||||||
"when": 1734241482851,
|
"when": 1734241482851,
|
||||||
"tag": "0051_hard_gorgon",
|
"tag": "0051_hard_gorgon",
|
||||||
"breakpoints": true
|
"breakpoints": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"idx": 52,
|
||||||
|
"version": "6",
|
||||||
|
"when": 1735116913467,
|
||||||
|
"tag": "0052_short_thunderbolt_ross",
|
||||||
|
"breakpoints": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@@ -72,12 +72,14 @@ else
|
|||||||
echo "Replica set already initialized."
|
echo "Replica set already initialized."
|
||||||
fi
|
fi
|
||||||
`
|
`
|
||||||
: "mongod --port 27017 --bind_ip_all & MONGOD_PID=$!"
|
: ""
|
||||||
}
|
}
|
||||||
|
|
||||||
${command ?? "wait $MONGOD_PID"}`;
|
${command ?? "wait $MONGOD_PID"}`;
|
||||||
|
|
||||||
const defaultMongoEnv = `MONGO_INITDB_ROOT_USERNAME=${databaseUser}\nMONGO_INITDB_ROOT_PASSWORD=${databasePassword}\nMONGO_INITDB_DATABASE=admin\n${env ? `${env}` : ""}`;
|
const defaultMongoEnv = `MONGO_INITDB_ROOT_USERNAME=${databaseUser}\nMONGO_INITDB_ROOT_PASSWORD=${databasePassword}${replicaSets ? "\nMONGO_INITDB_DATABASE=admin" : ""}${
|
||||||
|
env ? `\n${env}` : ""
|
||||||
|
}`;
|
||||||
|
|
||||||
const resources = calculateResources({
|
const resources = calculateResources({
|
||||||
memoryLimit,
|
memoryLimit,
|
||||||
@@ -103,8 +105,17 @@ ${command ?? "wait $MONGOD_PID"}`;
|
|||||||
Image: dockerImage,
|
Image: dockerImage,
|
||||||
Env: envVariables,
|
Env: envVariables,
|
||||||
Mounts: [...volumesMount, ...bindsMount, ...filesMount],
|
Mounts: [...volumesMount, ...bindsMount, ...filesMount],
|
||||||
Command: ["/bin/bash"],
|
...(replicaSets
|
||||||
Args: ["-c", startupScript],
|
? {
|
||||||
|
Command: ["/bin/bash"],
|
||||||
|
Args: ["-c", startupScript],
|
||||||
|
}
|
||||||
|
: {
|
||||||
|
...(command && {
|
||||||
|
Command: ["/bin/bash"],
|
||||||
|
Args: ["-c", command],
|
||||||
|
}),
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
Networks: [{ Target: "dokploy-network" }],
|
Networks: [{ Target: "dokploy-network" }],
|
||||||
Resources: {
|
Resources: {
|
||||||
|
|||||||
Reference in New Issue
Block a user