Skip to content

Commit 3807b67

Browse files
authored
Merge pull request #10 from Akvanvig/dev
Dev
2 parents 3ef9fb6 + 5de81e2 commit 3807b67

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2137
-2808
lines changed

.github/workflows/build.yaml

Lines changed: 0 additions & 74 deletions
This file was deleted.

.github/workflows/ci.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- 'master'
8+
- 'main'
9+
tags:
10+
- 'v*.*.*'
11+
12+
jobs:
13+
audit-project:
14+
if: startsWith(github.ref, 'refs/tags/')
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
persist-credentials: false
20+
21+
- name: Scan project
22+
uses: anchore/scan-action@v6
23+
with:
24+
path: "."
25+
build-push-image:
26+
runs-on: ubuntu-latest
27+
permissions:
28+
packages: write
29+
contents: read
30+
steps:
31+
- uses: actions/checkout@v4
32+
with:
33+
persist-credentials: false
34+
35+
- name: Set up docker buildx
36+
uses: docker/setup-buildx-action@v3
37+
38+
- name: Login to ghcr
39+
uses: docker/login-action@v3
40+
with:
41+
registry: ghcr.io
42+
username: ${{ github.actor }}
43+
password: ${{ secrets.GITHUB_TOKEN }}
44+
45+
- name: Add docker metadata
46+
id: metadata
47+
uses: docker/metadata-action@v5
48+
with:
49+
images: |
50+
ghcr.io/akvanvig/roboto-go
51+
tags: |
52+
type=ref,event=branch
53+
type=semver,pattern=v{{version}}
54+
type=semver,pattern=v{{major}}.{{minor}}
55+
type=semver,pattern=v{{major}}
56+
type=sha
57+
58+
- name: Build and push
59+
uses: docker/build-push-action@v6
60+
with:
61+
context: .
62+
file: cmd/roboto/Dockerfile
63+
platforms: 'linux/arm64,linux/amd64'
64+
push: true
65+
tags: ${{ steps.metadata.outputs.tags }}
66+
labels: ${{ steps.metadata.outputs.labels }}
67+
cache-from: type=gha
68+
cache-to: type=gha,mode=max

