diff --git a/.travis.yml b/.travis.yml index 4290ba94..aaf65b6c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,27 +1,27 @@ dist: trusty -language: minimal +language: generic sudo: required services: - docker +notifications: + webhooks: https://www.travisbuddy.com/ -script: - - docker build --build-arg VCS_REF=`git rev-parse --short HEAD` --build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` -t scoreucsc/bassa-prod-ui ui - - docker build -f ui/Dockerfile.dev --build-arg VCS_REF=`git rev-parse --short HEAD` --build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` -t scoreucsc/bassa-dev-ui ui - - docker build -f components/core/Dockerfile.prod --build-arg VCS_REF=`git rev-parse --short HEAD` --build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` -t scoreucsc/bassa-prod-server components/core - - docker build --build-arg VCS_REF=`git rev-parse --short HEAD` --build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` -t scoreucsc/bassa-dev-server components/core - - docker build --build-arg VCS_REF=`git rev-parse --short HEAD` --build-arg BUILD_DATE=`date -u +”%Y-%m-%dT%H:%M:%SZ”` -t scoreucsc/bassa-aria2c components/aria2c - - -after_success: - - if [ "$TRAVIS_BRANCH" == "develop" -a "$TRAVIS_PULL_REQUEST" == "true" ]; then - docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"; - docker push scoreucsc/bassa-prod-ui; - docker push scoreucsc/bassa-dev-ui; - docker push scoreucsc/bassa-prod-server; - docker push scoreucsc/bassa-dev-server - docker push scoreucsc/bassa-aria2c; - fi +script: + - docker build -t scoreucsc/bassa-ui:prod ui >/dev/null + - docker build -f ui/Dockerfile.dev -t scoreucsc/bassa-ui:dev ui >/dev/null + - docker build -f components/core/Dockerfile.prod -t scoreucsc/bassa-server:prod components/core >/dev/null + - docker build -t scoreucsc/bassa-server:dev components/core >/dev/null + - docker build -t scoreucsc/bassa-aria2c components/aria2c >/dev/null +deploy: + - provider: script + script: deploy.sh + on: + branch: master + - provider: script + script: deploy.sh + on: + branch: develop diff --git a/components/core/requirements.txt b/components/core/requirements.txt index ff630641..62737119 100644 --- a/components/core/requirements.txt +++ b/components/core/requirements.txt @@ -13,4 +13,5 @@ websocket-client==0.37 Werkzeug==0.11.4 SQLAlchemy==1.1.9 gunicorn==19.9.0 -minio==5.0.5 \ No newline at end of file +minio==5.0.5 +Flask==0.10.1 \ No newline at end of file diff --git a/components/core/routes/Download.py b/components/core/routes/Download.py index 756cc555..43cbaffb 100644 --- a/components/core/routes/Download.py +++ b/components/core/routes/Download.py @@ -41,7 +41,9 @@ def kill(): token = request.headers['key'] if str(token) != SERVER_SECRET_KEY: return "{'error':'not authorized'}", 403 - if p is not None: + p = None + if len(processes) != 0: + p = processes[0] p.terminate() p.join() jsonreq = json.dumps({'jsonrpc': '2.0', 'id': 'qwer', 'method': 'aria2.pauseAll'}) diff --git a/components/core/setup.py b/components/core/setup.py index 67bdc008..70c756f6 100644 --- a/components/core/setup.py +++ b/components/core/setup.py @@ -24,7 +24,11 @@ def read(file_name): install_reqs = parse_requirements(requirements_path, session=False) -requirements = [str(ir.req) for ir in install_reqs] +try: + requirements = [str(ir.req) for ir in install_reqs] +except: + requirements = [str(ir.requirement) for ir in install_reqs] + ### Set configs ### if platform.system() == 'Linux': diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 00000000..e7d04e9f --- /dev/null +++ b/deploy.sh @@ -0,0 +1,39 @@ +#! /bin/bash + +# Build production and development use docker images +# Build these images with two build args for better commit history +# shows only logs pushed to stderr +# release tag should be updated here for every release + +git_sha=$(git rev-parse --short HEAD) +build_date=$(date -u +”%Y-%m-%dT%H:%M:%SZ”) + +docker build --build-arg VCS_REF=$git_sha --build-arg BUILD_DATE=$build_date -t scoreucsc/bassa-ui:prod -t scoreucsc/bassa-ui:latest -t scoreucsc/bassa-ui:v1.0.0 ui >/dev/null +docker build -f ui/Dockerfile.dev --build-arg VCS_REF=$git_sha --build-arg BUILD_DATE=$build_date -t scoreucsc/bassa-ui:dev ui >/dev/null +docker build -f components/core/Dockerfile.prod --build-arg VCS_REF=$git_sha --build-arg BUILD_DATE=$build_date -t scoreucsc/bassa-server:prod -t scoreucsc/bassa-server:latest -t scoreucsc/bassa-server:v1.0.0 components/core >/dev/null +docker build --build-arg VCS_REF=$git_sha --build-arg BUILD_DATE=$build_date -t scoreucsc/bassa-server:dev components/core >/dev/null +docker build --build-arg VCS_REF=$git_sha --build-arg BUILD_DATE=$build_date -t scoreucsc/bassa-aria2c:latest -t scoreucsc/bassa-aria2c:v1.0.0 components/aria2c >/dev/null + +# push production docker images with tags prod, latest, release:v1.0.0 +# push development docker images with tag dev +docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD" + +# Production tag +docker push scoreucsc/bassa-ui:prod +docker push scoreucsc/bassa-server:prod + +# Latest tag +docker push scoreucsc/bassa-ui:latest +docker push scoreucsc/bassa-server:latest +docker push scoreucsc/bassa-aria2c:latest + +# v1.0.0 tag +docker push scoreucsc/bassa-ui:v1.0.0 +docker push scoreucsc/bassa-server:v1.0.0 +docker push scoreucsc/bassa-aria2c:v1.0.0 + +# Development tag +docker push scoreucsc/bassa-ui:dev +docker push scoreucsc/bassa-server:dev + + diff --git a/ui/src/app/views/admin.html b/ui/src/app/views/admin.html index 351b1f5a..9db416a3 100755 --- a/ui/src/app/views/admin.html +++ b/ui/src/app/views/admin.html @@ -42,13 +42,14 @@
# | @@ -28,6 +28,24 @@
---|
{{download.download_name}}
+{{download.download_name}}
-