Bladeren bron

ng docker standard

krrish 7 jaren geleden
bovenliggende
commit
e252092cb1

+ 0 - 13
ng-docker-example/evlss/.dockerignore

@@ -1,13 +0,0 @@
-./.dapper
-./.trash-cache
-*.pyc
-*.egg-info
-*.vagrant
-.git
-.drone.yml*
-.gitignore
-.tmp
-**/.tox
-**/__pycache__
-**/node_modules
-README.md

+ 0 - 174
ng-docker-example/evlss/.drone.yml

@@ -1,174 +0,0 @@
-
-##################### functions start ###########################
-build_config: &build_config
-    privileged: true
-    image: dongcj/centos7
-    volumes:
-      - /var/run/docker.sock:/var/run/docker.sock
-
-
-    
-repo_config: &repo_config
-    image: plugins/docker
-    repo: tyn.ar3qvx.com/cdn/evlss
-    registry: tyn.ar3qvx.com
-    secrets: [ DOCKER_USERNAME, DOCKER_PASSWORD ]
-    
-
-deploy_config: &deploy_config
-    image: peloton/drone-rancher
-    repo: tyn.ar3qvx.com/cdn/evlss
-    service: cdn/evlss
-    
-
-
-##################### main start ############################### 
-pipeline:
-
-  # 1. notify
-  notify_begin_slack:
-    image: plugins/slack
-    webhook: https://hooks.slack.com/services/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
-    channel: general
-    username: drone-bot
-    template: "<{{build.link}}|Deployment #{{build.number}} started> on <http://tyn.ar3qvx.com:3000/{{repo.owner}}/{{repo.name}}/tree/{{build.branch}}|{{repo.name}}:{{build.branch}}> by: {{build.author}}"
-    when:
-      branch: [ master, staging ]
-      
-      
-
-
-##################### build start ###############################
-  # 2.1 build binary
-  build:
-    <<: *build_config
-    commands:
-      - echo "do something"
-      - sleep 30
-      - echo "build success"
-    when:
-      branch:
-        - develop
-        - master
-
-  # build_release:
-    # <<: *build_config
-    # when:
-      # event: tag
-      
-      
-
-      
-##################### build & publish docker image ##############
-  # 3. build docker images
-  build_docker_image:
-    image: plugins/docker
-    commands:
-      - make all
-
-      
-  # 4. publish images to test registry(tag: dev)
-  # drone deploy octocat/hello-world 24 staging
-  publish_develop:
-    <<: *repo_config
-    tag: 
-      - dev
-    when:
-      branch: develop
-      event:  push
-      
-  # 4. publish images to test registry
-  # drone deploy octocat/hello-world 24 staging
-  publish_latest:
-    <<: *build_config
-    tag: 
-      - latest
-      - v0.4
-    when:
-      branch: master
-      event:  push
-
-  # 4. publish image to test registry
-  # drone deploy octocat/hello-world 24 staging
-  publish_release:
-    <<: *build_config
-    tag: 
-      - "${DRONE_TAG}"
-    when:
-      event: tag
-
-
-      
-      
-################### deploy in test env ##########################
-  # 5. deploy to rancher(test env)
-  publish_to_test_env:
-    <<: *deploy_config
-    url: http://tyn.ar3qvx.com:8080
-    access_key: ${RANCHER_ACCESS_KEY_TEST}
-    secret_key: ${RANCHER_SECRET_KEY_TEST}
-    docker_image: tyn.ar3qvx.com/cdn/evlss
-    # start new container before stopping old one, default to true
-    start_first: false
-    # auto confirm service upgrade
-    confirm: true
-    timeout: 240
-    # batch size for the service upgrade
-    batch_size: 5
-
-    
-
-##################### test in test env ##########################
-  # test in rancher
-  test_stage:
-    image: dongcj/webshell
-    commands:
-      - sleep 20
-
-
-
-      
-##################### deploy to production ######################
-  # test in rancher
-  test_stage:
-    image: dongcj/webshell
-    commands:
-      - sleep 20
-
-      
-      
-      
-##################### notify start ##############################
-  notify_test_stage:
-    image: plugins/slack
-    webhook: https://hooks.slack.com/services/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
-    channel: general
-    username: drone-bot
-    when:
-      branch: [ master, staging ]
-      status: [ success ]
-    template: "<{{build.link}}|Deployment #{{build.number}} success> on <http://http://tyn.ar3qvx.com:3000/{{repo.owner}}/{{repo.name}}/tree/{{build.branch}}|{{repo.name}}:{{build.branch}}> by: {{build.author}}"
-
-
-  notify_end_slack:
-    image: plugins/slack
-    webhook: https://hooks.slack.com/services/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
-    channel: general
-    username: drone-bot
-    when:
-      branch: [ master, staging ]
-      status: [ success, failure ]
-    template: "<{{build.link}}|Deployment #{{build.number}} stop> on <http://http://tyn.ar3qvx.com:3000/{{repo.owner}}/{{repo.name}}/tree/{{build.branch}}|{{repo.name}}:{{build.branch}}> by: {{build.author}}"
-
-
-  notify_end_email:
-    image: drillster/drone-email
-    host: smtp.mxhichina.com
-    skip_verify: false
-    username: admin@dongcj.com
-    password: Dcj85509336
-    from: drone@svicloud.com
-    recipients: [ dongchaojun@svi-tech.com.cn, admin@svicloud.com ]
-    recipients_only: false
-    when:
-      status: [ changed, failure ]

