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 = () => {
22
22
const { mutateAsync : reloadServer , isLoading } =
23
23
api . settings . reloadServer . useMutation ( ) ;
24
24
25
+ const { mutateAsync : cleanRedis } = api . settings . cleanRedis . useMutation ( ) ;
26
+ const { mutateAsync : reloadRedis } = api . settings . reloadRedis . useMutation ( ) ;
27
+
25
28
return (
26
29
< DropdownMenu >
27
30
< DropdownMenuTrigger asChild disabled = { isLoading } >
@@ -69,6 +72,36 @@ export const ShowDokployActions = () => {
69
72
{ t ( "settings.server.webServer.updateServerIp" ) }
70
73
</ DropdownMenuItem >
71
74
</ 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 >
72
105
</ DropdownMenuGroup >
73
106
</ DropdownMenuContent >
74
107
</ DropdownMenu >
Original file line number Diff line number Diff line change @@ -79,6 +79,33 @@ export const settingsRouter = createTRPCRouter({
79
79
await execAsync ( `docker service update --force ${ stdout . trim ( ) } ` ) ;
80
80
return true ;
81
81
} ) ,
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
+ } ) ,
82
109
reloadTraefik : adminProcedure
83
110
. input ( apiServerSchema )
84
111
. mutation ( async ( { input } ) => {
You can’t perform that action at this time.
0 commit comments