Skip to content

Commit

Permalink
feat: smallweb app (#5824)
Browse files Browse the repository at this point in the history
* feat: smallweb app

* refactor: use env vars for config

* chore: bump version

* fix: change data path
  • Loading branch information
steveiliop56 authored Dec 5, 2024
1 parent 6e0b307 commit 4306e60
Show file tree
Hide file tree
Showing 5 changed files with 103 additions and 0 deletions.
20 changes: 20 additions & 0 deletions apps/smallweb/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"$schema": "../schema.json",
"name": "Smallweb",
"id": "smallweb",
"available": true,
"short_desc": "Your internet folder",
"author": "pomdtr",
"port": 8367,
"categories": ["development"],
"description": "A self-hostable personal cloud inspired by serverless platforms and cgi-bin",
"tipi_version": 1,
"version": "0.17.14",
"source": "https://github.com/pomdtr/smallweb",
"website": "https://smallweb.run",
"exposable": true,
"supported_architectures": ["arm64", "amd64"],
"form_fields": [],
"created_at": 1724134338800,
"updated_at": 1724134338800
}
3 changes: 3 additions & 0 deletions apps/smallweb/data/www/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Hello, world!

Smallweb is running!
42 changes: 42 additions & 0 deletions apps/smallweb/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
services:
smallweb:
container_name: smallweb
image: ghcr.io/pomdtr/smallweb:0.17.14
restart: unless-stopped
user: 0:0
environment:
- SMALLWEB_DOMAIN=${APP_DOMAIN}
- SMALLWEB_CUSTOM_DOMAINS=smallweb.${LOCAL_DOMAIN}=*;
volumes:
- ${APP_DATA_DIR}/data/:/smallweb
networks:
- tipi_main_network
labels:
# Main
traefik.enable: true
traefik.http.middlewares.smallweb-web-redirect.redirectscheme.scheme: https
traefik.http.services.smallweb.loadbalancer.server.port: 7777
# Web
traefik.http.routers.smallweb-insecure.rule: Host(`${APP_DOMAIN}`) || HostRegexp(`.+\.${APP_DOMAIN}`)
traefik.http.routers.smallweb-insecure.entrypoints: web
traefik.http.routers.smallweb-insecure.service: smallweb
traefik.http.routers.smallweb-insecure.middlewares: smallweb-web-redirect
# Websecure
traefik.http.routers.smallweb.rule: Host(`${APP_DOMAIN}`) || HostRegexp(`.+\.${APP_DOMAIN}`)
traefik.http.routers.smallweb.entrypoints: websecure
traefik.http.routers.smallweb.service: smallweb
traefik.http.routers.smallweb.tls.certresolver: myresolver
traefik.http.routers.smallweb.tls.domains[0].main: ${APP_DOMAIN}
traefik.http.routers.smallweb.tls.domains[0].sans: "*.${APP_DOMAIN}"
# Local domain
traefik.http.routers.smallweb-local-insecure.rule: Host(`smallweb.${LOCAL_DOMAIN}`) || HostRegexp(`.+\.smallweb\.${LOCAL_DOMAIN}`)
traefik.http.routers.smallweb-local-insecure.entrypoints: web
traefik.http.routers.smallweb-local-insecure.service: smallweb
traefik.http.routers.smallweb-local-insecure.middlewares: smallweb-web-redirect
# Local domain secure
traefik.http.routers.smallweb-local.rule: Host(`smallweb.${LOCAL_DOMAIN}`) || HostRegexp(`.+\.smallweb\.${LOCAL_DOMAIN}`)
traefik.http.routers.smallweb-local.entrypoints: websecure
traefik.http.routers.smallweb-local.service: smallweb
traefik.http.routers.smallweb-local.tls: true
# Runtipi managed
runtipi.managed: true
38 changes: 38 additions & 0 deletions apps/smallweb/metadata/description.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Smallweb - Host websites from your internet folder

> Warning ⚠️: The app needs to be accessed by local domain or domain in order to work, accessing via port will ***not*** work.
Smallweb is a lightweight web server based on [Deno](https://deno.com). It draws inspiration from both legacy specifications like [CGI](https://en.wikipedia.org/wiki/Common_Gateway_Interface), modern serverless platforms such as [Val Town](https://val.town) and static sites generators like [Blot.im](https://blot.im).

Smallweb maps domains to folders in your filesystem. For example, if you own the `pomdtr.me` domain:

- `https://www.pomdtr.me` maps to `~/smallweb/www`
- `https://example.pomdtr.me` maps to `~/smallweb/example`

Creating a new website is as simple as creating a folder and opening the corresponding URL in your browser. There's no need to configure a build step (unless you want to) or start a development server. Since servers are mapped to folders, you can manage them using standard Unix tools like `cp`, `mv`, or `rm`.

## A self-hosted personal cloud

Each incoming HTTP request is sandboxed in a single Deno subprocess by the Smallweb evaluation server. If there are no incoming requests, no resources are used, making it an ideal solution for low-traffic websites.

Smallweb does not use Docker, but it still sandboxes your code using Deno. And if you website suddenly go viral, you can move your site to Deno Deploy in one command.

## Installation

All the instructions are available in the [docs](https://docs.smallweb.run).

## Examples

All the websites on the `smallweb.run` domain are hosted using smallweb (including this one):

- <https://docs.smallweb.run>
- <https://blog.smallweb.run>
- <https://excalidraw.smallweb.run>

Since creating smallweb websites is so easy, you can even create super simple ones. For example, when I want to invite someone to the smallweb discord server, I just send him the link <https://discord.smallweb.run>, which maps to `~/smallweb/discord/main.ts` on my vps.

```ts
export default {
fetch: () => Response.redirect("https://discord.gg/BsgQK42qZe"),
};
```
Binary file added apps/smallweb/metadata/logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 4306e60

Please sign in to comment.