Skip to content
This repository has been archived by the owner on Dec 2, 2023. It is now read-only.

fix dir and scripts #564

Merged
merged 6 commits into from
Jun 20, 2021
Merged
Show file tree
Hide file tree
Changes from 5 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
20 changes: 11 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,23 @@ GO_COVERPKGS:=$(shell echo $(GO_TESTPKGS) | paste -s -d ',')
TEST_UID:=$(shell id -u)
TEST_GID:=$(shell id -g)

all: build

clean:
rm -rf bin
all: core app

go_deps:
go mod download

build: go_deps
go build -o bin/app-biz $(GO_LDFLAGS) apps/biz/main.go
core: go_deps
go build -o bin/islb $(GO_LDFLAGS) cmd/islb/main.go
go build -o bin/sfu $(GO_LDFLAGS) cmd/sfu/main.go
go build -o bin/avp $(GO_LDFLAGS) cmd/avp/main.go
go build -o bin/signal $(GO_LDFLAGS) cmd/signal/main.go

app:
go build -o bin/app-biz $(GO_LDFLAGS) apps/biz/main.go

clean:
rm -rf bin

start-bin:

start-services:
Expand All @@ -42,14 +44,14 @@ proto-gen-from-docker:
docker build -t go-protoc ./proto
docker run -v $(CURDIR):/workspace go-protoc proto

proto: proto_ion proto_biz
proto: proto_core proto_app

proto_ion:
proto_core:
protoc proto/ion/ion.proto --go_opt=module=github.com/pion/ion --go_out=. --go-grpc_opt=module=github.com/pion/ion --go-grpc_out=.
protoc proto/debug/debug.proto --experimental_allow_proto3_optional --go_opt=module=github.com/pion/ion --go_out=. --go-grpc_opt=module=github.com/pion/ion --go-grpc_out=.
protoc proto/sfu/sfu.proto --go_opt=module=github.com/pion/ion --go_out=. --go-grpc_opt=module=github.com/pion/ion --go-grpc_out=.
protoc proto/islb/islb.proto --go_opt=module=github.com/pion/ion --go_out=. --go-grpc_opt=module=github.com/pion/ion --go-grpc_out=.
protoc proto/rtc/rtc.proto --go_opt=module=github.com/pion/ion --go_out=. --go-grpc_opt=module=github.com/pion/ion --go-grpc_out=.

proto_biz:
proto_app:
protoc apps/biz/proto/biz.proto --go_opt=module=github.com/pion/ion --go_out=. --go-grpc_opt=module=github.com/pion/ion --go-grpc_out=.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion configs/sig.toml → configs/signal.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ key_type = "HMAC" # this selects the Signing method https://godoc.org/github.co
key = "1q2dGu5pzikcrECJgW3ADfXX3EsmoD99SYvSVCpDsJrAqxou5tUNbHPvkEFI4bTS"

[signal.svc]
services = ["sfu","biz","avp"]
services = ["sfu","biz","avp"]
18 changes: 9 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,28 @@ services:
networks:
- ionnet

sig:
image: pionwebrtc/ion:latest-sig
signal:
image: pionwebrtc/ion:latest-signal
build:
dockerfile: ./docker/sig.Dockerfile
dockerfile: ./docker/signal.Dockerfile
context: .
volumes:
- "./configs/docker/sig.toml:/configs/sig.toml"
- "./configs/docker/signal.toml:/configs/signal.toml"
ports:
- 5551:5551
depends_on:
- islb
- biz
- app-biz
networks:
- ionnet

biz:
image: pionwebrtc/ion:latest-biz
app-biz:
image: pionwebrtc/ion:latest-app-biz
build:
dockerfile: ./docker/biz.Dockerfile
dockerfile: ./docker/app-biz.Dockerfile
context: .
volumes:
- "./configs/docker/biz.toml:/configs/biz.toml"
- "./configs/docker/app-biz.toml:/configs/app-biz.toml"
depends_on:
- nats
- islb
Expand Down
12 changes: 6 additions & 6 deletions docker/biz.Dockerfile → docker/app-biz.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ RUN cd $GOPATH/src/github.com/pion/ion && go mod download

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
COPY apps $GOPATH/src/github.com/pion/ion/apps

