Skip to content

Commit

Permalink
Merge develop to main (#13)
Browse files Browse the repository at this point in the history
* Don't try to load alsa state if the file doesn't exist

Improvement some of the REST api endpoints

* Update to get google cloud instance name on audio servers

* Update to get azure cloud instance name on audio servers

* Adding --broadcast 1024 to all jacktrip server instances

Updated copyrights for JackTrip Labs

* Refactoring code

* Incorporating github actions

* Fixed a few bugs in device agent code caused by last refactor

* Removing jack-plumbing, jacktrip-receive and jacktrip-send services. (#3)

* Removing jack-plumbing, jacktrip-receive and jacktrip-send services.
All jacktrip audio will now always passed through SuperCollider,
regardless of server size.

Using scsynth instead of supernova, for the time being. Still
testing and comparing..

* Use supernova for < 50 logical cores, and scsynth for more.
supernova generally consumes more resources but handles larger
scale mixes at lower core/musician counts. scsynth consumes fewer
resources and generally works better for simple mixes (up to 480+).

* A few more supercollider parameter tweaks

* Changing server port (#6)

* Changing server port

* Less boring

* Adding some basic tests (#5)

* Fixing test failure (#8)

* Bump wire buffer limit for supercollider, and always use scsynth (#12)

* Bump wire buffer limit for supercollider, and always use scsynth
since it works better with the new sc mixer code.

* Remove supercollider -T parameter since it doesn't work for scsynth

Co-authored-by: nwang92 <nwang92@gmail.com>
Co-authored-by: Nelson Wang <nwang92@users.noreply.github.com>
  • Loading branch information
3 people committed Sep 4, 2021
1 parent 63960d6 commit bcd5d2d
Show file tree
Hide file tree
Showing 20 changed files with 1,755 additions and 1,045 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Agent CI

on:
push:
pull_request:
branches:
- develop
- main

jobs:
build:
name: Verify code
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup golang
uses: actions/setup-go@v2
with:
go-version: 1.16.x
- name: Scan hardcoded secrets
uses: max/secret-scan@master
with:
exclude_path: '.github/workflows/secret-scan-denylist.txt'
- name: Format and lint
run: |
go env -w GOFLAGS=-mod=mod
go get -u golang.org/x/lint/golint
make fmt
make lint
- name: Small tests
run: |
go env -w GOFLAGS=-mod=mod
go get gotest.tools/gotestsum
make small-tests
- name: Report
uses: mikepenz/action-junit-report@v2
with:
check_name: Small tests
report_paths: 'artifacts/results-small.xml'
- name: Build
run: make agent-amd64
3 changes: 3 additions & 0 deletions .github/workflows/secret-scan-denylist.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
go.sum
cmd/credentials.go
pkg/client/devices_test.go
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
jacktrip-agent
jacktrip-agent-amd64
jacktrip-agent-arm
jacktrip-agent-arm
artifacts/
5 changes: 5 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,8 @@ fmt:

lint:
@golint ./...

small-tests:
@go clean -testcache
@mkdir -p artifacts
@gotestsum -f standard-verbose --junitfile artifacts/results-small.xml -- -coverprofile=artifacts/coverage.out -tags=unit ./...
57 changes: 57 additions & 0 deletions cmd/credentials.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// Copyright 2020-2021 JackTrip Labs, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package main

import (
"bytes"
"fmt"
"io/ioutil"
"math/rand"
"time"

"github.com/jacktrip/jacktrip-agent/pkg/client"
)

const (
// SecretBytes are used to generate random secret strings
SecretBytes = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
)

func init() {
// seed random number generator for secret generation
rand.Seed(time.Now().UnixNano())
}

// getCredentials retrieves jacktrip agent credentials from system config file.
// If config does not exist, it will generate and save new credentials to config file.
func getCredentials() client.AgentCredentials {

rawBytes, err := ioutil.ReadFile(fmt.Sprintf("%s/credentials", AgentConfigDir))
if err != nil {
log.Error(err, "Failed to read credentials")
panic(err)
}

splits := bytes.Split(bytes.TrimSpace(rawBytes), []byte("."))
if len(splits) != 2 || len(splits[0]) < 1 || len(splits[1]) < 1 {
log.Error(err, "Failed to parse credentials")
panic(err)
}

return client.AgentCredentials{
APIPrefix: string(splits[0]),
APISecret: string(splits[1]),
}
}
Loading

0 comments on commit bcd5d2d

Please sign in to comment.