Skip to content

Commit

Permalink
Merge pull request #12 from joonas/feat/example-baremetal-configs
Browse files Browse the repository at this point in the history
feat: Add example systemd units and config files for 'baremetal' deployment
  • Loading branch information
joonas authored Aug 13, 2024
2 parents c6d6056 + 135222c commit 4ffedf3
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
15 changes: 15 additions & 0 deletions deploy/baremetal/nats-leaf.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# /etc/wasmcloud/nats-leaf.conf
jetstream {
domain=leaf
store_dir="/tmp/nats-leaf-jetstream"
}

listen: "127.0.0.1:4222"
leafnodes {
remotes = [
{
url: "nats://<ip-or-url-to-nats-server>"
# credentials: "/etc/wasmcloud/nats.creds"
},
]
}
18 changes: 18 additions & 0 deletions deploy/baremetal/nats-leaf.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# $HOME/.config/systemd/user/nats-leaf.service
[Unit]
Description=NATS Leaf Server
After=network-online.target systemd-timesyncd.service

[Service]
PrivateTmp=true
Type=simple
Environment=NATS_CONFIG=/etc/wasmcloud/nats-leaf.conf
ExecStart=/usr/local/bin/nats-server -js --pid /tmp/nats-leaf.pid --config ${NATS_CONFIG}
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s SIGINT $MAINPID
# The nats-server uses SIGUSR2 to trigger using Lame Duck Mode (LDM) shutdown
KillSignal=SIGUSR2
# You might want to adjust TimeoutStopSec too.

[Install]
WantedBy=multi-user.target
4 changes: 4 additions & 0 deletions deploy/baremetal/wasmcloud-host.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# /etc/wasmcloud/wasmcloud-host.env
RUST_LOG=info
WASMCLOUD_JS_DOMAIN=default
# more config can go here ...
17 changes: 17 additions & 0 deletions deploy/baremetal/wasmcloud-host.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# $HOME/.config/systemd/user/wasmcloud-host.service
[Unit]
Description=wasmCloud Host
Documentation=https://wasmcloud.com/docs/
After=nats-leaf.service network-online.target
Wants=network-online.target
Requires=nats-leaf.service

[Service]
EnvironmentFile=/etc/wasmcloud/wasmcloud-host.env
ExecStart=/usr/local/bin/wasmcloud
Restart=always
StartLimitInterval=0
RestartSec=5

[Install]
WantedBy=multi-user.target

0 comments on commit 4ffedf3

Please sign in to comment.