summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.air.toml2
-rw-r--r--.gitignore1
-rw-r--r--Caddyfile.dev11
-rw-r--r--mise.toml17
4 files changed, 30 insertions, 1 deletions
diff --git a/.air.toml b/.air.toml
index 1d968d1..7838129 100644
--- a/.air.toml
+++ b/.air.toml
@@ -11,7 +11,7 @@ exclude_file = []
exclude_regex = []
exclude_unchanged = true
follow_symlink = true
-full_bin = "python3 -m http.server 8000 --bind 127.0.0.1"
+full_bin = "caddy run --config Caddyfile.dev"
include_dir = []
include_ext = ["css", "md", "tmpl"]
include_file = []
diff --git a/.gitignore b/.gitignore
index a8efcc6..179c23c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,7 @@
/.weft-generated.json
/.weft-txn-*
/.air/
+/images/
# BEGIN weft generated outputs
/about/index.html
/feed.xml
diff --git a/Caddyfile.dev b/Caddyfile.dev
new file mode 100644
index 0000000..958ce0d
--- /dev/null
+++ b/Caddyfile.dev
@@ -0,0 +1,11 @@
+http://localhost:8000 {
+ handle /images/* {
+ reverse_proxy https://tjp.lol {
+ header_up Host tjp.lol
+ }
+ }
+ handle {
+ root * .
+ file_server
+ }
+}
diff --git a/mise.toml b/mise.toml
index 40433a8..cee16c6 100644
--- a/mise.toml
+++ b/mise.toml
@@ -1,3 +1,6 @@
+[tools]
+caddy = "latest"
+
[tasks.gen]
run = "weft -gitignore . https://tjp.lol"
@@ -35,3 +38,17 @@ run = "jj git push -b main"
[tasks.deploy]
description = "Push the 'main' bookmark and update weft on the server"
depends = ["deploy:weft", "deploy:site"]
+
+[tasks."upload:image"]
+description = "Upload an image to the production server"
+usage = 'arg "file" "path"'
+run = '''
+set -euo pipefail
+
+fname=`basename $usage_file`
+dirpath=`dirname $usage_path`
+site_imgs=/jail/volumes/web/https/images
+
+scp $usage_file t@tjp.lol:/tmp/$fname
+ssh t@tjp.lol "doas sh -c 'mkdir -p ${site_imgs}/${dirpath} && mv /tmp/${fname} ${site_imgs}/${usage_path} && chown root:wheel ${site_imgs}/${usage_path}'"
+'''