File tree Expand file tree Collapse file tree 2 files changed +60
-0
lines changed
components/dashboard/settings/servers/actions Expand file tree Collapse file tree 2 files changed +60
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ export const ShowDokployActions = () => {
2222 const { mutateAsync : reloadServer , isLoading } =
2323 api . settings . reloadServer . useMutation ( ) ;
2424
25+ const { mutateAsync : cleanRedis } = api . settings . cleanRedis . useMutation ( ) ;
26+ const { mutateAsync : reloadRedis } = api . settings . reloadRedis . useMutation ( ) ;
27+
2528 return (
2629 < DropdownMenu >
2730 < DropdownMenuTrigger asChild disabled = { isLoading } >
@@ -69,6 +72,36 @@ export const ShowDokployActions = () => {
6972 { t ( "settings.server.webServer.updateServerIp" ) }
7073 </ DropdownMenuItem >
7174 </ UpdateServerIp >
75+
76+ < DropdownMenuItem
77+ className = "cursor-pointer"
78+ onClick = { async ( ) => {
79+ await cleanRedis ( )
80+ . then ( async ( ) => {
81+ toast . success ( "Redis cleaned" ) ;
82+ } )
83+ . catch ( ( ) => {
84+ toast . error ( "Error cleaning Redis" ) ;
85+ } ) ;
86+ } }
87+ >
88+ Clean Redis
89+ </ DropdownMenuItem >
90+
91+ < DropdownMenuItem
92+ className = "cursor-pointer"
93+ onClick = { async ( ) => {
94+ await reloadRedis ( )
95+ . then ( async ( ) => {
96+ toast . success ( "Redis reloaded" ) ;
97+ } )
98+ . catch ( ( ) => {
99+ toast . error ( "Error reloading Redis" ) ;
100+ } ) ;
101+ } }
102+ >
103+ Reload Redis
104+ </ DropdownMenuItem >
72105 </ DropdownMenuGroup >
73106 </ DropdownMenuContent >
74107 </ DropdownMenu >
Original file line number Diff line number Diff line change @@ -79,6 +79,33 @@ export const settingsRouter = createTRPCRouter({
7979 await execAsync ( `docker service update --force ${ stdout . trim ( ) } ` ) ;
8080 return true ;
8181 } ) ,
82+ cleanRedis : adminProcedure . mutation ( async ( ) => {
83+ if ( IS_CLOUD ) {
84+ return true ;
85+ }
86+
87+ const { stdout : containerId } = await execAsync (
88+ `docker ps --filter "name=dokploy-redis" --filter "status=running" -q | head -n 1` ,
89+ ) ;
90+
91+ if ( ! containerId ) {
92+ throw new Error ( "Redis container not found" ) ;
93+ }
94+
95+ const redisContainerId = containerId . trim ( ) ;
96+
97+ await execAsync ( `docker exec -i ${ redisContainerId } redis-cli flushall` ) ;
98+ return true ;
99+ } ) ,
100+ reloadRedis : adminProcedure . mutation ( async ( ) => {
101+ if ( IS_CLOUD ) {
102+ return true ;
103+ }
104+
105+ await execAsync ( "docker service scale dokploy-redis=0" ) ;
106+ await execAsync ( "docker service scale dokploy-redis=1" ) ;
107+ return true ;
108+ } ) ,
82109 reloadTraefik : adminProcedure
83110 . input ( apiServerSchema )
84111 . mutation ( async ( { input } ) => {
You can’t perform that action at this time.
0 commit comments