Smallweb 0.24

by Achille Lacoin

3 min read

I spent the last week (and probably the next one) working on the smallweb.live platform. I'm quite happy with the progress, as the list of alpha testers is steadily growing.

Still, I've made a few changes on the smallweb cli, so here is a new release!

If you want to join the alpha, either register in the waitlist, or reach out to me on discord. Active users on discord will get priority access!

opentelemetry support, removal of the smallweb logs command

Deno 2.2 introduced support for opentelemetry! I've added a few lines of code to make sure that the smallweb cli is compatible with this new feature.

To use opentelemetry, you first need to have an opentelemetry collector setup:

docker run --name lgtm -p 3000:3000 -p 4317:4317 -p 4318:4318 --rm -ti \
    -v "$PWD"/lgtm/grafana:/data/grafana \
    -v "$PWD"/lgtm/prometheus:/data/prometheus \
    -v "$PWD"/lgtm/loki:/data/loki \
    -e GF_PATHS_DATA=/data/grafana \
    docker.io/grafana/otel-lgtm:0.8.1

Then just start smallweb with the OTEL_DENO flag:

OTEL_DENO=true smallweb up

And you should see your metrics in grafana!

grafana screenshot

Smallweb will use the app domain as the OTEL_SERVICE_NAME.

You can find out more info about configuring opentelemetry (and create custom metrics) in the deno docs.

If you don't want to self-host your own opentelemtry collector, you can create a free account on grafana cloud. See their documentation for more information about how to setup opentelemetry.

As part of this change, I've removed the smallweb logs command. I just don't think smallweb should manage its own logs (your console logs will still appears on the stderr when you run smallweb up). If you still want your http logs to be saved to a file, I encourage you to setup caddy in front of smallweb, and use the log directive. Here is an example of a caddyfile:

smallweb.localhost, *.smallweb.localhost {
    reverse_proxy localhost:7777
    log {
        output file /var/log/caddy/smallweb.log
    }
}

enforce minimum deno version to 2.2

You will need to make sure that you have deno 2.2 installed to use the latest version of smallweb.

You can upgrade the deno version installed on your system using deno upgrade.

The opentelemetry support was only released in deno 2.2, and I want to make sure that all smallweb users have access to node:sqlite.

updated git remote urls

Instead of using ssh://<appname>@<domain>, you should now use _@<domain>:<appname>.git (_ maps to the smallweb cli in smallweb).

The main benefit is that it works better with git clone (git clone _@<domain>:<appname>.git automatically creates an <appname> directory).

If you already had existing remotes setup, just update the url with:

git remote set-url <remote-name> _@<domain>:<appname>.git

You should also remove the existing repos in your .smallweb/repos/ directory, and they will be automatically recreated on git push.

removal of the smallweb fetch command

The smallweb fetch command allowed you to test the fetch entrypoint without having smallweb running. I almost never used it, and I doubt anyone else did. I've removed it to cleanup the codebase.

new vs code extension

I created a VS Code extension for smallweb ! It still quite rough (currently it only allows you to quickly open an app in the browser), but I plan to add more features in the future.

In the screenshot below, you can see me editing this blog post while having a preview of the smallweb website on the right.

vs code extension

The extension is available on the vs code marketplace.

deprecation of the --cron flag in favour of --enable-crons

I just find it more explicit. Both are still supported for the time beeing, but I encourage you to use the new flag.