aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXe Iaso <me@xeiaso.net>2024-06-21 13:56:51 -0400
committerXe Iaso <me@xeiaso.net>2024-06-21 13:56:51 -0400
commitb2d9350d4373488405f46f5a3d23d041cd88bbab (patch)
tree9a73cd8123177cf6dae13b09f2a2a49035ab51e4
parentade22021415a543b64ffab3a90f9be356f5afb04 (diff)
downloadxesite-b2d9350d4373488405f46f5a3d23d041cd88bbab.tar.xz
xesite-b2d9350d4373488405f46f5a3d23d041cd88bbab.zip
Earthfile: launch /app/xesite for branding clout
Signed-off-by: Xe Iaso <me@xeiaso.net>
-rw-r--r--Earthfile2
-rw-r--r--fly/xesite/fly.dev.toml49
-rw-r--r--fly/xesite/fly.toml4
-rw-r--r--internal/lume/lume.go7
4 files changed, 59 insertions, 3 deletions
diff --git a/Earthfile b/Earthfile
index 7b60444..ebf5c24 100644
--- a/Earthfile
+++ b/Earthfile
@@ -70,7 +70,7 @@ xesite:
RUN apk add -U ca-certificates deno typst
ENV TYPST_FONT_PATHS=/app/fonts
- CMD ["./xesite"]
+ CMD ["/app/xesite"]
LABEL org.opencontainers.image.source="https://github.com/Xe/site"
diff --git a/fly/xesite/fly.dev.toml b/fly/xesite/fly.dev.toml
new file mode 100644
index 0000000..cf59549
--- /dev/null
+++ b/fly/xesite/fly.dev.toml
@@ -0,0 +1,49 @@
+# fly.toml file generated for xesite on 2023-09-27T19:39:44-04:00
+
+app = "xesite-dev"
+
+vm.cpus = 2
+vm.memory = "2GB"
+
+kill_signal = "SIGINT"
+kill_timeout = 5
+
+[mounts]
+source = "data"
+destination = "/data"
+initial_size = "4GB"
+auto_extend_size_threshold = 80
+auto_extend_size_increment = "1GB"
+auto_extend_size_limit = "10GB"
+
+#[experimental]
+#cmd = ["/bin/sleep", "infinity"]
+
+[build]
+image = "ghcr.io/xe/site/bin:earthly"
+
+[env]
+HOME = "/data"
+DATA_DIR = "/data"
+GIT_BRANCH = "main"
+SITE_URL = "https://xeiaso.net/"
+INTERNAL_API_BIND = ":80"
+
+[[services]]
+internal_port = 3000
+processes = ["app"]
+protocol = "tcp"
+
+[services.concurrency]
+hard_limit = 300
+soft_limit = 250
+type = "connections"
+
+[[services.ports]]
+force_https = true
+handlers = ["http"]
+port = 80
+
+[[services.ports]]
+handlers = ["tls", "http"]
+port = 443
diff --git a/fly/xesite/fly.toml b/fly/xesite/fly.toml
index 614d5a7..9bab818 100644
--- a/fly/xesite/fly.toml
+++ b/fly/xesite/fly.toml
@@ -1,6 +1,7 @@
# fly.toml file generated for xesite on 2023-09-27T19:39:44-04:00
app = "xesite"
+primary_region = "yyz"
vm.cpus = 2
vm.memory = "2GB"
@@ -17,13 +18,12 @@ auto_extend_size_increment = "1GB"
auto_extend_size_limit = "10GB"
[build]
-image = "ghcr.io/xe/site/bin:latest"
+image = "ghcr.io/xe/site/bin:earthly"
[env]
DATA_DIR = "/data"
GIT_BRANCH = "main"
SITE_URL = "https://xeiaso.net/"
-PATH = "/bin"
INTERNAL_API_BIND = ":80"
[[services]]
diff --git a/internal/lume/lume.go b/internal/lume/lume.go
index 64a32c8..39516d9 100644
--- a/internal/lume/lume.go
+++ b/internal/lume/lume.go
@@ -193,6 +193,13 @@ func New(ctx context.Context, o *Options) (*FS, error) {
return nil, fmt.Errorf("lume: can't pull: %w", err)
}
+ head, err := repo.Head()
+ if err != nil {
+ return nil, fmt.Errorf("lume: can't get head: %w", err)
+ }
+
+ slog.Debug("branch head", "hash", head.Hash().String(), "branchName", head.Name().Short())
+
err = wt.Checkout(&git.CheckoutOptions{
Branch: plumbing.NewBranchReferenceName(o.Branch),
})