Added additional params template for backend service
This commit is contained in:
parent
a7101b3ca5
commit
a636a3197d
@ -15,6 +15,7 @@ PIDFile=/run/{{.Coin.Alias}}/{{.Coin.Alias}}.pid
|
||||
{{else -}}
|
||||
Type=simple
|
||||
{{end}}
|
||||
{{template "Backend.ServiceAdditionalParamsTemplate" .}}
|
||||
|
||||
# Resource limits
|
||||
LimitNOFILE=500000
|
||||
|
||||
@ -48,23 +48,24 @@ type Config struct {
|
||||
MessageQueueBindingTemplate string `json:"message_queue_binding_template"`
|
||||
} `json:"ipc"`
|
||||
Backend struct {
|
||||
PackageName string `json:"package_name"`
|
||||
PackageRevision string `json:"package_revision"`
|
||||
SystemUser string `json:"system_user"`
|
||||
Version string `json:"version"`
|
||||
BinaryURL string `json:"binary_url"`
|
||||
VerificationType string `json:"verification_type"`
|
||||
VerificationSource string `json:"verification_source"`
|
||||
ExtractCommand string `json:"extract_command"`
|
||||
ExcludeFiles []string `json:"exclude_files"`
|
||||
ExecCommandTemplate string `json:"exec_command_template"`
|
||||
LogrotateFilesTemplate string `json:"logrotate_files_template"`
|
||||
PostinstScriptTemplate string `json:"postinst_script_template"`
|
||||
ServiceType string `json:"service_type"`
|
||||
ProtectMemory bool `json:"protect_memory"`
|
||||
Mainnet bool `json:"mainnet"`
|
||||
ConfigFile string `json:"config_file"`
|
||||
AdditionalParams interface{} `json:"additional_params"`
|
||||
PackageName string `json:"package_name"`
|
||||
PackageRevision string `json:"package_revision"`
|
||||
SystemUser string `json:"system_user"`
|
||||
Version string `json:"version"`
|
||||
BinaryURL string `json:"binary_url"`
|
||||
VerificationType string `json:"verification_type"`
|
||||
VerificationSource string `json:"verification_source"`
|
||||
ExtractCommand string `json:"extract_command"`
|
||||
ExcludeFiles []string `json:"exclude_files"`
|
||||
ExecCommandTemplate string `json:"exec_command_template"`
|
||||
LogrotateFilesTemplate string `json:"logrotate_files_template"`
|
||||
PostinstScriptTemplate string `json:"postinst_script_template"`
|
||||
ServiceType string `json:"service_type"`
|
||||
ServiceAdditionalParamsTemplate string `json:"service_additional_params_template"`
|
||||
ProtectMemory bool `json:"protect_memory"`
|
||||
Mainnet bool `json:"mainnet"`
|
||||
ConfigFile string `json:"config_file"`
|
||||
AdditionalParams interface{} `json:"additional_params"`
|
||||
} `json:"backend"`
|
||||
Blockbook struct {
|
||||
PackageName string `json:"package_name"`
|
||||
@ -95,13 +96,14 @@ func jsonToString(msg json.RawMessage) (string, error) {
|
||||
|
||||
func (c *Config) ParseTemplate() *template.Template {
|
||||
templates := map[string]string{
|
||||
"IPC.RPCURLTemplate": c.IPC.RPCURLTemplate,
|
||||
"IPC.MessageQueueBindingTemplate": c.IPC.MessageQueueBindingTemplate,
|
||||
"Backend.ExecCommandTemplate": c.Backend.ExecCommandTemplate,
|
||||
"Backend.LogrotateFilesTemplate": c.Backend.LogrotateFilesTemplate,
|
||||
"Backend.PostinstScriptTemplate": c.Backend.PostinstScriptTemplate,
|
||||
"Blockbook.InternalBindingTemplate": c.Blockbook.InternalBindingTemplate,
|
||||
"Blockbook.PublicBindingTemplate": c.Blockbook.PublicBindingTemplate,
|
||||
"IPC.RPCURLTemplate": c.IPC.RPCURLTemplate,
|
||||
"IPC.MessageQueueBindingTemplate": c.IPC.MessageQueueBindingTemplate,
|
||||
"Backend.ExecCommandTemplate": c.Backend.ExecCommandTemplate,
|
||||
"Backend.LogrotateFilesTemplate": c.Backend.LogrotateFilesTemplate,
|
||||
"Backend.PostinstScriptTemplate": c.Backend.PostinstScriptTemplate,
|
||||
"Backend.ServiceAdditionalParamsTemplate": c.Backend.ServiceAdditionalParamsTemplate,
|
||||
"Blockbook.InternalBindingTemplate": c.Blockbook.InternalBindingTemplate,
|
||||
"Blockbook.PublicBindingTemplate": c.Blockbook.PublicBindingTemplate,
|
||||
}
|
||||
|
||||
funcMap := template.FuncMap{
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log",
|
||||
"postinst_script_template": "",
|
||||
"service_type": "forking",
|
||||
"service_additional_params_template": "",
|
||||
"protect_memory": true,
|
||||
"mainnet": true,
|
||||
"config_file": "bitcoin.conf"
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet3/*.log",
|
||||
"postinst_script_template": "",
|
||||
"service_type": "forking",
|
||||
"service_additional_params_template": "",
|
||||
"protect_memory": true,
|
||||
"mainnet": false,
|
||||
"config_file": "bitcoin.conf"
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log",
|
||||
"postinst_script_template": "",
|
||||
"service_type": "forking",
|
||||
"service_additional_params_template": "",
|
||||
"protect_memory": true,
|
||||
"mainnet": true,
|
||||
"config_file": "bitcoin.conf",
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log",
|
||||
"postinst_script_template": "",
|
||||
"service_type": "forking",
|
||||
"service_additional_params_template": "",
|
||||
"protect_memory": true,
|
||||
"mainnet": true,
|
||||
"config_file": "bitcoin.conf",
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet3/*.log",
|
||||
"postinst_script_template": "",
|
||||
"service_type": "forking",
|
||||
"service_additional_params_template": "",
|
||||
"protect_memory": true,
|
||||
"mainnet": false,
|
||||
"config_file": "bitcoin.conf",
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log",
|
||||
"postinst_script_template": "",
|
||||
"service_type": "forking",
|
||||
"service_additional_params_template": "",
|
||||
"protect_memory": true,
|
||||
"mainnet": true,
|
||||
"config_file": "bitcoin.conf",
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet3/*.log",
|
||||
"postinst_script_template": "",
|
||||
"service_type": "forking",
|
||||
"service_additional_params_template": "",
|
||||
"protect_memory": true,
|
||||
"mainnet": false,
|
||||
"config_file": "bitcoin.conf",
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log",
|
||||
"postinst_script_template": "",
|
||||
"service_type": "forking",
|
||||
"service_additional_params_template": "",
|
||||
"protect_memory": false,
|
||||
"mainnet": true,
|
||||
"config_file": "bitcoin.conf",
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log",
|
||||
"postinst_script_template": "",
|
||||
"service_type": "simple",
|
||||
"service_additional_params_template": "",
|
||||
"protect_memory": true,
|
||||
"mainnet": true,
|
||||
"config_file": ""
|
||||
|
||||
@ -29,6 +29,7 @@
|
||||
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/{{.Coin.Alias}}.log",
|
||||
"postinst_script_template": "",
|
||||
"service_type": "simple",
|
||||
"service_additional_params_template": "",
|
||||
"protect_memory": true,
|
||||
"mainnet": false,
|
||||
"config_file": ""
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log",
|
||||
"postinst_script_template": "",
|
||||
"service_type": "forking",
|
||||
"service_additional_params_template": "",
|
||||
"protect_memory": true,
|
||||
"mainnet": true,
|
||||
"config_file": "bitcoin.conf",
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet4/*.log",
|
||||
"postinst_script_template": "",
|
||||
"service_type": "forking",
|
||||
"service_additional_params_template": "",
|
||||
"protect_memory": true,
|
||||
"mainnet": false,
|
||||
"config_file": "bitcoin.conf",
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log",
|
||||
"postinst_script_template": "",
|
||||
"service_type": "forking",
|
||||
"service_additional_params_template": "",
|
||||
"protect_memory": true,
|
||||
"mainnet": true,
|
||||
"config_file": "bitcoin.conf",
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log",
|
||||
"postinst_script_template": "",
|
||||
"service_type": "forking",
|
||||
"service_additional_params_template": "",
|
||||
"protect_memory": true,
|
||||
"mainnet": true,
|
||||
"config_file": "bitcoin.conf",
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet3/*.log",
|
||||
"postinst_script_template": "",
|
||||
"service_type": "forking",
|
||||
"service_additional_params_template": "",
|
||||
"protect_memory": true,
|
||||
"mainnet": false,
|
||||
"config_file": "bitcoin.conf",
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/*.log",
|
||||
"postinst_script_template": "HOME={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/zcash-fetch-params",
|
||||
"service_type": "forking",
|
||||
"service_additional_params_template": "Environment=\"HOME={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend\"",
|
||||
"protect_memory": false,
|
||||
"mainnet": true,
|
||||
"config_file": "bitcoin.conf",
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
"logrotate_files_template": "{{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend/testnet3/*.log",
|
||||
"postinst_script_template": "HOME={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend {{.Env.BackendInstallPath}}/{{.Coin.Alias}}/bin/zcash-fetch-params --testnet",
|
||||
"service_type": "forking",
|
||||
"service_additional_params_template": "Environment=\"HOME={{.Env.BackendDataPath}}/{{.Coin.Alias}}/backend\"",
|
||||
"protect_memory": false,
|
||||
"mainnet": false,
|
||||
"config_file": "bitcoin.conf",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user