Smallweb 0.28
by Achille Lacoin
3 min read
Here is a little smallweb release drafted from the spotty wifi of a train, I hope you'll enjoy it!
Trying out smallweb is now easier than ever
The local setup of smallweb used to be quite a chore. In order to get started, you had to configure both caddy
and dnsmasq
, and run a bunch of shell commands.
Now you can try out smallweb by just running four commands!
brew install deno
brew install pomdtr/tap/smallweb
smallweb init --dir ~/smallweb --domain smallweb.traefik.me
smallweb up --dir ~/smallweb
Or using docker:
docker run -v ~/smallweb:/smallweb ghcr.io/pomdtr/smallweb:0.28.2 init --domain smallweb.traefik.me
docker run -v ~/smallweb:/smallweb -p 80:7777 ghcr.io/pomdtr/smallweb:0.28.2 up
Both smallweb.traefik.me
and *.smallweb.traefik.me
points to 127.0.0.1
, so you'll be able to access your smallweb apps at http://<app>.smallweb.traefik.me:7777
.
Of course, I would still advice to setup a reverse proxy like caddy in order to get a clean https://<app>.smallweb.traefik.me
url, but it is no longer a requirement!
Thanks to Justin for challenging me on this front!
Support for git pull / push workflow is back
If an app directory contains a .git
folder, you can clone it to your local device using:
# ex: git clone smallweb.run:blog
git clone <domain>:<app>
And deploy changes using git push
(in order for this to work, you'll have to run git config receive.denyCurrentBranch updateInstead
in the app folder).
I've been having a lot of fun mixing up smallweb and git. You can even interact with git repos from smallweb apps using isomorphic-git
! Here is a little "git log" app I built by mixing xterm.js and isomorphic-git:
admin
property is now set in the smallweb.json
manifest
The admin command is now set in the app config.
Instead of:
// .smallweb/config.json
{
"apps": {
"vscode": {
"admin": true
}
}
}
Use:
// vscode/smallweb.json
{
"admin": true
}
Support for public app cli
You can know allow anyone to use access app cli by passing a wildcard to the authorizedKeys
property:
// example-cli/main.ts
export default {
run(_args: string[]) {
console.log("Hello from smallweb")
}
}
// .smallweb/config.json
{
"apps": {
"example-cli": {
"authorizedKeys": [
"*"
]
}
}
}
Thanks again to Justin who was asking for this feature.
Output smallweb logs to a file
You can now configure smallweb to output http/console/crons/ssh/system logs to a file.
smallweb up --log-output=/tmp/smallweb.jsonl
One neat trick: you can output the logs to an app folder, then parse them from a smallweb app! I used this pattern to built myself a little log viewer.
You can play with it at https://logs.smallweb.club, and inspect the sources at https://github.com/pomdtr/smallweb-log-viewer.
Unstable flags are no longer set by default
Smallweb used to start deno workers with the --unstable-kv
, --unstable-temporal
and --unstable-raw-imports
flags by default.
This is no longer the case, and you now have to explicitly set them in your app deno.json
file:
// example/smallweb.json
{
"deno": {
"unstable": [
"kv",
"temporal",
"raw-imports"
]
}
}
This small changes makes it easier to run a smallweb app outside of smallweb (just use deno serve -A main.ts
).
Command deprecation
The smallweb secrets
, and smallweb open
commands have been deprecated:
smallweb secrets
was a niche command, and can be replaced by just running:sops -d secrets.enc.env
smallweb open
always openedhttps://<app>.<domain>
, but it is no longer the only way of serving smallweb apps.