Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
gempir committed Feb 17, 2024
2 parents e70eab0 + f26615a commit 7b3040c
Show file tree
Hide file tree
Showing 36 changed files with 2,404 additions and 207 deletions.
3 changes: 2 additions & 1 deletion .env.development
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ TWITCH_USERNAME="gempbot"
DSN="postgresql://postgres:postgres@localhost:5432"
LISTEN_ADDRESS="127.0.0.1:3010"
LOG_LEVEL=debug
YPERSISTENCE=./dbdir
YSWEET_TOKEN=AAAgT07jyfGLORBpu8Oj0XmtJmbT7KAeWBRZ3Y75d1T4u1A
YSWEET_URL=http://127.0.0.1:8070
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
fetch-depth: 2
- uses: actions/setup-go@v2
with:
go-version: '1.19'
go-version: '1.21'
- name: Run coverage
run: go test -race -coverprofile=coverage.out -covermode=atomic ./internal/...
- name: Upload coverage to Codecov
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ web/dbdir

# Binaries
/main
/gempbot
/gempbot
/internal/ysweet/createToken.cjs
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ export $(shell sed 's/=.*//' .env)
build_server:
go run main.go

ysweet:
cd web && yarn ysweet-dev

test:
go test ./internal/...

Expand Down
3 changes: 2 additions & 1 deletion ansible/group_vars/main/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ prometheus_postgres_dbname: gempbot

node_exporter_arch: arm64

caddy_config: "{{ lookup('template', 'templates/Caddyfile.j2') }}"
caddy_config: "{{ lookup('template', 'templates/Caddyfile.j2') }}"

57 changes: 32 additions & 25 deletions ansible/group_vars/main/vault.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
!vault |
$ANSIBLE_VAULT;1.1;AES256
30396437386261623238663531386332306534393265373831336261386131653863366435346563
3965646436366334316165383436303337633537356364610a343632303462313133383266346331
34376265356132376238633037636438663861303134656631323637396330623738393133656433
3434313761616133630a313736613262633831613561383932373134393932663132666434663437
61333230373934653461633366666335303633303736633962646138336239666166663964656534
63323539356237663033653738313035386139373133653864663438326234383339646161396430
35376332303535306634316638333166343462643261333264616431383936303730643636626434
62613634313532663638613338366631623664393131346632383733366432663035666630393962
32356538656366623834316634663337333734633835623133656561656665653331383866323333
62396363613030656161653561303830636565353537613162646434646330653762386163323565
32383964376639353436653738386535643334353832306638666433653232653262623861393965
66316466316165633130633030396239333135343931626666623037386633303330383130626532
65326338363063393239333964313839636663646363333732346235623365386566386163663536
38323065643531313236383836313333393333303139313564343939323637316362343763326363
31636532316337316466643937343263616564313830313134376163383462303137663439313232
63316130656639306130366135653936643165313764366262356632393239613035663161356232
32663762373937623363306362306633313635336166633738613364663133623230333837646464
63646234643338393634336239363631333734313263633063333830333433653862336365643030
35623131646163343535646165333862373038326436643465653737303463623363643262363466
34313439333337393434616630363433363264336361663965633331303930313366313534356665
66316137653330366365373438633134343562356130613163373238353765663264656638653666
36373464613963333537643838643638356164626636326531323632306239343364393464633934
63306332303537666666643134626431396138376632393833626465333235373734303762353365
33313763383263343533303033326362643739396364323631393232303030333465633334303437
6364
36626431346235646636343736386135333866333939363231353865643432303465656238376137
3366393065613332313837366138303136346536313133390a353439343664626337666239366564
63333533663564376165653932363130643535613038643637653166623461363238356262653365
6538316237326361650a386461613132323530666339343537613731363865663662666238656362
38373535616461643134356231313935636630633730333531376364303832653364306432333438
62316432366462333330363738366630386366353233326563663333336237633963373933623630
33623738336530393934376130396633346666663638346437663334313335343437393235633833
66653462383936333137336636313335336331636330623336666661346335343461303265343332
39623732656138313836306133343938343039643535346263333562366262633839633664373866
34393932643037653131623638613334616462663662386139383964386335356535306638346266
61313539646261653731613561373430383862643434373932393337353431373230343439643863
36376335313635643865663634623737333134653235326161366465633564306339313732653330
61363561636465633438353531343262663237633065333836376435376466306434336262396337
38616632326265623439323161313435666332613534356234663133316361393637373465666662
34353436316563656439386436666461326530633864636138636130376535326132343163376639
65373266326138346637393935623137626436616363323363386463643763316638613739626435
34326537343561653534386438363831363165616161303464623561366233353236316537663633
31613063663430323636313162626466373166356562633463613761306131343030303865313136
31353637666666353733333561383666376466393563363962623934373033663734383264323234
62306464626566633463613862333437613762633238636336626638336430643530373164643036
63333461383364346537383834353534306632653832663163636438306431396535666364313434
37303261303232386664353534393165316638356261343939386338393234376261383031653233
39663563623563383763373065663132383437376661613236313566643835633638633461363338
61313033366137303163313364323234626534333262373834343439316264326464376462613866
61333434326264396164336339313130616439303336636633626433623561343366643735626130
37333538666136653832386263643930646162653635616134353836636231373661636236643935
30653866366238366534643161613130363030386435656339373033316432633833373662386661
32333938396466666338366337656437346633616332653238616163663630663735613733616532
39313366636433396632643665303132623934633839373838306534643531393336313038343139
39643631303436663330663231633332643839323939323430623833666665643637303832383365
63623963376332393761663535653434353637353233343930623666333833373630346636646635
66396239663237306237
2 changes: 1 addition & 1 deletion ansible/roles/caddy/templates/Caddyfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
}

