Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
*
!components
!config
!globals
!listeners
!interactions
!model
!scheduled_tasks
!task
!utils
!go.mod
!go.sum
!proto
!heimdallr
!web-dashboard
!buf.lock
!buf.yaml
!buf.gen.yaml
!generate.go
!go.work
!go.work.sum
!main.go
!package.json
!rm_commands.go
!start.sh
!Taskfile.yml
!litestream.yml
26 changes: 26 additions & 0 deletions .fly/test.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# fly.toml app configuration file generated for heimdallr-test on 2026-02-26T21:37:00+01:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'heimdallr-test'
primary_region = 'ord'

[build]

[[mounts]]
source = 'heimdallr'
destination = '/var/lib/heimdallr'

[http_service]
internal_port = 8484
force_https = true
auto_stop_machines = 'off'
auto_start_machines = true
min_machines_running = 0
processes = ['app']

[[vm]]
memory = '512mb'
cpus = 1
memory_mb = 512
7 changes: 5 additions & 2 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,16 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- uses: go-task/setup-task@v1
- uses: oven-sh/setup-bun@v2
with:
node-version: 24
- uses: actions/setup-go@v6
with:
go-version-file: go.mod

- name: Build
run: go build -v ./...
run: task build

test:
name: Test
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/fly-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# See https://fly.io/docs/app-guides/continuous-deployment-with-github-actions/

name: Fly Deploy
on:
push:
branches:
- main
jobs:
deploy:
name: Deploy app
runs-on: ubuntu-latest
concurrency: deploy-group # optional: ensure only one action runs at a time
steps:
- uses: actions/checkout@v4
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@ go.work.sum

# Heimdallr-specific files
# Heimdallr binary
heimdallr
/heimdallr
/heimdallrbot
!/heimdallr/
# Heimdallr configuration file
config.toml
# Database file
heimdallr.db
pb_data/

# Embedded frontend build output
/rpcserver/frontend/
27 changes: 22 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
# syntax=docker/dockerfile:1.20.0
FROM node:24-alpine AS frontend-builder

WORKDIR /usr/src/app
COPY web-dashboard ./
RUN npm install
RUN npm run build


FROM golang:1.26 AS builder

WORKDIR /usr/src/app

COPY go.mod go.sum ./
COPY go.work go.work.sum ./

RUN go mod download

COPY . .
COPY ./heimdallr ./heimdallr
COPY --from=frontend-builder /usr/src/app/dist ./heimdallr/rpcserver/frontend
COPY litestream.yml start.sh ./

RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -ldflags "-s -w" -o heimdallr .
RUN go mod download
RUN go generate github.com/NLLCommunity/heimdallr/...
RUN CGO_ENABLED=0 GOOS=linux \
go build -a -installsuffix cgo -ldflags "-s -w" \
-tags web -o heimdallrbot \
github.com/NLLCommunity/heimdallr

FROM alpine:3.23

Expand All @@ -21,8 +36,10 @@ VOLUME /var/lib/heimdallr
RUN apk add --no-cache ca-certificates fuse3 sqlite tini

COPY --from=litestream/litestream:0.5 /usr/local/bin/litestream /bin/litestream
COPY --from=builder /usr/src/app/heimdallr /usr/src/app/bin/heimdallr
COPY --from=builder /usr/src/app/heimdallrbot /usr/src/app/bin/heimdallr
COPY --from=builder /usr/src/app/litestream.yml /usr/src/app/start.sh ./

EXPOSE 8484

ENTRYPOINT ["/sbin/tini", "--"]
CMD ["./start.sh"]
42 changes: 42 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# https://taskfile.dev

version: "3"

env:
GOPRIVATE: github.com/myrkvi/grem
GOTOOLCHAIN: auto

tasks:
default:
desc: Build and run heimdallr
cmds:
- task: build
- task: run
run:
desc: Run heimdallr
preconditions:
- sh: test -f ./heimdallrbot{{exeExt}}
msg: "heimdallr binary not found, please run 'task build' first"
cmds:
- ./heimdallrbot{{exeExt}}
build:
desc: Build heimdallr binary
cmds:
- task: build-frontend
- task: build-backend
build-backend:
desc: Build heimdallr backend
cmds:
- go generate github.com/NLLCommunity/heimdallr/...
- >
go build -a -installsuffix cgo -ldflags "-s -w"
-tags web -o heimdallrbot{{exeExt}}
github.com/NLLCommunity/heimdallr
build-frontend:
desc: Build web dashboard and embed into rpcserver
dir: web-dashboard
cmds:
- bun install
- bun run build
- rm -rf ../heimdallr/rpcserver/frontend
- cp -rf dist ../heimdallr/rpcserver/frontend
8 changes: 8 additions & 0 deletions config.template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@ token = "INSERT_YOUR_TOKEN_HERE" # Discord bot token
[dev_mode]
enabled = true # Enable or disable developer mode
guild_id = 0 # Guild ID to use for developer mode

[web]
address = "localhost:8484" # RPC server address

[dashboard]
base_url = "http://localhost:8484" # Web dashboard URL
# In production, use a TLS-terminating reverse proxy (e.g. nginx, Caddy)
# in front of the RPC server and set base_url to an https:// URL.
58 changes: 0 additions & 58 deletions go.mod

This file was deleted.

Loading
Loading