Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve performance #155

Merged
merged 3 commits into from
Jan 19, 2024
Merged
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
4 changes: 2 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MYSQL_DSN_RO="lbry-ro:lbry@tcp(localhost:3306)/commentron"
MYSQL_DSN_RW="lbry-rw:lbry@tcp(localhost:3306)/commentron"
MYSQL_DSN_RO="commentron-ro:commentron@tcp(localhost:3306)/commentron"
MYSQL_DSN_RW="commentron-rw:commentron@tcp(localhost:3306)/commentron"
SDK_URL="https://api.na-backend.odysee.com/api/v1/proxy"
SOCKETY_TOKEN="sockety_token" #If you want to integrate directly with sockety locally
18 changes: 9 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ on: [ push, pull_request ]

jobs:
build:
runs-on: ubuntu-20.04 # equivalent to 'dist: focal'
runs-on: ubuntu-22.04

steps:
- name: Check out code
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup Go
uses: actions/setup-go@v4
Expand All @@ -22,14 +22,14 @@ jobs:
run: |
sudo mysql -u root -proot -e 'CREATE DATABASE IF NOT EXISTS commentron;'
sudo mysql -u root -proot -e 'CREATE DATABASE IF NOT EXISTS social;'
sudo mysql -u root -proot -e "CREATE USER 'lbry-rw'@'localhost' IDENTIFIED BY 'lbry';"
sudo mysql -u root -proot -e "CREATE USER 'lbry-ro'@'localhost' IDENTIFIED BY 'lbry';"
sudo mysql -u root -proot -e "GRANT ALL ON commentron.* TO 'lbry-rw'@'localhost';"
sudo mysql -u root -proot -e "GRANT SELECT ON commentron.* TO 'lbry-ro'@'localhost';"
sudo mysql -u root -proot -e "GRANT ALL ON social.* TO 'lbry-rw'@'localhost';"
sudo mysql -u root -proot -e "CREATE USER 'commentron-rw'@'localhost' IDENTIFIED BY 'commentron';"
sudo mysql -u root -proot -e "CREATE USER 'commentron-ro'@'localhost' IDENTIFIED BY 'commentron';"
sudo mysql -u root -proot -e "GRANT ALL ON commentron.* TO 'commentron-rw'@'localhost';"
sudo mysql -u root -proot -e "GRANT SELECT ON commentron.* TO 'commentron-ro'@'localhost';"
sudo mysql -u root -proot -e "GRANT ALL ON social.* TO 'commentron-rw'@'localhost';"

- name: Cache
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
${{ runner.home }}/go/pkg/mod
Expand All @@ -56,7 +56,7 @@ jobs:
env:
GOPRIVATE: github.com/OdyseeTeam
IS_TEST: true
SDK_URL: https://api.lbry.tv/api/v1/proxy
SDK_URL: https://api.na-backend.odysee.com/api/v1/proxy
run: |
./scripts/build.sh
./scripts/lint.sh
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Comments server for Odysee.com
FROM ubuntu:20.04
FROM ubuntu:22.04
LABEL MAINTAINER="beamer"

RUN export DEBIAN_FRONTEND=noninteractive && \
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ This is the commenting system for odysee.com. The system uses a JSON RPC server.

Make sure you setup the configuration to use env files.

`MYSQL_DSN_RO="lbry-ro:lbry@tcp(localhost:3306)/commentron"`
`MYSQL_DSN_RO="commentron-ro:commentron@tcp(localhost:3306)/commentron"`

`MYSQL_DSN_RW="lbry-rw:lbry@tcp(localhost:3306)/commentron"`
`MYSQL_DSN_RW="commentron-rw:commentron@tcp(localhost:3306)/commentron"`

`SDK_URL="https://api.na-backend.odysee.com/api/v1/proxy"`

