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

feat: Make mapic stateless #221

Merged
merged 22 commits into from
Jan 28, 2023
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
eeff19b
mapic: Remove all business logic related to etcd
victorges Nov 13, 2022
34b7582
mapic: Fix remaining warnings
victorges Nov 13, 2022
3478825
mapic: Make getStreamInfo fetch API on cache miss
victorges Nov 13, 2022
611a472
mapic: Use getStreamInfo instead of map
victorges Nov 13, 2022
f7c58df
mapic: Stop deactivating streams on shutdown
victorges Nov 13, 2022
0e3379f
mapic: Avoid importing package twice
victorges Nov 13, 2022
917871d
mapic: Do one metrics collection to populate old streams
victorges Nov 13, 2022
189f63d
mapic: Delete a couple of lines just to get to less than 1000!
victorges Nov 13, 2022
bbfa7e8
mapic: Simplify the removeInfo situation
victorges Nov 13, 2022
9d51b95
mapic: Improve some lock usage
victorges Nov 14, 2022
9c78cd7
mapi: Simplify push status
victorges Nov 14, 2022
02ae71d
mapic: Skip unknown pushes
victorges Nov 14, 2022
b4cca67
mapic: Use go-api-client instead of deprecated client
victorges Dec 5, 2022
e8709e3
fix lock doc
victorges Jan 4, 2023
6b89aa9
ci: fix build path
iameli Jan 5, 2023
699ed54
Revert "build(deps): bump github.com/ethereum/go-ethereum (#241)"
victorges Jan 27, 2023
e595905
mapic: Fix nil reference from getStreamInfo
victorges Jan 27, 2023
f9cf11c
go.mod: Update go-api-client for setactive fix
victorges Jan 27, 2023
7b3e770
multisteam: Fix checks on multistream start
victorges Jan 27, 2023
ef74343
go.mod: Update go-api-client
victorges Jan 27, 2023
c93f908
mapic: Avoid sending metrics for lazy streamInfos
victorges Jan 27, 2023
73ec0a7
mapic: Avoid creating the streaminfo to delete the streaminfo
victorges Jan 27, 2023
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 .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ jobs:
uses: livepeer/action-gh-checksum-and-gpg-sign@latest
with:
artifacts-dir: releases
release-name: ${{ github.ref_type == 'tag' && github.ref_name || github.sha }}
release-name: ${{ (github.ref_type == 'tag' && github.ref_name) || github.event.pull_request.head.sha || github.sha }}
gpg-key: ${{ secrets.CI_GPG_SIGNING_KEY }}
gpg-key-passphrase: ${{ secrets.CI_GPG_SIGNING_PASSPHRASE }}

Expand All @@ -171,7 +171,7 @@ jobs:
uses: google-github-actions/upload-cloud-storage@v1
with:
path: releases
destination: "build.livepeer.live/${{ matrix.project }}/${{ (github.ref_type == 'tag' && github.ref_name) || github.sha }}"
destination: "build.livepeer.live/${{ matrix.project }}/${{ (github.ref_type == 'tag' && github.ref_name) || github.event.pull_request.head.sha || github.sha }}"
parent: false

- name: Upload branch manifest file
Expand Down
28 changes: 12 additions & 16 deletions cmd/mist-api-connector/mist-api-connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"time"

