mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-03 03:08:22 +00:00
binfmt_misc: example systemd service file
This commit is contained in:
@@ -46,3 +46,9 @@
|
|||||||
* `libwasmer-static`, containing `libwasmer.a`.
|
* `libwasmer-static`, containing `libwasmer.a`.
|
||||||
|
|
||||||
The Wasmer distro packaging story is still in its infancy, so feedback is very welcome.
|
The Wasmer distro packaging story is still in its infancy, so feedback is very welcome.
|
||||||
|
|
||||||
|
## Miscellaneous: binfmt_misc
|
||||||
|
|
||||||
|
Wasmer can be registered as a binfmt interpreter for wasm binaries.
|
||||||
|
An example systemd [.service](./scripts/wasmer-binfmt.service.example) is included here.
|
||||||
|
Please consider statically linking the wasmer binary so that this capability is also available in mount namespaces.
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ enum Action {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Unregister and/or register wasmer as binfmt interpreter
|
/// Unregister and/or register wasmer as binfmt interpreter
|
||||||
|
///
|
||||||
|
/// Check the wasmer repository for a systemd service definition example
|
||||||
|
/// to automate the process at start-up.
|
||||||
#[derive(StructOpt)]
|
#[derive(StructOpt)]
|
||||||
pub struct Binfmt {
|
pub struct Binfmt {
|
||||||
// Might be better to traverse the mount list
|
// Might be better to traverse the mount list
|
||||||
|
|||||||
15
scripts/wasmer-binfmt.service.example
Normal file
15
scripts/wasmer-binfmt.service.example
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Set up wasmer to handle execution of wasm binaries
|
||||||
|
DefaultDependencies=no
|
||||||
|
Conflicts=shutdown.target
|
||||||
|
After=proc-sys-fs-binfmt_misc.automount
|
||||||
|
After=proc-sys-fs-binfmt_misc.mount
|
||||||
|
Before=sysinit.target shutdown.target
|
||||||
|
ConditionPathIsReadWrite=/proc/sys/
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
RemainAfterExit=yes
|
||||||
|
ExecStart=/usr/bin/wasmer binfmt reregister
|
||||||
|
ExecStop=/usr/bin/wasmer binfmt unregister
|
||||||
|
TimeoutSec=10s
|
||||||
Reference in New Issue
Block a user