Expand Down
2 changes: 1 addition & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func init() {

var rootCmd = &cobra.Command{
Use: "commentron",
Short: "LBRY Comment Server",
Short: "Odysee Comment Server",
Long: `Accepts new and delivers existing comments`,
Args: cobra.MinimumNArgs(1),
Run: func(cmd *cobra.Command, args []string) {
Expand Down
10 changes: 5 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ version: "3.7"

services:
mysql:
image: mysql/mysql-server:5.7.31
image: percona:ps-8.0
restart: "no"
expose:
- "3306"
environment:
- MYSQL_DATABASE=commentron
- MYSQL_USER=lbry
- MYSQL_PASSWORD=lbry
- MYSQL_USER=commentron
- MYSQL_PASSWORD=commentron
- MYSQL_LOG_CONSOLE=true
volumes:
- data:/var/lib/mysql"
commentron:
image: lbry/commentron:master
image: odyseeteam/commentron:master
restart: "no"
ports:
- "5900:5900"
environment:
- MYSQL_DSN=lbry:lbry@tcp(mysql:3306)/commentron
- MYSQL_DSN=commentron:commentron@tcp(mysql:3306)/commentron
- AUTH_TOKEN=<token>
depends_on:
- mysql
Expand Down
70 changes: 37 additions & 33 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ require (
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d
github.com/caarlos0/env v3.5.0+incompatible
github.com/coreos/go-oidc v2.2.1+incompatible
github.com/fatih/color v1.15.0
github.com/fatih/color v1.16.0
github.com/fatih/structs v1.1.0
github.com/friendsofgo/errors v0.9.2
github.com/go-co-op/gocron v1.33.1
github.com/go-co-op/gocron v1.37.0
github.com/go-sql-driver/mysql v1.7.1
github.com/gorilla/mux v1.8.0
github.com/gorilla/rpc v1.2.0
github.com/gorilla/websocket v1.5.0
github.com/gorilla/mux v1.8.1
github.com/gorilla/rpc v1.2.1
github.com/gorilla/websocket v1.5.1
github.com/hbakhtiyor/strsim v0.0.0-20190107154042-4d2bbb273edf
github.com/jmoiron/sqlx v1.3.5
github.com/johntdyer/slackrus v0.0.0-20230315191314-80bc92dee4fc
Expand All @@ -27,67 +27,71 @@ require (
github.com/lbryio/ozzo-validation v3.0.3-0.20170512160344-202201e212ec+incompatible
github.com/mitchellh/mapstructure v1.5.0
github.com/pkg/profile v1.7.0
github.com/prometheus/client_golang v1.16.0
github.com/rs/cors v1.10.0
github.com/rubenv/sql-migrate v1.5.2
github.com/prometheus/client_golang v1.18.0
github.com/rs/cors v1.10.1
github.com/rubenv/sql-migrate v1.6.1
github.com/sirupsen/logrus v1.9.3
github.com/spf13/cast v1.5.1
github.com/spf13/cobra v1.7.0
github.com/spf13/viper v1.16.0
github.com/spf13/cast v1.6.0
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.8.4
github.com/stripe/stripe-go v70.15.0+incompatible
github.com/volatiletech/null/v8 v8.1.2
github.com/volatiletech/sqlboiler/v4 v4.15.0
github.com/volatiletech/strmangle v0.0.5
github.com/volatiletech/sqlboiler/v4 v4.16.0
github.com/volatiletech/strmangle v0.0.6
github.com/ybbus/jsonrpc/v2 v2.1.7
golang.org/x/sync v0.3.0
golang.org/x/sync v0.6.0
)

require (
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/felixge/fgprof v0.9.3 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
github.com/gofrs/uuid v4.2.0+incompatible // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/pprof v0.0.0-20211214055906-6f57359322fd // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/google/uuid v1.4.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/johntdyer/slack-go v0.0.0-20230314151037-c5bf334f9b6e // indirect
github.com/lbryio/types v0.0.0-20220224142228-73610f6654a6 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/pquerna/cachecontrol v0.1.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
github.com/slack-go/slack v0.12.1 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
github.com/volatiletech/inflect v0.0.1 // indirect
github.com/volatiletech/randomize v0.0.1 // indirect
go.uber.org/atomic v1.10.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/oauth2 v0.7.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/oauth2 v0.15.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.30.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/nullbio/null.v6 v6.0.0-20161116030900-40264a2e6b79 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
Expand Down
Loading