"github.com/golang/glog"
"github.com/livepeer/go-api-client"
"github.com/livepeer/livepeer-data/pkg/mistconnector"
"github.com/livepeer/stream-tester/apis/livepeer"
mistapi "github.com/livepeer/stream-tester/apis/mist"
"github.com/livepeer/stream-tester/internal/app/mistapiconnector"
"github.com/livepeer/stream-tester/internal/metrics"
Expand Down Expand Up @@ -44,18 +44,20 @@ func main() {
noMistScrapeMetrics := fs.Bool("no-mist-scrape-metrics", false, "Scrape statistics from MistServer and publish to RabbitMQ")
sendAudio := fs.String("send-audio", "record", "when should we send audio? {always|never|record}")
apiToken := fs.String("api-token", "", "Token of the Livepeer API to be used by the Mist server")
apiServer := fs.String("api-server", livepeer.ACServer, "Livepeer API server to use")
apiServer := fs.String("api-server", api.ProdServer, "Livepeer API server to use")
routePrefix := fs.String("route-prefix", "", "Prefix to be prepended to all created routes e.g. 'nyc-'")
playbackDomain := fs.String("playback-domain", "", "regex of domain to create routes for (ex: playback.livepeer.live)")
mistURL := fs.String("route-mist-url", "", "external URL of this Mist instance (used for routing) (ex: https://mist-server-0.livepeer.live)")
baseStreamName := fs.String("base-stream-name", "", "Base stream name to be used in wildcard-based routing scheme")
fEtcdEndpoints := fs.String("etcd-endpoints", "", "Comma-separated list of ETCD endpoints")
etcdCaCert := fs.String("etcd-cacert", "", "ETCD CA file name")
etcdCert := fs.String("etcd-cert", "", "ETCD client certificate file name")
etcdKey := fs.String("etcd-key", "", "ETCD client certificate key file name")
amqpUrl := fs.String("amqp-url", "", "RabbitMQ url")
ownRegion := fs.String("own-region", "", "Identifier of the region where the service is running, used for mapping external data back to current region")
_ = fs.String("config", "", "config file (optional)")
// Below are some deprecated flags.
// Keep them around for backward compatibility on deploys.
_ = fs.String("etcd-endpoints", "", "DEPRECATED")
_ = fs.String("etcd-cacert", "", "DEPRECATED")
_ = fs.String("etcd-cert", "", "DEPRECATED")
_ = fs.String("etcd-key", "", "DEPRECATED")
victorges marked this conversation as resolved.
Show resolved Hide resolved

consulPrefix := fs.String("consul-prefix", "", "DEPRECATED - use --route-prefix")
consulMistURL := fs.String("consul-mist-url", "", "DEPRECATED - use --route-mist-url")
Expand Down Expand Up @@ -92,16 +94,14 @@ func main() {
if len(mcreds) != 2 {
glog.Fatal("Mist server's credentials should be in form 'login:password'")
}
lapi := livepeer.NewLivepeer(*apiToken, *apiServer, nil)
lapi.Init()
lapi, _ := api.NewAPIClientGeolocated(api.ClientOptions{
Server: *apiServer,
AccessToken: *apiToken,
})

mapi = mistapi.NewMist(*mistHost, mcreds[0], mcreds[1], *apiToken, *mistPort)
ensureLoggedIn(mapi, *mistConnectTimeout)
metrics.InitCensus(hostName, model.Version, "mistconnector")
var etcdEndpoints []string
if len(*fEtcdEndpoints) > 0 {
etcdEndpoints = strings.Split(*fEtcdEndpoints, ",")
}

opts := mistapiconnector.MacOptions{
NodeID: hostName,
Expand All @@ -115,10 +115,6 @@ func main() {
BaseStreamName: *baseStreamName,
CheckBandwidth: false,
SendAudio: *sendAudio,
EtcdEndpoints: etcdEndpoints,
EtcdCaCert: *etcdCaCert,
EtcdCert: *etcdCert,
EtcdKey: *etcdKey,
AMQPUrl: *amqpUrl,
OwnRegion: *ownRegion,
MistStreamSource: *mistStreamSource,
Expand Down
19 changes: 9 additions & 10 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ require (
go.etcd.io/etcd/client/pkg/v3 v3.5.7
go.etcd.io/etcd/client/v3 v3.5.0-rc.0
go.opencensus.io v0.23.0
golang.org/x/net v0.0.0-20220607020251-c690dde0001d
golang.org/x/net v0.0.0-20220225172249-27dd8689420f
golang.org/x/text v0.3.7
google.golang.org/api v0.46.0
google.golang.org/grpc v1.38.0
google.golang.org/grpc v1.38.0 // indirect
)

require (
Expand All @@ -46,8 +46,8 @@ require (
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.3.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/deckarep/golang-set v1.8.0 // indirect
github.com/ethereum/go-ethereum v1.10.22 // indirect
github.com/deckarep/golang-set v1.7.1 // indirect
github.com/ethereum/go-ethereum v1.10.14 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-stack/stack v1.8.0 // indirect
Expand Down Expand Up @@ -83,7 +83,7 @@ require (
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.2.0 // indirect
github.com/stretchr/testify v1.7.2 // indirect
github.com/stretchr/testify v1.7.0 // indirect
github.com/tklauser/go-sysconf v0.3.5 // indirect
github.com/tklauser/numcpus v0.2.2 // indirect
go.etcd.io/etcd/api/v3 v3.5.0 // indirect
Expand All @@ -93,18 +93,18 @@ require (
go.uber.org/zap v1.17.0 // indirect
golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3 // indirect
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
golang.org/x/mod v0.6.0-dev.0.20211013180041-c96bc1413d57 // indirect
golang.org/x/mod v0.5.1 // indirect
golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b // indirect
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect
golang.org/x/tools v0.1.9 // indirect
golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df // indirect
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
howett.net/plist v1.0.0 // indirect
)

Expand All @@ -116,8 +116,7 @@ require (

require (
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/btcsuite/btcd v0.22.0-beta // indirect
github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/google/btree v1.0.0 // indirect
Expand Down
Loading