WORKDIR $GOPATH/src/github.com/pion/ion/apps/biz
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /biz .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /app-biz .

FROM alpine:3.12.1

RUN apk --no-cache add ca-certificates
COPY --from=0 /biz /usr/local/bin/biz
COPY --from=0 /app-biz /usr/local/bin/app-biz

COPY configs/docker/biz.toml /configs/biz.toml
COPY configs/docker/app-biz.toml /configs/app-biz.toml

ENTRYPOINT ["/usr/local/bin/biz"]
CMD ["-c", "/configs/biz.toml"]
ENTRYPOINT ["/usr/local/bin/app-biz"]
CMD ["-c", "/configs/app-biz.toml"]
10 changes: 5 additions & 5 deletions docker/sig.Dockerfile → docker/signal.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ COPY cmd/ $GOPATH/src/github.com/pion/ion/cmd
COPY proto/ $GOPATH/src/github.com/pion/ion/proto

WORKDIR $GOPATH/src/github.com/pion/ion/cmd/signal
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /sig .
RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o /signal .

FROM alpine:3.12.1

RUN apk --no-cache add ca-certificates
COPY --from=0 /sig /usr/local/bin/sig
COPY --from=0 /signal /usr/local/bin/signal

COPY configs/docker/sig.toml /configs/sig.toml
COPY configs/docker/signal.toml /configs/signal.toml

ENTRYPOINT ["/usr/local/bin/sig"]
CMD ["-c", "/configs/sig.toml"]
ENTRYPOINT ["/usr/local/bin/signal"]
CMD ["-c", "/configs/signal.toml"]
12 changes: 9 additions & 3 deletions scripts/all
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ function start()
echo "------------islb--------------"
$APP_DIR/scripts/service start islb

echo "------------biz--------------"
$APP_DIR/scripts/service start biz
echo "------------signal--------------"
$APP_DIR/scripts/service start signal

echo "------------app-biz--------------"
$APP_DIR/scripts/service start app-biz

echo "------------sfu--------------"
$APP_DIR/scripts/service start sfu
Expand All @@ -44,7 +47,10 @@ function start()
function stop()
{
echo "------------biz--------------"
$APP_DIR/scripts/service stop biz
$APP_DIR/scripts/service stop app-biz

echo "------------signal--------------"
$APP_DIR/scripts/service stop signal

echo "------------islb--------------"
$APP_DIR/scripts/service stop islb
Expand Down
10 changes: 7 additions & 3 deletions scripts/service
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ SERVICE=$2
show_help()
{
echo ""
echo "Usage: ./service {start|stop} {biz|islb|sfu|avp}"
echo "Usage: ./service {start|stop} {app-biz|signal|islb|sfu|avp}"
echo ""
}

Expand Down Expand Up @@ -44,7 +44,11 @@ function start()
exit 1;
fi

cd $APP_DIR/cmd/$SERVICE
BUILD_PATH=$APP_DIR/cmd/$SERVICE
if [[ "$SERVICE" =~ app-* ]]; then
BUILD_PATH=$APP_DIR/apps/$SERVICE
fi
cd $BUILD_PATH
echo "go build -o $COMMAND"
go build -o $COMMAND
cd $APP_DIR
Expand Down Expand Up @@ -89,7 +93,7 @@ if [[ "$ACTION" != "start" && "$ACTION" != "stop" ]]; then
exit 1
fi

if [[ "$SERVICE" != "biz" && "$SERVICE" != "islb" && "$SERVICE" != "sfu" && "$SERVICE" != "avp" ]]; then
if [[ "$SERVICE" != "app-biz" && "$SERVICE" != "signal" && "$SERVICE" != "islb" && "$SERVICE" != "sfu" && "$SERVICE" != "avp" ]]; then
show_help
exit 1
fi
Expand Down