Skip to content

Commit

Permalink
Earthfile: launch /app/xesite for branding clout
Browse files Browse the repository at this point in the history
Signed-off-by: Xe Iaso <[email protected]>
  • Loading branch information
Xe committed Jun 21, 2024
1 parent ade2202 commit b2d9350
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Earthfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
49 changes: 49 additions & 0 deletions fly/xesite/fly.dev.toml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions fly/xesite/fly.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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]]
Expand Down
7 changes: 7 additions & 0 deletions internal/lume/lume.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
})
Expand Down

0 comments on commit b2d9350

Please sign in to comment.