Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions agent/app/dto/request/host_tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type SupervisorProcessConfig struct {
Numprocs string `json:"numprocs"`
AutoRestart string `json:"autoRestart"`
AutoStart string `json:"autoStart"`
Environment string `json:"environment"`
}

type SupervisorProcessFileReq struct {
Expand Down
1 change: 1 addition & 0 deletions agent/app/dto/response/host_tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type SupervisorProcessConfig struct {
Status []ProcessStatus `json:"status"`
AutoRestart string `json:"autoRestart"`
AutoStart string `json:"autoStart"`
Environment string `json:"environment"`
}

type ProcessStatus struct {
Expand Down
8 changes: 8 additions & 0 deletions agent/app/service/host_tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,9 @@ func handleProcess(supervisordDir string, req request.SupervisorProcessConfig, c
_, _ = section.NewKey("priority", "999")
_, _ = section.NewKey("numprocs", req.Numprocs)
_, _ = section.NewKey("process_name", "%(program_name)s_%(process_num)02d")
if req.Environment != "" {
_, _ = section.NewKey("environment", req.Environment)
}

if err = configFile.SaveTo(iniPath); err != nil {
return err
Expand Down Expand Up @@ -363,6 +366,8 @@ func handleProcess(supervisordDir string, req request.SupervisorProcessConfig, c
autoRestart.SetValue(req.AutoRestart)
autoStart := section.Key("autostart")
autoStart.SetValue(req.AutoStart)
environment := section.Key("environment")
environment.SetValue(req.Environment)

if err = configFile.SaveTo(iniPath); err != nil {
return err
Expand Down Expand Up @@ -435,6 +440,9 @@ func handleProcessConfig(configDir, containerName string) ([]response.Supervisor
if autoStart, _ := section.GetKey("autostart"); autoStart != nil {
config.AutoStart = autoStart.Value()
}
if environment, _ := section.GetKey("environment"); environment != nil {
config.Environment = environment.Value()
}
_ = getProcessStatus(&config, containerName)
result = append(result, config)
}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/api/interface/host-tool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export namespace HostTool {
status?: ProcessStatus[];
autoRestart: string;
autoStart: string;
environment: string;
}

export interface ProcessStatus {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/api/interface/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ export namespace Runtime {
dir: string;
numprocs: string;
id: number;
environment: string;
}

export interface PHPContainerConfig {
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/views/toolbox/supervisor/create/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
<el-form-item :label="$t('tool.supervisor.numprocs')" prop="numprocsNum">
<el-input type="number" v-model.number="process.numprocsNum"></el-input>
</el-form-item>
<el-form-item :label="$t('process.env')" prop="environment">
<el-input type="text" v-model="process.environment"></el-input>
</el-form-item>
<el-form-item :label="$t('tool.supervisor.autoRestart')" prop="autoRestart">
<el-switch v-model="process.autoRestart" active-value="true" inactive-value="false"></el-switch>
<span class="input-help">{{ $t('tool.supervisor.autoRestartHelper') }}</span>
Expand Down Expand Up @@ -84,6 +87,7 @@ const initData = () => ({
numprocs: '1',
autoRestart: 'true',
autoStart: 'true',
environment: '',
});
const process = ref(initData());

Expand Down Expand Up @@ -116,6 +120,7 @@ const acceptParams = (operate: string, config: HostTool.SupersivorProcess) => {
numprocs: config.numprocs,
autoRestart: config.autoRestart,
autoStart: config.autoStart,
environment: config.environment || '',
};
process.value.numprocsNum = Number(config.numprocs);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
<el-form-item :label="$t('tool.supervisor.numprocs')" prop="numprocsNum">
<el-input type="number" v-model.number="process.numprocsNum"></el-input>
</el-form-item>
<el-form-item :label="$t('process.env')" prop="environment">
<el-input type="text" v-model="process.environment"></el-input>
</el-form-item>
<el-form-item :label="$t('tool.supervisor.autoRestart')" prop="autoRestart">
<el-switch v-model="process.autoRestart" active-value="true" inactive-value="false"></el-switch>
</el-form-item>
Expand Down Expand Up @@ -77,6 +80,7 @@ const initData = (runtimeID: number) => ({
id: runtimeID,
autoRestart: 'true',
autoStart: 'true',
environment: '',
});
const process = ref(initData(0));
const em = defineEmits(['close']);
Expand Down Expand Up @@ -105,6 +109,7 @@ const acceptParams = (operate: string, config: HostTool.SupersivorProcess, id: n
id: id,
autoRestart: config.autoRestart,
autoStart: config.autoStart,
environment: config.environment || '',
};
process.value.numprocsNum = Number(config.numprocs);
}
Expand Down
Loading