1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
package main
import (
"fmt"
"os"
_ "modernc.org/sqlite"
)
func main() {
if len(os.Args) < 2 {
printUsage()
os.Exit(1)
}
var err error
switch os.Args[1] {
case "pack":
err = cmdPack(os.Args[2:])
case "start":
err = cmdStart(os.Args[2:])
case "stop":
err = cmdStop(os.Args[2:])
case "run":
err = cmdRun(os.Args[2:])
case "hello":
err = cmdHello(os.Args[2:])
case "info":
err = cmdInfo(os.Args[2:])
case "config":
err = cmdConfig(os.Args[2:])
case "export":
err = cmdExport(os.Args[2:])
case "fs-serve":
err = cmdFSServe(os.Args[2:])
case "serve-ask":
err = cmdServeAsk(os.Args[2:])
case "-h", "--help", "help":
printUsage()
default:
fmt.Fprintf(os.Stderr, "hosty: unknown subcommand %q\n\n", os.Args[1])
printUsage()
os.Exit(1)
}
if err != nil {
fmt.Fprintf(os.Stderr, "hosty %s: %v\n", os.Args[1], err)
os.Exit(1)
}
}
func printUsage() {
fmt.Print(`hosty — self-contained self-hosted web services distributed as SQLite databases.
Each .hosty file is a SQLite database containing the app's code (as a
compressed SQLite image) and all its data in one place. Drag it to a new
machine, run it, done.
To get started with the built-in example app:
hosty pack -name hosty-hello -version 0.1 \
-map $(which hosty):usr/bin/hosty \
-ExecStart "/usr/bin/hosty hello run-v1" \
-config "GREETING:Greeting message:optional,default=Hello from hosty!"
hosty start -file hosty-hello.hosty
curl http://localhost:$(hosty info -name hosty-hello | grep port | awk '{print $2}')/
Usage: hosty <subcommand> [options]
Subcommands:
pack Build a .hosty file from binaries and config declarations
start Install and start a hosty service under the user systemd daemon
stop Stop and uninstall a hosty service
run Start a hosty service, tail its logs, and clean up on exit
info Show installed hosty apps (all, or detail for one with -name)
config View and set app configuration values
export Export a portable .hosty file from installed app state
hello Example hosty app with guided walkthrough and DB migration demo
fs-serve Mount the _hosty_fs FUSE filesystem (used by companion unit)
serve-ask On-demand TLS permission endpoint for Caddy (used by the reverse proxy)
Run 'hosty <subcommand> -h' for subcommand help.
`)
}
|