{{ yjs_host }} {
reverse_proxy 127.0.0.1:1234
reverse_proxy 127.0.0.1:8070
}

{{ grafana_host }} {
Expand Down
11 changes: 11 additions & 0 deletions ansible/roles/gempbot/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
src: templates/service.j2
dest: /etc/systemd/system/gempbot.service

- name: Install Yjs Service
template:
src: templates/service-yjs.j2
dest: /etc/systemd/system/gempbot-yjs.service

- name: Install Migrate Service
template:
src: templates/migrate.j2
Expand All @@ -45,3 +50,9 @@
daemon_reload: true
name: gempbot
enabled: true

- name: ensure yjs service is enabled
systemd:
daemon_reload: true
name: gempbot-yjs
enabled: true
2 changes: 2 additions & 0 deletions ansible/roles/gempbot/templates/env.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ TWITCH_OAUTH={{ botOauth }}
SECRET={{ apiSecret }}
TWITCH_CLIENT_SECRET={{ twitchSecret }}
DSN={{ dsn }}
YSWEET_URL=https://{{ yjs_host }}
YSWEET_TOKEN={{ ysweet_bearer }}
14 changes: 14 additions & 0 deletions ansible/roles/gempbot/templates/service-yjs.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=gempbot-yjs
After=network.target
StartLimitBurst=10

[Service]
Restart=always
RestartSec=5
ExecStart=/home/gempbot/y-sweet/crates/target/release/y-sweet serve --port 8070 --host 127.0.0.1 --auth {{ ysweet_authb64 }} --prod /home/gempbot/yjs_db
WorkingDirectory=/home/gempbot/web
Environment=NODE_ENV=production

[Install]
WantedBy=multi-user.target
16 changes: 4 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/gempir/gempbot

go 1.18
go 1.21

require (
github.com/carlmjohnson/requests v0.23.5
Expand All @@ -9,7 +9,6 @@ require (
github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.1
github.com/nicklaw5/helix/v2 v2.26.0
github.com/puzpuzpuz/xsync v1.5.2
github.com/rs/cors v1.10.1
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.8.4
Expand All @@ -18,25 +17,18 @@ require (
gorm.io/gorm v1.25.7
)

replace github.com/nicklaw5/helix/v2 v2.12.0 => github.com/gempir/helix/v2 v2.0.2-0.20221223221449-fe5671ac8ea7

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/jackc/chunkreader/v2 v2.0.1 // indirect
github.com/jackc/pgconn v1.14.1 // indirect
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.3.2 // indirect
github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect
github.com/jackc/pgtype v1.14.2 // indirect
github.com/jackc/pgx/v4 v4.18.1 // indirect
github.com/jackc/pgx/v5 v5.4.3 // indirect
github.com/jackc/pgx/v5 v5.5.3 // indirect
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/jellydator/ttlcache/v2 v2.11.1
github.com/jinzhu/inflection v1.0.0 // indirect
github.com/jinzhu/now v1.1.5 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sync v0.6.0 // indirect
Expand Down
Loading

0 comments on commit 7b3040c

Please sign in to comment.