From 135222c9b4eae14bdf1bd89daa44fdfcc266f4d6 Mon Sep 17 00:00:00 2001 From: Joonas Bergius Date: Tue, 13 Aug 2024 15:42:54 -0500 Subject: [PATCH] feat: Add example systemd units and config files for 'baremetal' deployment Signed-off-by: Joonas Bergius --- deploy/baremetal/nats-leaf.conf | 15 +++++++++++++++ deploy/baremetal/nats-leaf.service | 18 ++++++++++++++++++ deploy/baremetal/wasmcloud-host.env | 4 ++++ deploy/baremetal/wasmcloud-host.service | 17 +++++++++++++++++ 4 files changed, 54 insertions(+) create mode 100644 deploy/baremetal/nats-leaf.conf create mode 100644 deploy/baremetal/nats-leaf.service create mode 100644 deploy/baremetal/wasmcloud-host.env create mode 100644 deploy/baremetal/wasmcloud-host.service diff --git a/deploy/baremetal/nats-leaf.conf b/deploy/baremetal/nats-leaf.conf new file mode 100644 index 0000000..3b6428b --- /dev/null +++ b/deploy/baremetal/nats-leaf.conf @@ -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://" + # credentials: "/etc/wasmcloud/nats.creds" + }, + ] +} \ No newline at end of file diff --git a/deploy/baremetal/nats-leaf.service b/deploy/baremetal/nats-leaf.service new file mode 100644 index 0000000..29e20cc --- /dev/null +++ b/deploy/baremetal/nats-leaf.service @@ -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 \ No newline at end of file diff --git a/deploy/baremetal/wasmcloud-host.env b/deploy/baremetal/wasmcloud-host.env new file mode 100644 index 0000000..fffbb8a --- /dev/null +++ b/deploy/baremetal/wasmcloud-host.env @@ -0,0 +1,4 @@ +# /etc/wasmcloud/wasmcloud-host.env +RUST_LOG=info +WASMCLOUD_JS_DOMAIN=default +# more config can go here ... \ No newline at end of file diff --git a/deploy/baremetal/wasmcloud-host.service b/deploy/baremetal/wasmcloud-host.service new file mode 100644 index 0000000..e988c3f --- /dev/null +++ b/deploy/baremetal/wasmcloud-host.service @@ -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 \ No newline at end of file