.gitignore

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,32 @@
1-
**/*.exe
1+
# If you prefer the allow list template instead of the deny list, see community template:
2+
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
3+
#
4+
# Binaries for programs and plugins
5+
*.exe
6+
*.exe~
7+
*.dll
8+
*.so
9+
*.dylib
10+
11+
# Test binary, built with `go test -c`
12+
*.test
13+
14+
# Output of the go coverage tool, specifically when used with LiteIDE
15+
*.out
16+
17+
# Dependency directories (remove the comment below to include it)
18+
# vendor/
19+
20+
# Go workspace file
21+
go.work
22+
go.work.sum
23+
24+
# env file
25+
.env
26+
27+
# Cache
28+
deploy/docker/plugins/*
29+
30+
# config files
31+
config_secrets.yaml
32+
config_secrets.yml

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
# Roboto Go
1+
# Roboto-Go
22

3-
## Requirements
4-
Roboto-Go needs the environment variable `CGO_ENABLED` set to `1` to build
3+
## TODO
54

6-
## Development
7-
Run Roboto-Go with the dev tag `go run -tags dev`
5+
- Fix channel weirdness with permissions
6+
- Fix channel id message (Unnown Message)
7+
- Running a clear does not update the message buttons
8+
- Improve search
9+
- Fix livestreams
810

9-
### Profiling
10-
PProf is used for profiling. It's suggested to install [https://www.graphviz.org/](https://www.graphviz.org/) to enable easy visualization.
11+
- Fix helm chart

assets/img/catjam.gif

-803 KB
Binary file not shown.

build/package/docker/Dockerfile

Lines changed: 0 additions & 42 deletions
This file was deleted.

cmd/roboto/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM golang:1.23 AS builder
2+
3+
COPY ./go.mod ./go.sum /build/
4+
COPY ./cmd /build/cmd/
5+
COPY ./internal /build/internal/
6+
WORKDIR /build
7+
8+
RUN go mod download
9+
RUN CGO_ENABLED=0 go build -o /out/roboto ./cmd/roboto
10+
11+
FROM gcr.io/distroless/static-debian12
12+
13+
COPY --from=builder /out/roboto /bot/roboto
14+
ENTRYPOINT [ "/bot/roboto" ]

cmd/roboto/main.go

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,49 @@
11
package main
22

33
import (
4-
"flag"
54
"os"
65
"os/signal"
6+
"syscall"
77

8-
// This import has to be top for init to setup logger state properly
9-
_ "github.com/Akvanvig/roboto-go/internal/_setup"
10-
// Rest of the imports
118
"github.com/Akvanvig/roboto-go/internal/bot"
9+
"github.com/Akvanvig/roboto-go/internal/command"
10+
"github.com/Akvanvig/roboto-go/internal/config"
1211
"github.com/rs/zerolog/log"
1312
)
1413

1514
func main() {
16-
// Arguments
17-
var token = flag.String("token", "", "Bot access token")
18-
flag.Parse()
15+
log.Info().Msg("Reading config...")
1916

20-
if *token == "" {
21-
log.Fatal().Msg("Token argument can not be empty")
17+
cfg, err := config.Load()
18+
if err != nil {
19+
log.Panic().Err(err).Msg("Failed to read config")
2220
}
2321

24-
// Run
22+
log.Info().Msg("Initializing bot...")
23+
24+
bot, err := bot.New(cfg)
25+
if err != nil {
26+
log.Panic().Err(err).Msg("Failed to initialize bot")
27+
}
28+
29+
cmds, r := command.New(bot)
30+
31+
log.Info().Msg("Starting bot...")
32+
2533
channel := make(chan os.Signal, 1)
26-
signal.Notify(channel, os.Interrupt)
34+
signal.Notify(channel, syscall.SIGTERM, syscall.SIGINT)
2735

28-
go bot.Start(token)
36+
err = bot.Start(cmds, r)
37+
if err != nil {
38+
log.Panic().Err(err).Msg("Failed to start bot")
39+
}
2940

30-
log.Info().Msg("Running the bot, press Ctrl+C to exit")
41+
log.Info().Msg("Bot started, press Ctrl+C to exit")
3142
<-channel
3243

44+
log.Info().Msg("Shutting down bot...")
45+
3346
bot.Stop()
47+
48+
log.Info().Msg("Finished shutting down bot")
3449
}

deploy/docker/docker-compose.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
services:
2+
bot:
3+
image: roboto:latest
4+
container_name: roboto
5+
restart: unless-stopped
6+
environment:
7+
- BOT_CONFIG_PATH=/opt/roboto/config.yaml
8+
- BOT_CONFIG_SECRETS_PATH=/opt/roboto/config_secrets.yaml
9+
volumes:
10+
- ./roboto/config.yaml:/opt/roboto/config.yaml
11+
- ./roboto/config_secrets.yaml:/opt/roboto/config_secrets.yaml
12+
networks:
13+
- streaming
14+
lavalink:
15+
image: ghcr.io/lavalink-devs/lavalink:4
16+
container_name: lavalink
17+
restart: unless-stopped
18+
environment:
19+
- _JAVA_OPTIONS=-Xmx6G
20+
- SERVER_PORT=2333
21+
- LAVALINK_SERVER_PASSWORD=supersecret
22+
volumes:
23+
- ./lavalink/application.yml:/opt/Lavalink/application.yml
24+
- ./plugins/:/opt/Lavalink/plugins/
25+
networks:
26+
- streaming
27+
expose:
28+
- 2333
29+
networks:
30+
streaming:
31+
name: lavalink_stream

0 commit comments

Comments
 (0)