+ 0 - 63
ng-docker-example/evlss/.gitignore

@@ -1,63 +0,0 @@
-# Byte-compiled / optimized / DLL files
-__pycache__/
-*.py[cod]
-
-
-# linux
-.*.swp
-*~
-.fuse_hidden*
-.Trash-*
-/.trash-cache
-/.dapper
-
-# PyInstaller
-#  Usually these files are written by a python script from a template
-#  before PyInstaller builds the exe, so as to inject date/other infos into it.
-*.manifest
-*.spec
-
-# Installer logs
-pip-log.txt
-pip-delete-this-directory.txt
-
-# Unit test / coverage reports
-htmlcov/
-.tox/
-.coverage
-.coverage.*
-.cache
-nosetests.xml
-coverage.xml
-*,cover
-
-
-# logs
-*.log
-
-
-# macos
-*.DS_Store
-.AppleDouble
-.LSOverride
-.DocumentRevisions-V100
-.fseventsd
-.Spotlight-V100
-.TemporaryItems
-.Trashes
-.VolumeIcon.icns
-.com.apple.timemachine.donotpresent
-._*
-
-# Windows
-Thumbs.db
-ehthumbs.db
-ehthumbs_vista.db
-Desktop.ini
-$RECYCLE.BIN/
-*.cab
-*.msi
-*.msm
-*.msp
-*.lnk
-.git/credentials

+ 0 - 7
ng-docker-example/evlss/CHANGELOG.md

@@ -1,7 +0,0 @@
-# 20171113
-  - 修改 docker/ 文件夹中只有一个 start.sh, Dockerfile 中也只需要调用 start.sh
-  - Dockerfile 中增加 tini(类似 init 主进程)
-  - Dockerfile 中变量由 ${MODULE_HOME} 修改为 ${APP_HOME}
-  - conf/ 文件夹中不再需要 tpl 后缀
-  - metadata 中支持变量如: ${APP_HOME}
-  - 文档进行相对应的更新

+ 0 - 40
ng-docker-example/evlss/Dockerfile

@@ -1,40 +0,0 @@
-# build: docker build -t <registry>/<product>/<app>:<version> .
-# push : docker push <registry>/<product>/<app>:<version>
-
-FROM tyn.ar3qvx.com/os/svi-centos7:latest
-MAINTAINER krrish krrishdo@gmail.com
-
-ENV APP_NAME="evlss" \
-    APP_HOME="/opt/wisecloud/cdn" \
-    APP_PACKAGE_URL="dist/*.tar.gz"
-# packge location can be file、http(s)、ftp...
-# file:///tmp/file.tar.gz
-# https://svicloud.s3.amazonaws.com/evlss.tar.gz
-
-
-## config and start files
-ADD docker/start.sh /usr/local/bin/
-ADD docker/conf     /usr/local/conf/
-RUN chmod a+x  /usr/local/bin/* && \
-    touch      /var/log/${APP_NAME}.log
-
-# if APP_PACKAGE_URL use http or ftp
-#RUN curl -sSL ${APP_PACKAGE_URL} | \
-#    tar zxvf - -C ${APP_HOME}
-    
-ADD $APP_PACKAGE_URL /tmp
-RUN cd /tmp/*release*/ && \
-    echo -e "yes\n" | bash setup.sh -i -n
-
-
-WORKDIR ${APP_HOME}/${APP_NAME}
-
-
-# Port to be exposed
-EXPOSE 1935 8035 13818 19850
-
-# Init
-ENTRYPOINT ["tini", "--"]
-
-# Startup
-CMD ["start.sh"]

