Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ git clone https://github.com/TranscodeGroup/docker.git /home/docker
- [video-storage](./examples/video-storage/compose.yaml): RTP存储
- [video-stream](./examples/video-stream/compose.yaml): RTP视频
- [track](./examples/track/compose.yaml): Tracker V2单机部署
- etc.

### 3. 配置`.env`

Expand All @@ -38,6 +39,15 @@ docker compose config > compose-stack.yaml

### 4. 下载前端文件

#### 使用Docker自动下载

在`/home/docker-compose/compose.yaml`文件中, `include`如下服务, 即可自动下载前端

- [compose-track.yaml](./web-downloader/compose-track.yaml): 自动下载track
- [compose-bus.yaml](./web-downloader/compose-bus.yaml): 自动下载bus

#### 手动下载

部署distar等项目的前端:
[说明文件](projects/README.md)

Expand Down
2 changes: 1 addition & 1 deletion projects/teamcity-download-artifact.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh

# 默认使用名为artifacts的token, 权限较小(被设置为: `<Root project>: View build runtime parameters and data`)
# @see http://th-ci.transcodegroup.cn:9080/profile.html?item=accessTokens
Expand Down
1 change: 1 addition & 0 deletions web-downloader/.env
4 changes: 4 additions & 0 deletions web-downloader/compose.bus.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
services:
web-downloader-bus:
# Remove the profiles field to enable the service
profiles: !reset null
4 changes: 4 additions & 0 deletions web-downloader/compose.track.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
services:
web-downloader-track:
# Remove the profiles field to enable the service
profiles: !reset null
37 changes: 37 additions & 0 deletions web-downloader/compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
services:
web-downloader-base:
# All web-downloader-base/bus/track services are disabled by default
profiles: ["disabled"]
image: alpine/curl
command: /home/docker/web-downloader/web-downloader.sh
volumes:
- "${DATA_DIR:-/data}/nginx/html:/data/nginx/html"
configs:
- source: web-downloader.sh
target: /home/docker/web-downloader/web-downloader.sh
- source: teamcity-download-artifact.sh
target: /home/docker/projects/teamcity-download-artifact.sh

web-downloader-bus:
extends: web-downloader-base
environment:
# tag starts with 'v', eg: v5.30.0
- TEAMCITY_TAG=v${BUS_WEB_VERSION:?required}
- TEAMCITY_BUILD_NAME=CityBusVueAdmin_Release
- TEAMCITY_BUILD_ZIP_NAME=bus.zip
- NGINX_HTML_DIR_NAME=bus

web-downloader-track:
extends: web-downloader-base
environment:
# tag starts with 'v', eg: v1.53.0
- TEAMCITY_TAG=v${TRACK_WEB_VERSION:?required}
- TEAMCITY_BUILD_NAME=MaintainVbenAdmin_Release
- TEAMCITY_BUILD_ZIP_NAME=maintain.zip
- NGINX_HTML_DIR_NAME=track

configs:
web-downloader.sh:
file: ./web-downloader.sh
teamcity-download-artifact.sh:
file: ../projects/teamcity-download-artifact.sh
39 changes: 39 additions & 0 deletions web-downloader/web-downloader.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/sh
set -e

if [ -z "${TEAMCITY_BUILD_NAME}" ]; then
echo "Please set these environment variables:"
echo "TEAMCITY_BUILD_NAME, TEAMCITY_TAG, TEAMCITY_BUILD_ZIP_NAME, NGINX_HTML_DIR_NAME"
exit 1
fi

cd /data/nginx/html || exit 1

version_file="${NGINX_HTML_DIR_NAME}/.version-for-web-downloader"

# Check if the version already exists
if [ -f "$version_file" ]; then
current_version=$(cat "$version_file")
if [ "$current_version" = "${TEAMCITY_TAG}" ]; then
echo "Version ${TEAMCITY_TAG} already exists"
exit 0
fi
fi

# Download the new version
/home/docker/projects/teamcity-download-artifact.sh --build="${TEAMCITY_BUILD_NAME}" --tag="${TEAMCITY_TAG}"

# Unzip
unzip "${TEAMCITY_BUILD_NAME}-${TEAMCITY_TAG}.zip"
if [ -e "${NGINX_HTML_DIR_NAME}" ]; then
rm -rf "${NGINX_HTML_DIR_NAME}"
fi
unzip "${TEAMCITY_BUILD_ZIP_NAME}" -d "${NGINX_HTML_DIR_NAME}"
# Clean up
rm -f "${TEAMCITY_BUILD_ZIP_NAME}"
# rm "${TEAMCITY_BUILD_NAME}-${TEAMCITY_TAG}.zip"
echo "${TEAMCITY_TAG}" > "$version_file"

echo
echo "Downloaded version ${TEAMCITY_TAG}"
echo