diff --git a/.github/workflows/docker-app-room.yaml b/.github/workflows/docker-app-room.yaml index 1479ec76c..caba6f600 100644 --- a/.github/workflows/docker-app-room.yaml +++ b/.github/workflows/docker-app-room.yaml @@ -17,10 +17,9 @@ jobs: - uses: actions/checkout@v2 - name: build - run: docker build --tag pionwebrtc/ion:latest-app-room -f docker/app-room.Dockerfile . + run: docker build --no-cache --tag pionwebrtc/ion:latest-app-room -f docker/app-room.Dockerfile . - name: login - if: github.event_name == 'release' run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin - name: tag @@ -32,3 +31,8 @@ jobs: - name: push if: github.event_name == 'release' run: docker push pionwebrtc/ion:"$TAG"-app-room + env: + TAG: ${{ github.event.release.tag_name }} + + - name: push-master + run: docker push pionwebrtc/ion:latest-app-room diff --git a/.github/workflows/docker-islb.yaml b/.github/workflows/docker-islb.yaml index 60fee89ab..510e4aafd 100644 --- a/.github/workflows/docker-islb.yaml +++ b/.github/workflows/docker-islb.yaml @@ -17,10 +17,9 @@ jobs: - uses: actions/checkout@v2 - name: build - run: docker build --tag pionwebrtc/ion:latest-islb -f docker/islb.Dockerfile . + run: docker build --no-cache --tag pionwebrtc/ion:latest-islb -f docker/islb.Dockerfile . - name: login - if: github.event_name == 'release' run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin - name: tag @@ -32,3 +31,8 @@ jobs: - name: push if: github.event_name == 'release' run: docker push pionwebrtc/ion:"$TAG"-islb + env: + TAG: ${{ github.event.release.tag_name }} + + - name: push-master + run: docker push pionwebrtc/ion:latest-islb diff --git a/.github/workflows/docker-sfu.yaml b/.github/workflows/docker-sfu.yaml index 73f94dbca..66c037449 100644 --- a/.github/workflows/docker-sfu.yaml +++ b/.github/workflows/docker-sfu.yaml @@ -17,10 +17,9 @@ jobs: - uses: actions/checkout@v2 - name: build - run: docker build --tag pionwebrtc/ion:latest-sfu -f docker/sfu.Dockerfile . + run: docker build --no-cache --tag pionwebrtc/ion:latest-sfu -f docker/sfu.Dockerfile . - name: login - if: github.event_name == 'release' run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin - name: tag @@ -32,3 +31,8 @@ jobs: - name: push if: github.event_name == 'release' run: docker push pionwebrtc/ion:"$TAG"-sfu + env: + TAG: ${{ github.event.release.tag_name }} + + - name: push-master + run: docker push pionwebrtc/ion:latest-sfu diff --git a/.github/workflows/docker-signal.yaml b/.github/workflows/docker-signal.yaml index 1dad457a6..91d0e8190 100644 --- a/.github/workflows/docker-signal.yaml +++ b/.github/workflows/docker-signal.yaml @@ -17,10 +17,9 @@ jobs: - uses: actions/checkout@v2 - name: build - run: docker build --tag pionwebrtc/ion:latest-signal -f docker/signal.Dockerfile . + run: docker build --no-cache --tag pionwebrtc/ion:latest-signal -f docker/signal.Dockerfile . - name: login - if: github.event_name == 'release' run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin - name: tag @@ -32,3 +31,8 @@ jobs: - name: push if: github.event_name == 'release' run: docker push pionwebrtc/ion:"$TAG"-signal + env: + TAG: ${{ github.event.release.tag_name }} + + - name: push-master + run: docker push pionwebrtc/ion:latest-signal diff --git a/apps/room/server/room_service.go b/apps/room/server/room_service.go index 7fe9b29fb..569d172f9 100644 --- a/apps/room/server/room_service.go +++ b/apps/room/server/room_service.go @@ -321,7 +321,7 @@ func (s *RoomService) UpdatePeer(ctx context.Context, in *room.UpdatePeerRequest } // check peer exist - log.Infof("sid=%v uid======%v", sid, uid) + log.Infof("sid=%v uid=v", sid, uid) key = util.GetRedisPeerKey(sid, uid) if s.redis.HGet(key, "uid") == "" { return &room.UpdatePeerReply{ diff --git a/configs/docker/signal.toml b/configs/docker/signal.toml index 17fa29a50..369f12f12 100644 --- a/configs/docker/signal.toml +++ b/configs/docker/signal.toml @@ -23,4 +23,4 @@ key_type = "HMAC" # this selects the Signing method https://godoc.org/github.co key = "1q2dGu5pzikcrECJgW3ADfXX3EsmoD99SYvSVCpDsJrAqxou5tUNbHPvkEFI4bTS" [signal.svc] -services = ["sfu","biz","avp"] \ No newline at end of file +services = ["rtc", "room"] diff --git a/configs/signal.toml b/configs/signal.toml index 987ab1d6b..e0c36ffeb 100644 --- a/configs/signal.toml +++ b/configs/signal.toml @@ -24,4 +24,4 @@ key_type = "HMAC" key = "1q2dGu5pzikcrECJgW3ADfXX3EsmoD99SYvSVCpDsJrAqxou5tUNbHPvkEFI4bTS" [signal.svc] -services = ["rtc","biz","avp", "room"] +services = ["rtc", "room"] diff --git a/docker-compose.yml b/docker-compose.yml index 7ec11a332..4c5d7b40f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,20 +30,6 @@ services: networks: - ionnet - #avp: - # image: pionwebrtc/ion:latest-avp - # build: - # dockerfile: ./docker/avp.Dockerfile - # context: . - # volumes: - # - "./configs/docker/avp.toml:/configs/avp.toml" - # - "./out:/out/" - # depends_on: - # - nats - # - islb - # networks: - # - ionnet - signal: image: pionwebrtc/ion:latest-signal build: diff --git a/docker/app-room.Dockerfile b/docker/app-room.Dockerfile index ea900a93a..3eca99c80 100644 --- a/docker/app-room.Dockerfile +++ b/docker/app-room.Dockerfile @@ -1,25 +1,22 @@ -FROM golang:1.14.13-stretch +FROM golang:1.16-alpine as builder -ENV GO111MODULE=on +WORKDIR /ion -WORKDIR $GOPATH/src/github.com/pion/ion +COPY go.mod go.mod +COPY go.sum go.sum +RUN go mod download -COPY go.mod go.sum ./ -RUN cd $GOPATH/src/github.com/pion/ion && go mod download +COPY pkg/ pkg/ +COPY proto/ proto/ +COPY apps/ apps/ -COPY pkg/ $GOPATH/src/github.com/pion/ion/pkg -COPY proto/ $GOPATH/src/github.com/pion/ion/proto -COPY apps $GOPATH/src/github.com/pion/ion/apps +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -installsuffix cgo -o /ion/app-room ./apps/room -WORKDIR $GOPATH/src/github.com/pion/ion/apps/room -RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /app-room . +FROM alpine -FROM alpine:3.12.1 - -RUN apk --no-cache add ca-certificates -COPY --from=0 /app-room /usr/local/bin/app-room +COPY --from=builder /ion/app-room /app-room COPY configs/docker/app-room.toml /configs/app-room.toml -ENTRYPOINT ["/usr/local/bin/app-room"] +ENTRYPOINT ["/app-room"] CMD ["-c", "/configs/app-room.toml"] diff --git a/docker/islb.Dockerfile b/docker/islb.Dockerfile index 76469f6dc..b89227662 100644 --- a/docker/islb.Dockerfile +++ b/docker/islb.Dockerfile @@ -1,24 +1,22 @@ -FROM golang:1.14.13-stretch +FROM golang:1.16-alpine as builder -ENV GO111MODULE=on +WORKDIR /ion -WORKDIR $GOPATH/src/github.com/pion/ion +COPY go.mod go.mod +COPY go.sum go.sum +RUN go mod download -COPY go.mod go.sum ./ -RUN cd $GOPATH/src/github.com/pion/ion && go mod download +COPY pkg/ pkg/ +COPY proto/ proto/ +COPY cmd/ cmd/ -COPY pkg/ $GOPATH/src/github.com/pion/ion/pkg -COPY cmd/ $GOPATH/src/github.com/pion/ion/cmd -COPY proto/ $GOPATH/src/github.com/pion/ion/proto +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o /ion/islb ./cmd/islb -WORKDIR $GOPATH/src/github.com/pion/ion/cmd/islb -RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /islb . +FROM alpine -FROM alpine:3.12.1 -RUN apk --no-cache add ca-certificates -COPY --from=0 /islb /usr/local/bin/islb +COPY --from=builder /ion/islb /islb COPY configs/docker/islb.toml /configs/islb.toml -ENTRYPOINT ["/usr/local/bin/islb"] +ENTRYPOINT ["/islb"] CMD ["-c", "/configs/islb.toml"] diff --git a/docker/sfu.Dockerfile b/docker/sfu.Dockerfile index 76ddba6b8..cffe16b57 100644 --- a/docker/sfu.Dockerfile +++ b/docker/sfu.Dockerfile @@ -1,25 +1,21 @@ -FROM golang:1.14.13-stretch +FROM golang:1.16-alpine as builder -ENV GO111MODULE=on +WORKDIR /ion -WORKDIR $GOPATH/src/github.com/pion/ion +COPY go.mod go.mod +COPY go.sum go.sum -COPY go.mod go.sum ./ -RUN cd $GOPATH/src/github.com/pion/ion && go mod download +COPY pkg/ pkg/ +COPY proto/ proto/ +COPY cmd/ cmd/ -COPY pkg/ $GOPATH/src/github.com/pion/ion/pkg -COPY cmd/ $GOPATH/src/github.com/pion/ion/cmd -COPY proto/ $GOPATH/src/github.com/pion/ion/proto +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o /ion/sfu ./cmd/sfu -WORKDIR $GOPATH/src/github.com/pion/ion/cmd/sfu -RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /sfu . +FROM alpine -FROM alpine:3.12.1 - -RUN apk --no-cache add ca-certificates -COPY --from=0 /sfu /usr/local/bin/sfu +COPY --from=builder /ion/sfu /sfu COPY configs/docker/sfu.toml /configs/sfu.toml -ENTRYPOINT ["/usr/local/bin/sfu"] +ENTRYPOINT ["/sfu"] CMD ["-c", "/configs/sfu.toml"] diff --git a/docker/signal.Dockerfile b/docker/signal.Dockerfile index daeeb90c1..93f882a96 100644 --- a/docker/signal.Dockerfile +++ b/docker/signal.Dockerfile @@ -1,25 +1,22 @@ -FROM golang:1.14.13-stretch +FROM golang:1.16-alpine as builder -ENV GO111MODULE=on +WORKDIR /ion -WORKDIR $GOPATH/src/github.com/pion/ion +COPY go.mod go.mod +COPY go.sum go.sum +RUN go mod download -COPY go.mod go.sum ./ -RUN cd $GOPATH/src/github.com/pion/ion && go mod download +COPY pkg/ pkg/ +COPY proto/ proto/ +COPY cmd/ cmd/ -COPY pkg/ $GOPATH/src/github.com/pion/ion/pkg -COPY cmd/ $GOPATH/src/github.com/pion/ion/cmd -COPY proto/ $GOPATH/src/github.com/pion/ion/proto +RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GO111MODULE=on go build -a -o /ion/signal ./cmd/signal -WORKDIR $GOPATH/src/github.com/pion/ion/cmd/signal -RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /signal . +FROM alpine -FROM alpine:3.12.1 - -RUN apk --no-cache add ca-certificates -COPY --from=0 /signal /usr/local/bin/signal +COPY --from=builder /ion/signal /signal COPY configs/docker/signal.toml /configs/signal.toml -ENTRYPOINT ["/usr/local/bin/signal"] +ENTRYPOINT ["/signal"] CMD ["-c", "/configs/signal.toml"] diff --git a/pkg/node/sfu/service.go b/pkg/node/sfu/service.go index cb5584aaa..61e78be67 100644 --- a/pkg/node/sfu/service.go +++ b/pkg/node/sfu/service.go @@ -7,7 +7,7 @@ import ( "sync" "time" - "github.com/apex/log" + "github.com/pion/ion-log" "github.com/bep/debounce" ion_sfu_log "github.com/pion/ion-sfu/pkg/logger" "github.com/pion/ion-sfu/pkg/middlewares/datachannel" diff --git a/pkg/node/signal/signal.go b/pkg/node/signal/signal.go index bf54250af..7205c2ac4 100644 --- a/pkg/node/signal/signal.go +++ b/pkg/node/signal/signal.go @@ -92,8 +92,10 @@ func NewSignal(conf Config) (*Signal, error) { } func (s *Signal) Start() error { + log.Infof("s.Node.Start node=%+v", s.conf.Nats.URL) err := s.Node.Start(s.conf.Nats.URL) if err != nil { + log.Errorf("s.Node.Start error err=%+v", err) s.Close() return err } @@ -109,6 +111,7 @@ func (s *Signal) Start() error { } go func() { + log.Infof("KeepAlive node=%+v", node) err := s.Node.KeepAlive(node) if err != nil { log.Errorf("sig.Node.KeepAlive(%v) error %v", s.Node.NID, err) diff --git a/scripts/service b/scripts/service index cbf7f7e3e..d834019ee 100755 --- a/scripts/service +++ b/scripts/service @@ -16,7 +16,7 @@ SERVICE=$2 show_help() { echo "" - echo "Usage: ./service {start|stop} {app-room|signal|islb|sfu|avp}" + echo "Usage: ./service {start|stop} {app-room|signal|islb|sfu}" echo "" } @@ -93,7 +93,7 @@ if [[ "$ACTION" != "start" && "$ACTION" != "stop" ]]; then exit 1 fi -if [[ "$SERVICE" != "app-room" && "$SERVICE" != "signal" && "$SERVICE" != "islb" && "$SERVICE" != "sfu" && "$SERVICE" != "avp" ]]; then +if [[ "$SERVICE" != "app-room" && "$SERVICE" != "signal" && "$SERVICE" != "islb" && "$SERVICE" != "sfu" ]]; then show_help exit 1 fi