+ 0 - 177
ng-docker-example/evlss/LICENSE

@@ -1,177 +0,0 @@
-
-                                 WiseCloud
-                        Version 3.0, November 2017
-                        http://www.svi-tech.com.cn
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS

+ 0 - 64
ng-docker-example/evlss/Makefile

@@ -1,64 +0,0 @@
-
-.PHONY : all clean build
-
-TAG:=`git describe --abbrev=0 --tags`
-
-# if TAG is empty
-ifeq ($(strip $(TAG)),)
-TAG:=`git log -1 --pretty=format:'%h'`
-endif
-
-# if TAG is empty
-ifeq ($(strip $(TAG)),)
-TAG:='noset'
-endif
-
-
-# timestamp tag
-TAG_TIME:=`git log -1 --pretty=format:'%ai'  | awk '{print $1$2}' | tr -d '\-:'`
-# if TAG is empty
-ifeq ($(strip $(TAG_TIME)),)
-TAG:='notset'
-endif
-
-REGISTRY:=tyn.ar3qvx.com
-REPO_NAME:=cdn/evlss
-REPO_TAG:=$(TAG)
-REPO_TAG_TIME:=$(TAG_TIME)
-
-all: build test docker-build docker-tag docker-test clean
-echo "IMAGE_NAME=$REPO_NAME" > ../VERSION
-echo "IMAGE_TAG=$REPO_TAG" >> ../VERSION
-echo "IMAGE_TAG_TIME=$REPO_TAG_TIME" >> ../VERSION
-
-deps:
-
-build:
-  rm -rf ./dist/*
-  
-test:
-
-validate:
-
-package:
-
-release:
-
-
-
-docker-build:
-  docker build -t $(REGISTRY)/$(NAME):$(VERSION) .
-
-docker-tag:
-  docker tag  $(REGISTRY)/$(NAME):$(VERSION) $(REGISTRY)/$(NAME):dev
-
-docker-test:
-  docker run -d --name $(TESTNAME) $(REGISTRY)/$(NAME):dev
-  
-
-  
-clean:
-  rm -rf dist
-  docker rm -f -v $(TESTNAME)
-
-

+ 0 - 35
ng-docker-example/evlss/README.md

@@ -1,35 +0,0 @@
-[![Build Status](http://69.64.34.99:8000/api/badges/cdn/evlss/status.svg)](http://69.64.34.99:8000/cdn/evlss)
-
-
-# evlss
-A microservice that does micro things.
-evlss is a `edge` service for live video
-
-
-
-
-# build
-`make`
-
-
-# running
-    /usr/local/bin/evlss -c /usr/local/etc/evlss.conf
-
-
-
-#License
-Copyright (c) 2014-2016 [svicloud, Inc.](http://www.svicloud.com)
-
-
-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.
-
-# question
-  - sometime, drone/git will `not` connect to the gogs..why?
-  - multi lb will case job run `multi` times
-  - why not
-  -- add someting
-

+ 0 - 0
ng-docker-example/evlss/VERSION


+ 0 - 10
ng-docker-example/evlss/cicd/build

@@ -1,10 +0,0 @@
-#!/bin/bash
-set -e
-
-source $(dirname $0)/version
-
-cd $(dirname $0)/..
-
-mkdir -p bin
-[ "$(uname)" != "Darwin" ] && LINKFLAGS="-linkmode external -extldflags -static -s"
-CGO_ENABLED=0 go build -ldflags "-X main.VERSION=$VERSION $LINKFLAGS" -o bin/infra-logging

+ 0 - 9
ng-docker-example/evlss/cicd/ci

@@ -1,9 +0,0 @@
-#!/bin/bash
-set -e
-
-cd $(dirname $0)
-
-./build
-./test
-./validate
-./package

+ 0 - 3
ng-docker-example/evlss/cicd/copy-latest

@@ -1,3 +0,0 @@
-#!/bin/bash
-set -e
-gsutil -m cp -r dist/artifacts/* gs://releases.rancher.com/dapper/latest

+ 0 - 4
ng-docker-example/evlss/cicd/copy-release

@@ -1,4 +0,0 @@
-#!/bin/bash
-set -e
-VERSION=$(./bin/dapper-Linux-x86_64 -v | awk '{print $3}')
-gsutil -m cp -r dist/artifacts/* gs://releases.rancher.com/dapper/${VERSION}

+ 0 - 14
ng-docker-example/evlss/cicd/docker-image

@@ -1,14 +0,0 @@
-#!/bin/bash
-set -ex
-
-cd $(dirname $0)/..
-
-if [ -x bin/dapper ]; then
-    ./scripts/build
-fi
-
-DOCKER_VERSION=$(grep -e '^FROM docker:' Dockerfile | sed 's/FROM docker://')
-
-docker build -t rancher/dapper:${DOCKER_VERSION} .
-mkdir -p dist
-echo rancher/dapper:${DOCKER_VERSION} > dist/images

+ 0 - 10
ng-docker-example/evlss/cicd/entry

@@ -1,10 +0,0 @@
-#!/bin/bash
-set -e
-
-mkdir -p dist
-if [ -e ./scripts/$1 ]; then
-    ./scripts/"$@"
-else
-    exec "$@"
-fi
-

+ 0 - 24
ng-docker-example/evlss/cicd/package

@@ -1,24 +0,0 @@
-#!/bin/bash
-set -e
-
-source $(dirname $0)/version
-
-ARCH=${ARCH:-"amd64"}
-SUFFIX=""
-[ "${ARCH}" != "amd64" ] && SUFFIX="_${ARCH}"
-
-cd $(dirname $0)/../package
-
-TAG=${TAG:-${VERSION}${SUFFIX}}
-REPO=${REPO:-rancher}
-
-if echo $TAG | grep -q dirty; then
-    TAG=dev
-fi
-
-cp ../bin/infra-logging .
-
-IMAGE=${REPO}/infra-logging:${TAG}
-docker build -t ${IMAGE} .
-echo ${IMAGE} > ../dist/images
-echo Built ${IMAGE}

+ 0 - 2
ng-docker-example/evlss/cicd/release

@@ -1,2 +0,0 @@
-#!/bin/bash
-exec $(dirname $0)/ci

+ 0 - 11
ng-docker-example/evlss/cicd/test

@@ -1,11 +0,0 @@
-#!/bin/bash
-set -e
-
-cd $(dirname $0)/..
-
-echo Running tests
-
-PACKAGES=". $(find -name '*.go' | xargs -I{} dirname {} |  cut -f2 -d/ | sort -u | grep -Ev '(^\.$|.git|.trash-cache|vendor|bin)' | sed -e 's!^!./!' -e 's!$!/...!')"
-
-[ "${ARCH}" == "amd64" ] && RACE=-race
-go test ${RACE} -cover -tags=test ${PACKAGES}

+ 0 - 20
ng-docker-example/evlss/cicd/validate

@@ -1,20 +0,0 @@
-#!/bin/bash
-set -e
-
-cd $(dirname $0)/..
-
-echo Running validation
-
-PACKAGES=". $(find -name '*.go' | xargs -I{} dirname {} |  cut -f2 -d/ | sort -u | grep -Ev '(^\.$|.git|.trash-cache|vendor|bin)' | sed -e 's!^!./!' -e 's!$!/...!')"
-
-echo Running: go vet
-go vet ${PACKAGES}
-echo Running: golint
-for i in ${PACKAGES}; do
-    if [ -n "$(golint $i | grep -v 'should have comment.*or be unexported' | tee /dev/stderr)" ]; then
-        failed=true
-    fi
-done
-test -z "$failed"
-echo Running: go fmt
-test -z "$(go fmt ${PACKAGES} | tee /dev/stderr)"

+ 0 - 21
ng-docker-example/evlss/cicd/version

@@ -1,21 +0,0 @@
-#!/bin/bash
-
-if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
-    DIRTY="-dirty"
-fi
-
-COMMIT=$(git rev-parse --short HEAD)
-GIT_TAG=$(git tag -l --contains HEAD | head -n 1)
-
-if [[ -z "$DIRTY" && -n "$GIT_TAG" ]]; then
-    VERSION=$GIT_TAG
-else
-    VERSION="${COMMIT}${DIRTY}"
-fi
-
-if [ -z "$ARCH" ]; then
-    ARCH=amd64
-fi
-
-echo "VERSION=$VERSION" >> ../VERSION
-

BIN
ng-docker-example/evlss/dist/CDN_EVLSS_Server_V01R01B17_20171212_3768_release.tar.gz


+ 0 - 161
ng-docker-example/evlss/docker/conf/evlss.conf

@@ -1,161 +0,0 @@
-# metadata => location:${APP_HOME}/${APP_NAME}_server/conf/evlss.conf
-# RTMP监听端口
-listen {{ .Env.RTMP_PORT }};
-
-# 最大连接数
-max_connections 10000;
-
-# PID文件路径,不建议修改
-pid /opt/wisecloud/cdn/evlss_server/objs/evlss.pid;
-
-# 日志文件配置,不建议修改
-srs_log_file /opt/wisecloud/cdn/evlss_server/logs/evlss.log;
-
-# 服务ID,可采用UUID,也可以采用方便识别的方式命令
-service_id evlss_xxx;
-
-# 最小GOP缓存数,一个GOP大约相当于2秒钟的数据
-# 不要设置小于1的值,不能大于max_gop_cache
-# 不建议在没有数据指导的情况下随意调整该值。
-min_gop_cache 15;
-
-# 最大GOP缓存数,不能小于min_gop_cache。
-# 不建议在没有数据指导的情况下随意调整该值。
-max_gop_cache 25;
-
-# MVLSS查询、操作接口服务配置
-http_api {
-    # 启动服务,off关闭服务
-    enabled on;
-
-    # 服务监听端口
-    listen 19850;
-
-    # 支持跨域访问
-    crossdomain on;
-}
-
-# H.265服务配置
-http_ts {
-	# 服务是否启动,默认为on,off表示关闭
-	enabled on;
-	# H.265服务监听端口,若不配置则默认为13818
-	listen  13818;
-}
-
-# HTTP服务配置
-# IVLSS和MVLSS并不面向终端用户,因此并不需要提供http-flv服务
-# 所以不需要配置这项服务,但对于EVLSS则必须配置此项服务。
-# http_api服务和http_server服务都是http服务,但是两个服务的功能不一样。
-# http_api主要用于向外提供查询操作服务,而http_server用于向终端用户提供
-# 直播拉流服务。
-http_server {
-
-    # 开启http_server服务
-    enabled on;
-
-    # 服务监听端口
-    listen 8035;
-}
-
-# vhost 配置
-# vhost可以理解为一个产品名称
-# 对于RTMP协议,通过如下方式访问:
-# rtmp://<host>:<port>/stream?app=name
-# 不带参数时host就是vhost
-vhost __defaultVhost__ {
-
-    # mode有两种模式:local 和 remote。
-    # mode 为remote时,表示当前VLSS工作在边缘模式。
-    # mode不配置时默认是local,因此,EVLSS必须明确指定mode为remote。
-    mode remote;
-
-    # LiveCDE服务器地址配置
-    # 回源拉流时必须先向LiveCDE服务器请求一个MVLSS地址
-    # host可以是域名,也可以是IP地址。
-    # 端口可选,如果不填写端口,则默认使用1935。
-    # 例如:origin 192.168.1.2:8080;
-    origin {{ .Env.LIVECDE_ADDR }};
-
-    # HTTP直播流服务配置
-    http_remux {
-
-        # 启用HTTP直播流服务,不配置时默认为off, on为启用
-        enabled on;
-
-        # 将RTMP流复用为flv流
-        # [vhost] 表示当前HTTP直播流的vhost
-        # [app] 表示当前HTTP直播流的app
-        # [stream] 表示当前HTTP直播流的stream
-        mount [vhost]/[app]/[stream].flv;
-
-        # 在没有流的情况下是否启用HTTP流触发RTMP回源拉流
-        hstrs on;
-    }
-
-    # 事件回调配置(只支持HTTP)
-    http_hooks {
-
-        # 开启事件回调功能,off为关闭, on为开启
-        enabled on;
-
-        # 对于中转服务来说,IVLSS连接成功或者EVLSS发送拉流请求
-        # 后都会触发on_connect事件回调。
-        # 在触发on_connect事件后MVLSS会向此处配置的地址发送GET请求。
-        # GET请求会带上请求端带上来的参数,接收端可以通过这些参数做AAA认证,
-        # 实现防盗链功能。
-        # 此处允许配置多个地址,以空格分隔,建议只配置一个,原因是:
-        # 每个回调事件都返回成功时MVLSS才会继续后续的逻辑处理,否则
-        # 任何一个回调返回失败,后续的流程都将受到影响,推流操作就会失败。
-        # on_connect是可选配置项,没有需求时可不配置。
-        # 例如:on_connect http://192.168.1.2:8080/connect;
-        #on_connect http://<host>:<port>/<interface>;
-        #on_connect http://127.0.0.1:12345/api/guard;
-        on_connect_direct http://134.119.221.113:8106/DataCollect/live/connect;
-
-        # 对于中转服务来说,IVLSS推流端断开连接或者EVLSS拉流端断开连接
-        # 都会触发on_close事件回调。
-        # 在触发on_close事件后MVLSS会向此处配置的地址发送GET请求
-        # 此处允许配置多个地址,以空格分隔,建议只配置一个。
-        # on_close是可选配置项,没有需求时可不配置。
-        # 例如:on_close http://192.168.1.2:8080/close;
-        #on_close http://<host>:<port>/<interface>;
-        on_close http://134.119.221.113:8106/DataCollect/live/close;
-
-        # IVLSS推流端推送一路流到中转时会触发on_publish事件回调。
-        # 在触发on_publish事件后MVLSS会向此处配置的地址发送GET请求
-        # 此处允许配置多个地址,以空格分隔,建议只配置一个。
-        # on_publish是可选配置项,没有需求时可不配置。
-        # 例如:on_publish http://192.168.1.2:8080/publish;
-        #on_publish http://<host>:<port>/<interface>;
-
-        # IVLSS推流端停止推送直播流到中转时会触发on_unpublish事件回调。
-        # 在触发on_unpublish事件后MVLSS会向此处配置的地址发送GET请求
-        # 此处允许配置多个地址,以空格分隔,建议只配置一个。
-        # on_unpublish是可选配置项,没有需求时可不配置。
-        # 例如:on_unpublish http://192.168.1.2:8080/unpublish;
-        #on_unpublish http://<host>:<port>/<interface>;
-
-        # EVLSS向MVLSS发起拉流请求时会触发on_play事件回调。
-        # 在触发on_play事件后MVLSS会向此处配置的地址发送GET请求。
-        # 此处允许配置多个地址,以空格分隔,建议只配置一个。
-        # on_play是可选配置项,没有需求时可不配置。
-        # 例如:on_play http://192.168.1.2:8080/play;
-        #on_play http://<host>:<port>/<interface>;
-
-        # EVLSS停止向MVLSS拉流时会触发on_stop事件回调。
-        # 在触发on_stop事件后MVLSS会向此处配置的地址发送GET请求。
-        # 此处允许配置多个地址,以空格分隔,建议只配置一个。
-        # on_stop是可选配置项,没有需求时可不配置。
-        # 例如:on_stop http://192.168.1.2:8080/stop;
-        #on_stop http://<host>:<port>/<interface>;
-
-        # 作为中转服务来说,EVLSS拉流过程出现卡顿时会触发on_shrink事件回调。
-        # 在触发on_shrink事件后MVLSS会向此处所配置的地址发送GET请求。
-        # 此处允许配置多个地址,以空格分隔,建议只配置一个。
-        # on_shrink是可选配置项,没有需求时可不配置。
-        # 例如:on_shrink http://192.168.1.2:8080/shrink;
-        #on_shrink http://<host>:<port>/<interface>;
-        on_shrink http://134.119.221.113:8106/DataCollect/live/Kartun;
-    }
-}

+ 0 - 137
ng-docker-example/evlss/docker/start.sh

@@ -1,137 +0,0 @@
-#!/bin/bash
-# usage: check/replace/serivce_wait/service_start
-cd $(dirname $0)
-echo
-
-# version
-if [ -f ${APP_HOME}/${APP_NAME}/VERSION ]; then
-    echo -e "Checking env for ${APP_NAME}..\n`cat ${APP_HOME}/${APP_NAME}/VERSION`"
-else
-    echo "Checking env for ${APP_NAME}.."
-fi
-
-# check dir
-if [ -d ../conf ]; then
-    cd ../conf
-else
-    echo "please put conf/ and start.sh to the same directory."
-    exit 1
-fi
-
-# get conf files
-CONF_FILES=`find $(pwd) -type f | grep -v "\.svn" | grep -v "\.git"`
-
-# if no config file exists
-if [ -z "$CONF_FILES" ]; then
-    echo "No conf files found, pass."
-fi
-
-# has config file
-for f in $CONF_FILES; do
-
-    # metadata => "<location:LOCATION_OF_FILE> [MODE:600] [OWNER:USERNAME]"
-    # if there is " " " in value, use "\"  to escape
-    # use "${APP_HOME}/${APP_NAME}" to module home
-    
-    # get the location of metadata
-    METADATA_LOCATION=$(grep -iw metadata $f | awk -F'=>' '{print $2}' | \
-                      awk -F'location:' '{print $2}' | sed -n '1p' | \
-                      awk '{print $1}' | tr -d ',;"' | tr -d "'")
-                      
-    # replace the variable to true path
-    METADATA_LOCATION=`eval echo $METADATA_LOCATION`
-    
-    # there is no location tag of metadata
-    if [ -z "$METADATA_LOCATION" ]; then
-        echo "\"location\" of metadata in \"$f\" not define!"
-        check_passed="$check_passed false"
-        continue
-    else
-        if `dirname $METADATA_LOCATION &>/dev/null`; then
-            if ! [ -d "$(dirname $METADATA_LOCATION)" ]; then
-                echo "mkdir -p $(dirname $METADATA_LOCATION)"
-                mkdir -p $(dirname $METADATA_LOCATION)
-            fi
-        else
-            echo "\"location\" of metadata in \"$f\" not PATH format!"
-            check_passed="$check_passed false"
-            continue
-        fi
-        dockerize_template="${dockerize_template} -template ${f}:${METADATA_LOCATION}"
-    fi
-    
-    # has location but no {{ VAR }}
-    VAR_IN_BRACE=$(grep {{.*}} $f | sed -n 's/.*{{ *\(.*\) *}}.*/\1/p')
-    if [ -z "$VAR_IN_BRACE" ]; then
-        echo "skip \"${f}\" without replacing, pass."
-        continue
-    
-    # has location and {{ VAR }}
-    else
-        # loop to check
-        for i in $VAR_IN_BRACE; do
-            VAR_TO_CHECK=${i##.Env.}
-            VAR_TO_CHECK=`echo $VAR_TO_CHECK`
-            
-            # Check the value
-            if [ -z "${!VAR_TO_CHECK}" ]; then
-                echo "Can not get env: \"${VAR_TO_CHECK}\" in file: \"$f\" !"
-                check_passed="$check_passed false"
-            else
-                echo "|- ${VAR_TO_CHECK}=${!VAR_TO_CHECK}"
-            fi
-        done
-    fi
-done
-
-# if error, exit
-if echo $check_passed | grep -wq "false"; then
-    echo
-    echo "To inject variables to container, you can do it in:"
-    echo "  1. Dockerfile"
-    echo "  2. compose file (recommand)"
-    echo "  3. docker run with \"-e\" option"
-    echo "And you can receive value with \"{{ .Env.VARIABLE_NAME }}\" in config file."
-    echo 
-    exit 1
-else
-    echo "Env check pass."
-    echo
-fi
-
-# get dependice
-for i in ${!APP_DEP*}; do
-    dockerize_wait="${dockerize_wait} -wait ${!i}"
-done
-
-
-# replace¡¢Serivce Wait
-echo -n "Pre-starting.."
-dockerize \
-    ${dockerize_template} \
-    ${dockerize_wait} -timeout 120s \
-    -stdout    /var/log/${APP_NAME}.log \
-    -stderr    /var/log/${APP_NAME}.log \
-    echo "done"
-echo
-
-
-# start, important
-Service_Start() {
-    echo "Starting ${APP_NAME}.."
-    
-    ####### START COMMAND HERE #########
-    set -e 
-    start_${APP_NAME} && \
-    echo "success" && \
-    tail -f /var/log/${APP_NAME}.log
-    
-    ####################################
-    
-}
-
-# default: start the service
-Service_Start
-
-
-