Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iopsys
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Feed
iopsys
Commits
a1b4b34b
Commit
a1b4b34b
authored
1 year ago
by
Vivek Dutta
Browse files
Options
Downloads
Patches
Plain Diff
bbfdm: option to add respawn and core for microservice
parent
b0ea1a6a
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
bbfdm/Makefile
+1
-1
1 addition, 1 deletion
bbfdm/Makefile
bbfdm/files/etc/config/bbfdm
+5
-0
5 additions, 0 deletions
bbfdm/files/etc/config/bbfdm
bbfdm/files/etc/init.d/bbfdmd
+50
-3
50 additions, 3 deletions
bbfdm/files/etc/init.d/bbfdmd
with
56 additions
and
4 deletions
bbfdm/Makefile
+
1
−
1
View file @
a1b4b34b
...
...
@@ -5,7 +5,7 @@
include
$(TOPDIR)/rules.mk
PKG_NAME
:=
bbfdm
PKG_VERSION
:=
1.7.1
7
PKG_VERSION
:=
1.7.1
8
USE_LOCAL
:=
0
ifneq
($(USE_LOCAL),1)
...
...
This diff is collapsed.
Click to expand it.
bbfdm/files/etc/config/bbfdm
+
5
−
0
View file @
a1b4b34b
...
...
@@ -4,3 +4,8 @@ config bbfdmd 'bbfdmd'
option refresh_time '10'
option transaction_timeout '30'
option subprocess_level '2'
config micro_services 'micro_services'
option enable '1'
option enable_core '0'
option enable_respawn '1'
This diff is collapsed.
Click to expand it.
bbfdm/files/etc/init.d/bbfdmd
+
50
−
3
View file @
a1b4b34b
...
...
@@ -10,6 +10,8 @@ BBFDM_JSON_INPUT="/etc/bbfdm/input.json"
BBFDM_MICROSERVICE_DIR
=
"/etc/bbfdm/micro_services"
BBFDM_TEMP_DIR
=
"/tmp/bbfdm"
.
/usr/share/libubox/jshn.sh
log
()
{
echo
"
${
@
}
"
|logger
-t
bbfdmd.init
-p
info
}
...
...
@@ -26,15 +28,60 @@ validate_bbfdm_bbfdmd_section()
'subprocess_level:uinteger'
}
validate_bbfdm_micro_service_section
()
{
uci_validate_section bbfdm micro_services
"micro_services"
\
'enable:bool:true'
\
'enable_core:bool:false'
\
'enable_respawn:bool:true'
}
bbfdm_add_micro_service
()
{
local
name path
local
name path cmd
local enable
enable_core enable_respawn
validate_bbfdm_micro_service_section
||
{
log
"Validation of micro_service section failed"
return
1
;
}
[
"
${
enable
}
"
-eq
"0"
]
&&
return
0
path
=
"
${
1
}
"
name
=
"
$(
basename
${
path
}
)
"
name
=
"
${
name
//.json
}
"
ubus call service add
"{'name':'bbfdm.services','instances':{'
$name
':{'command':['
${
PROG
}
','-m','
$path
']}}}"
json_init
json_add_string name
"bbfdm.services"
json_add_object
"instances"
json_add_object
"
${
name
}
"
json_add_array
"command"
json_add_string
""
"
${
PROG
}
"
json_add_string
""
"-m"
json_add_string
""
"
${
path
}
"
json_close_array
if
[
"
${
enable_core
}
"
-eq
"1"
]
;
then
json_add_object
"limits"
json_add_string
"core"
"unlimited"
json_close_object
json_add_boolean
"stdout"
1
json_add_boolean
"stderr"
1
fi
if
[
"
${
enable_respawn
}
"
-eq
"1"
]
;
then
json_add_array
"respawn"
json_add_string
""
"3600"
json_add_string
""
"5"
json_add_string
""
"5"
json_close_array
fi
json_close_object
json_close_object
cmd
=
"
$(
json_dump
)
"
ubus call service add
"
${
cmd
}
"
}
_add_microservice
()
...
...
@@ -108,7 +155,7 @@ start_service()
stop_service
()
{
ubus call service
sta
te
'{"name":"bbfdm.services"
, "spawn":false
}'
ubus call service
dele
te
'{"name":"bbfdm.services"}'
}
service_triggers
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment