Skip to content
This repository was archived by the owner on Nov 11, 2024. It is now read-only.

Commit 8941ba0

Browse files
author
Pengfei Qu
committed
refine the transcode service
1 parent fe48322 commit 8941ba0

27 files changed

+59
-622
lines changed

CMakeLists.txt

+5-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ if (NOT DEFINED NLIVES)
1414
set(NLIVES "1")
1515
endif()
1616

17+
if (NOT DEFINED PLATFORM)
18+
set(PLATFORM "Xeon")
19+
endif()
20+
1721
if (NOT DEFINED SCENARIO)
1822
set(SCENARIO "cdn")
1923
endif()
@@ -32,6 +36,6 @@ endforeach()
3236

3337
# legal message
3438
execute_process(COMMAND printf "\nThis script will build third party components licensed under various open source licenses into your container images. The terms under which those components may be used and distributed can be found with the license document that is provided with those components. Please familiarize yourself with those terms to ensure your distribution of those components complies with the terms of those licenses.\n\n")
35-
execute_process(COMMAND printf "\n-- Setting: SCENARIO=${SCENARIO}\n")
39+
execute_process(COMMAND printf "\n-- Setting: PLATFORM=${PLATFORM} SCENARIO=${SCENARIO}\n")
3640
execute_process(COMMAND printf "-- Setting: NVODS=${NVODS}, NLIVES=${NLIVES}\n")
3741
execute_process(COMMAND printf "-- Setting: REGISTRY=${REGISTRY}\n")

cdn-server/schedule.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
class ScheduleHandler(web.RequestHandler):
1313
@gen.coroutine
1414
def get(self):
15-
stream = self.requeist.uri.replace("/schedule/", "")
15+
stream = self.request.uri.replace("/schedule/", "")
1616

1717
# schedule producing the stream
1818
print("request received to process stream: "+stream, flush=True)
1919
producer = Producer()
20+
msg={}
2021
msg.update({
2122
"name":stream.split("/")[1],
2223
"type":stream.split("/")[0],
@@ -26,7 +27,7 @@ def get(self):
2627
"target": "file",
2728
"platform": "software"
2829
})
29-
producer.send(KAFKA_TOPIC_VODS, msg)
30+
producer.send(KAFKA_TOPIC_VODS, json.dumps(msg))
3031
producer.close()
3132

3233
# wait until file is available, return it

deployment/kubernetes/yaml/build.sh

+4-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@ DIR=$(dirname $(readlink -f "$0"))
44
NVODS="${1:-1}"
55
NLIVES="${2:-1}"
66
SCENARIO="${3:-cdn}"
7-
REGISTRY="$4"
7+
PLATFORM="${4:-Xeon}"
8+
REGISTRY="$5"
89
HOSTIP=$(ip route get 8.8.8.8 | awk '/ src /{split(substr($0,index($0," src ")),f);print f[2];exit}')
910

1011
. "${DIR}/../volume-info.sh"
11-
echo "NVODS=${NVODS} NLIVES=${NLIVES} SCENARIO=${SCENARIO}"
12+
echo "NVODS=${NVODS} NLIVES=${NLIVES} SCENARIO=${SCENARIO} PLATFORM=${PLATFORM}"
1213
for template in $(find "${DIR}" -maxdepth 1 -name "*.yaml.m4" -print); do
13-
m4 -DNVODS=${NVODS} -DNLIVES=${NLIVES} -DSCENARIO=${SCENARIO} -DHOSTIP=${HOSTIP} -DREGISTRY_PREFIX=${REGISTRY} $(env | grep _VOLUME_ | sed 's/^/-D/') -I "${DIR}" "${template}" > "${template/.m4/}"
14+
m4 -DNVODS=${NVODS} -DNLIVES=${NLIVES} -DSCENARIO=${SCENARIO} -DPLATFORM=${PLATFORM} -DHOSTIP=${HOSTIP} -DREGISTRY_PREFIX=${REGISTRY} $(env | grep _VOLUME_ | sed 's/^/-D/') -I "${DIR}" "${template}" > "${template/.m4/}"
1415
done

deployment/kubernetes/yaml/live-deploy.yaml.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ spec:
2323
enableServiceLinks: false
2424
containers:
2525
- name: live-defn(`LIDX')
26-
image: defn(`REGISTRY_PREFIX')ovc_software_transcode_service:latest
26+
image: defn(`REGISTRY_PREFIX')`ovc_transcode_'defn(`PLATFORM_SUFFIX'):latest
2727
imagePullPolicy: IfNotPresent
2828
resources:
2929
limits:

deployment/kubernetes/yaml/start.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ DIR=$(dirname $(readlink -f "$0"))
44
NVODS="${1:-1}"
55
NLIVES="${2:-1}"
66
SCENARIO="${3:-cdn}"
7-
REGISTRY="$4"
7+
PLATFORM="${4:-Xeon}"
8+
REGISTRY="$5"
89

910
# Set Bash color
1011
ECHO_PREFIX_INFO="\033[1;32;40mINFO...\033[0;0m"

deployment/kubernetes/yaml/vod-deploy.yaml.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ spec:
2020
enableServiceLinks: false
2121
containers:
2222
- name: vod
23-
image: defn(`REGISTRY_PREFIX')ovc_software_transcode_service:latest
23+
image: defn(`REGISTRY_PREFIX')`ovc_transcode_'defn(`PLATFORM_SUFFIX'):latest
2424
imagePullPolicy: IfNotPresent
2525
resources:
2626
limits:

script/build.sh

+27-17
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,34 @@ if test -z "${DIR}"; then
55
exit -1
66
fi
77

8-
REGISTRY="$4"
8+
PLATFORM="${4:-Xeon}"
9+
REGISTRY="$5"
910

10-
# build image(s) in order (to satisfy dependencies)
11-
for dep in .8 .7 .6 .5 .4 .3 .2 .1 ''; do
12-
if test -f "${DIR}/Dockerfile$dep"; then
13-
image=$(grep -m1 '#' "$DIR/Dockerfile$dep" | cut -d' ' -f2)
14-
if test -z "$dep"; then image="$IMAGE"; fi
15-
16-
if grep -q 'AS build' "${DIR}/Dockerfile$dep"; then
17-
docker build --network=host --file="${DIR}/Dockerfile$dep" --target build -t "$image:build" "$DIR" $(env | grep -E '_(proxy|REPO|VER)=' | sed 's/^/--build-arg /') --build-arg UID=$(id -u) --build-arg GID=$(id -g)
18-
fi
19-
20-
docker build --network=host --file="${DIR}/Dockerfile$dep" -t "$image:latest" "$DIR" $(env | grep -E '_(proxy|REPO|VER)=' | sed 's/^/--build-arg /') --build-arg UID=$(id -u) --build-arg GID=$(id -g)
11+
build_docker() {
12+
docker_file="$1"
13+
shift
14+
image_name="$1"
15+
shift
16+
if test -f "$docker_file.m4"; then
17+
m4 -I "$(dirname $docker_file)" "$docker_file.m4" > "$docker_file"
18+
fi
19+
(cd "$DIR"; docker build --network host --file="$docker_file" "$@" -t "$image_name" "$DIR" $(env | cut -f1 -d= | grep -E '_(proxy|REPO|VER)$' | sed 's/^/--build-arg /') --build-arg UID=$(id -u) --build-arg GID=$(id -g))
2120

22-
# if REGISTRY is specified, push image to the private registry
23-
if [ -n "$REGISTRY" ]; then
24-
docker tag "$image:latest" "$REGISTRY$image:latest"
25-
docker push "$REGISTRY$image:latest"
26-
fi
21+
# if REGISTRY is specified, push image to the private registry
22+
if [ -n "$REGISTRY" ]; then
23+
docker tag "$image_name" "$REGISTRY$image_name"
24+
docker push "$REGISTRY$image_name"
2725
fi
26+
}
27+
28+
# build image(s) in order (to satisfy dependencies)
29+
#for dep in .8 .7 .6 .5 .4 .3 .2 .1 ''; do
30+
for dep in '.5.*' '.4.*' '.3.*' '.2.*' '.1.*' '.0.*' ''; do
31+
dirs=("$DIR/$PLATFORM" "$DIR")
32+
for dockerfile in $(find "${dirs[@]}" -maxdepth 1 -name "Dockerfile$dep" -print 2>/dev/null); do
33+
echo ${dirs[@]}
34+
image=$(head -n 1 "$dockerfile" | grep '# ' | cut -d' ' -f2)
35+
if test -z "$image"; then image="$IMAGE"; fi
36+
build_docker "$dockerfile" "$image"
37+
done
2838
done

script/deployment.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
add_custom_target(start_${service} "${CMAKE_CURRENT_SOURCE_DIR}/start.sh" "${service}" "${NVODS}" "${NLIVES}" "${SCENARIO}" "${REGISTRY}")
1+
add_custom_target(start_${service} "${CMAKE_CURRENT_SOURCE_DIR}/start.sh" "${service}" "${NVODS}" "${NLIVES}" "${SCENARIO}" "${PLATFORM}" "${REGISTRY}")
22
add_custom_target(stop_${service} "${CMAKE_CURRENT_SOURCE_DIR}/stop.sh" "${service}")

script/service.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/build.sh")
2-
add_custom_target(build_${service} ALL "${CMAKE_CURRENT_SOURCE_DIR}/build.sh" "${NVODS}" "${NLIVES}" "${SCENARIO}" "${REGISTRY}")
2+
add_custom_target(build_${service} ALL "${CMAKE_CURRENT_SOURCE_DIR}/build.sh" "${NVODS}" "${NLIVES}" "${SCENARIO}" "${PLATFORM}" "${REGISTRY}")
33
endif()

xcode-server/CMakeLists.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
include("${CMAKE_SOURCE_DIR}/script/scan-all.cmake")
1+
set(service "ovc_transcode_service")
2+
include("${CMAKE_SOURCE_DIR}/script/service.cmake")
3+
add_dependencies(build_${service} build_ovc_cdn_common)

xcode-server/software/Dockerfile xcode-server/Xeon/Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
# ovc_transcode_xeon
12

23
FROM openvisualcloud/xeon-ubuntu1804-media-ffmpeg:20.7
34
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y -q --no-install-recommends python3-tornado python3-kafka python3-kazoo && rm -rf /var/lib/apt/lists/*
5+
6+
COPY --from=ovc_cdn_common /home/ /home/
47
COPY *.py /home/
58
CMD ["/home/main.py"]
69
WORKDIR /home

xcode-server/hardware/Dockerfile xcode-server/Xeone3/Dockerfile

+2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
# ovc_transcode_xeone3
12

23
FROM openvisualcloud/xeone3-ubuntu1804-media-ffmpeg:20.7
34

45
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y -q --no-install-recommends python3-tornado python3-kafka python3-kazoo && rm -rf /var/lib/apt/lists/*
56

7+
COPY --from=ovc_cdn_common /home/ /home/
68
COPY *.py /home/
79
CMD ["/home/main.py"]
810
WORKDIR /home

xcode-server/build.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash -e
2+
3+
DIR=$(dirname $(readlink -f "$0"))
4+
5+
. "${DIR}/../script/build.sh"

xcode-server/hardware/CMakeLists.txt

-2
This file was deleted.

xcode-server/hardware/abr_hls_dash.py

-124
This file was deleted.

xcode-server/hardware/build.sh

-6
This file was deleted.

xcode-server/hardware/messaging.py

-77
This file was deleted.

0 commit comments

Comments
 (0)