Closed flynneva closed 3 months ago
Hi,
I'm not aware of a quick way to list the available language modules.
The best way I know is to look in the modules directory, where this is will depend on where you got Unit from.
Perhaps unitd --version
will show you... E.g
$ /path/to/unitd --version
unit version: 1.33.0
configured as ./configure --prefix=/opt/unit --modulesdir=/opt/unit/modules --statedir=/opt/unit/state --runstatedir=/opt/unit --tmpdir=/var/tmp --logdir=/opt/unit --log=/opt/unit/unit.log --pid=/opt/unit/unit.pid --control=unix:/opt/unit/control.unit.sock
Here we see the modules directory set to --modulesdir=/opt/unit/modules
and I have a few modules in there
$ ls -l /opt/unit/modules
total 15860
-rwxr-xr-x 1 andrew andrew 593200 Apr 26 2023 python.unit.so
-rwxr-xr-x 1 andrew andrew 268040 Apr 12 2023 skel.unit.so
-rwxr-xr-x 1 andrew andrew 306808 Mar 14 14:31 wasm.unit.so
-rwxr-xr-x 1 andrew andrew 15068536 Mar 14 14:31 wasm_wasi_component.unit.so
wasm_wasi_component.unit.so
is the one you're interested in.
My Unit is built from source. If you installed Unit via your package manager, then each language module is likely in its own package.
For example on Fedora 39 we have
unit.x86_64
unit-devel.x86_64
unit-go.noarch
unit-jsc-common.noarch
unit-jsc17.x86_64
unit-perl.x86_64
unit-php.x86_64
unit-python312.x86_64
unit-ruby.x86_64
unit-wasm.x86_64
The unit-wasm
package contains the wasm-wasi-component
module.
$ sudo dnf repoquery -l unit-wasm.x86_64
Last metadata expiration check: 0:00:57 ago on Mon 01 Apr 2024 15:43:50 BST.
/usr/lib/.build-id
/usr/lib/.build-id/18
/usr/lib/.build-id/18/e435b54d8219b9ef41ef6bf4d13454df44a7b7
/usr/lib/.build-id/18/e435b54d8219b9ef41ef6bf4d13454df44a7b7.1
/usr/lib/.build-id/31
/usr/lib/.build-id/31/efc65dfefe2e9d6720315024843e8cc3c32ada
/usr/lib/.build-id/48
/usr/lib/.build-id/48/d8753714c2be0d8fa051ed273797f6ef0fd808
/usr/lib/.build-id/77
/usr/lib/.build-id/77/8556ce4c7cabaf69fba1b8813aa4979d543ad1
/usr/lib64/libwasmtime.so
/usr/lib64/unit/debug-modules/wasm.unit.so
/usr/lib64/unit/debug-modules/wasm_wasi_component.unit.so
/usr/lib64/unit/modules/wasm.unit.so
/usr/lib64/unit/modules/wasm_wasi_component.unit.so
/usr/share/doc/unit-wasm
/usr/share/doc/unit-wasm/COPYRIGHT
/usr/lib/.build-id
/usr/lib/.build-id/2f
/usr/lib/.build-id/2f/6b26f01091470114724721378fb6de5c4b31b0
/usr/lib/.build-id/45
/usr/lib/.build-id/45/00826d63f8a733b1ee03ad1c648cddbf16df4b
/usr/lib/.build-id/45/00826d63f8a733b1ee03ad1c648cddbf16df4b.1
/usr/lib/.build-id/54
/usr/lib/.build-id/54/94970b203abc3a9a352abba5cdf6fb83ba7784
/usr/lib/.build-id/db
/usr/lib/.build-id/db/1855b7dda1a68d8bc4acd1aa8df954ffa0fa03
/usr/lib64/libwasmtime.so
/usr/lib64/unit/debug-modules/wasm.unit.so
/usr/lib64/unit/debug-modules/wasm_wasi_component.unit.so
/usr/lib64/unit/modules/wasm.unit.so
/usr/lib64/unit/modules/wasm_wasi_component.unit.so
/usr/share/doc/unit-wasm
/usr/share/doc/unit-wasm/COPYRIGHT
Unit logs the modules it discovers at startup. You can run unitd
in the foreground to see this output directly. Here's what it looks like on my Mac (with lots of modules loaded):
$ unitd --no-daemon --control unix:/tmp/t --log /dev/stderr
2024/04/01 18:54:50 [warn] 10857#14455726 Unit is running unprivileged, then it cannot use arbitrary user and group.
2024/04/01 18:54:50 [info] 10857#14455726 unit 1.32.1 started
2024/04/01 18:54:50 [info] 10858#14455728 discovery started
2024/04/01 18:54:50 [notice] 10858#14455728 module: java 11.0.22 "/opt/homebrew/lib/unit/modules/java.unit.so"
2024/04/01 18:54:50 [notice] 10858#14455728 module: perl 5.38.2 "/opt/homebrew/lib/unit/modules/perl.unit.so"
2024/04/01 18:54:50 [notice] 10858#14455728 module: php 8.3.4 "/opt/homebrew/lib/unit/modules/php.unit.so"
2024/04/01 18:54:50 [notice] 10858#14455728 module: python 3.12.2 "/opt/homebrew/lib/unit/modules/python3.unit.so"
2024/04/01 18:54:50 [notice] 10858#14455728 module: ruby 3.3.0 "/opt/homebrew/lib/unit/modules/ruby.unit.so"
2024/04/01 18:54:50 [notice] 10858#14455728 module: wasm 0.1 "/opt/homebrew/lib/unit/modules/wasm.unit.so"
2024/04/01 18:54:50 [notice] 10858#14455728 module: wasm-wasi-component 0.1 "/opt/homebrew/lib/unit/modules/wasm_wasi_component.unit.so"
…
^C
Note you'll need to manually ^C
to quit.
If you scroll to the platform you're using at https://unit.nginx.org/installation/ there are instructions for how to install the individual modules.
@ac000 @lcrilly big thank you to both of you! 🙏🏼 exactly what I was looking for.
Roughly following the tutorial here to use unit to serve my own rust yew app I am seeing this error when trying to load the configuration:
As a total newbie here, a few questions that may have super simple answers:
unitc
server supports?unitc
?Somewhat related would be a suggestion for an article on how to take a
trunk build --release
built site and deploying it in production withunit
. I don't think there are any really good tutorials to do this yet out there in the world and could be a great use case forunit
.