Smallweb 0.22

by Achille Lacoin

2 min read

Wait, what? Another release so soon? Wasn't the last one just a few days ago?

Yes, it was! But as part of my current work on smallweb.live (previously refered to as smallweb cloud), I had to make a few changes on smallweb cli. And as I'm onboarding a few users on the platform, I wanted to make sure the local development experience matched the remote one.

Want to join the smallweb.live alpha? Either register in the waitlist, or reach out to me on discord. Active users on discord will get priority access!

Redesigned smallweb config

Let me start with an example, showing every fields available in the new $SMALLWEB_DIR/.smallweb/config.json file:

{
    // global configuration
    
    // main domain
    "domain": "smallweb.run",
    // additional wildcard domains
    "additionalDomains": ["example.com"],
    // authorized ssh keys for all apps
    "authorizedKeys": [
        "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEPR1N/c+B7OPXEraFx2r3UHViHFbZ2Afg8VQLQ59ZKd"
    ],
    // app-specific configuration
    "apps": {
        "vscode": {
            // wether the app is an admin or not
            "admin": true,
            // additional domains for this app
            "additionalDomains": ["vscode.pomdtr.me"],
            // authorized ssh keys for this app
            "authorizedKeys": [
                "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJW+GQk0KCvSreL+y3AZdtCu82+13E2eEled+sGRkIEv"
            ]
        }
    }
}

As you can see, the changes can be summarized as follows:

  • authorized ssh keys are moved from authorized_keys files to the config file
  • customDomains is now additionalDomains, and can be set globally or per app
  • all of the app specific configs are moved to the apps object

Thanks to @TayzenDev for the help on this one!

Removal of global environment variables

In the previous versions of smallweb, you could set global environment variables either in the $SMALLWEB_DIR/.env file or in the $SMALLWEB_DIR/.smallweb/secrets.enc.env file.

I think it was a bad design decision, and I'm quite sure global environment variables are not a good idea in the context of smallweb. Most of the time, you want to share env between a few specific apps, not all of them. And then, every apps has access to potentially sensitive information.

Copy-pasting the env variables between multiple apps is a much more secure and maintainable solution.

Admin apps no longer have write access to the .smallweb directory

In the previous of smallweb, admin apps had access to the .smallweb directory, which is where the config.json file is stored. It meant that an admin app had the ability to update the configuration of the whole smallweb instance.

It had multiple drawbacks:

  • a single admin app could break the whole smallweb instance
  • an admin app was able to give admin permissions to any other app
  • an admin app could add its own ssh keys to the authorized_keys file

All of those issues are now prevented.