From ed837c07d18be5757ae77c0806c7270e958bece8 Mon Sep 17 00:00:00 2001 From: K mehant Date: Sun, 17 May 2020 16:21:17 +0530 Subject: [PATCH 1/7] Fix travis build --- .travis.yml | 22 ++++++++++++---------- components/core/Dockerfile | 2 +- components/core/Dockerfile.prod | 2 +- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4290ba94..bd8a4387 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,22 +1,25 @@ 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 - +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 >/dev/null + - 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 >/dev/null + - 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 >/dev/null + - 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 >/dev/null + - 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 >/dev/null after_success: - - if [ "$TRAVIS_BRANCH" == "develop" -a "$TRAVIS_PULL_REQUEST" == "true" ]; then + - echo $TRAVIS_BRANCH + - echo $TRAVIS_PULL_REQUEST + - if [ "$TRAVIS_BRANCH" == "develop" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"; docker push scoreucsc/bassa-prod-ui; docker push scoreucsc/bassa-dev-ui; @@ -24,4 +27,3 @@ after_success: docker push scoreucsc/bassa-dev-server docker push scoreucsc/bassa-aria2c; fi - diff --git a/components/core/Dockerfile b/components/core/Dockerfile index 5cbdec09..8dda1ac0 100644 --- a/components/core/Dockerfile +++ b/components/core/Dockerfile @@ -19,7 +19,7 @@ RUN apt-get update && \ apt-get clean # Installing the python modules -RUN python3 setup.py develop +RUN ["/bin/bash", "-c", "python3", "setup.py", "develop"] # ----------------------------- diff --git a/components/core/Dockerfile.prod b/components/core/Dockerfile.prod index 603bd8fd..f444f614 100644 --- a/components/core/Dockerfile.prod +++ b/components/core/Dockerfile.prod @@ -19,7 +19,7 @@ RUN apt-get update && \ apt-get clean # Installing the python modules -RUN python3 setup.py develop +RUN ["/bin/bash", "-c", "python3", "setup.py", "develop"] # ----------------------------- From 4fe80ecd814f9f10f3e523b8e6927ae3f22b7da5 Mon Sep 17 00:00:00 2001 From: K mehant Date: Sun, 17 May 2020 16:36:07 +0530 Subject: [PATCH 2/7] Push images on build complete --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index bd8a4387..d9ccd9d2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,9 +17,7 @@ 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-aria2c components/aria2c >/dev/null after_success: - - echo $TRAVIS_BRANCH - - echo $TRAVIS_PULL_REQUEST - - if [ "$TRAVIS_BRANCH" == "develop" -a "$TRAVIS_PULL_REQUEST" == "false" ]; then + - if [ "$TRAVIS_BRANCH" == "develop" ]; then docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"; docker push scoreucsc/bassa-prod-ui; docker push scoreucsc/bassa-dev-ui; From 1d324c7367353b05a0a3348c3972c0dd5de2470c Mon Sep 17 00:00:00 2001 From: K mehant Date: Sat, 23 May 2020 22:40:14 +0530 Subject: [PATCH 3/7] Update travis --- .travis.yml | 18 +++++++++--------- deploy.sh | 13 +++++++++++++ 2 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 deploy.sh diff --git a/.travis.yml b/.travis.yml index d9ccd9d2..698703c4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,12 +16,12 @@ 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-dev-server components/core >/dev/null - 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 >/dev/null -after_success: - - if [ "$TRAVIS_BRANCH" == "develop" ]; 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 +deploy: + - provider: script + script: deploy.sh + on: + branch: master + - provider: script + script: deploy.sh + on: + branch: develop diff --git a/deploy.sh b/deploy.sh new file mode 100644 index 00000000..9da32cc7 --- /dev/null +++ b/deploy.sh @@ -0,0 +1,13 @@ +#! /bin/bash + +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 >/dev/null +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 >/dev/null +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 >/dev/null +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 >/dev/null +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 >/dev/null +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 \ No newline at end of file From 2b9eb878f0be973224554b059bb042163b8535bf Mon Sep 17 00:00:00 2001 From: K mehant Date: Sat, 23 May 2020 23:02:55 +0530 Subject: [PATCH 4/7] Add comments to deploy.sh --- deploy.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/deploy.sh b/deploy.sh index 9da32cc7..c42fc39d 100644 --- a/deploy.sh +++ b/deploy.sh @@ -1,10 +1,15 @@ #! /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 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 >/dev/null 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 >/dev/null 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 >/dev/null 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 >/dev/null 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 >/dev/null + +# push both production and development use docker images to dockerhub docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD" docker push scoreucsc/bassa-prod-ui docker push scoreucsc/bassa-dev-ui From 6514c431f5fed9442436271febfc99bcef45a23c Mon Sep 17 00:00:00 2001 From: K mehant Date: Thu, 28 May 2020 02:22:46 +0530 Subject: [PATCH 5/7] Refactor Code --- .travis.yml | 10 +++++----- deploy.sh | 33 +++++++++++++++++++++------------ 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/.travis.yml b/.travis.yml index 698703c4..aaf65b6c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,11 +10,11 @@ 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 >/dev/null - - 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 >/dev/null - - 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 >/dev/null - - 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 >/dev/null - - 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 >/dev/null + - 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 diff --git a/deploy.sh b/deploy.sh index c42fc39d..eb15d0b0 100644 --- a/deploy.sh +++ b/deploy.sh @@ -1,18 +1,27 @@ #! /bin/bash # Build production and development use docker images -# Build these images with two build args for better commit history +# Build these images with two build args for better commit history # shows only logs pushed to stderr -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 >/dev/null -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 >/dev/null -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 >/dev/null -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 >/dev/null -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 >/dev/null +# 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 both production and development use docker images to dockerhub +# 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" -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 \ No newline at end of file +docker push scoreucsc/bassa-ui:prod +docker push scoreucsc/bassa-ui:latest +docker push scoreucsc/bassa-ui:v1.0.0 +docker push scoreucsc/bassa-ui:dev +docker push scoreucsc/bassa-server:prod +docker push scoreucsc/bassa-server:latest +docker push scoreucsc/bassa-server:v1.0.0 +docker push scoreucsc/bassa-server:dev +docker push scoreucsc/bassa-aria2c:latest +docker push scoreucsc/bassa-aria2c:v1.0.0 From dede854df42cefe4991f38917b0d77a1f861b46f Mon Sep 17 00:00:00 2001 From: K mehant Date: Mon, 1 Jun 2020 11:33:35 +0530 Subject: [PATCH 6/7] Fix Travis builds --- components/core/Dockerfile | 2 +- components/core/Dockerfile.prod | 2 +- components/core/requirements.txt | 3 ++- components/core/setup.py | 6 +++++- deploy.sh | 22 +++++++++++++++++----- 5 files changed, 26 insertions(+), 9 deletions(-) diff --git a/components/core/Dockerfile b/components/core/Dockerfile index 8dda1ac0..5cbdec09 100644 --- a/components/core/Dockerfile +++ b/components/core/Dockerfile @@ -19,7 +19,7 @@ RUN apt-get update && \ apt-get clean # Installing the python modules -RUN ["/bin/bash", "-c", "python3", "setup.py", "develop"] +RUN python3 setup.py develop # ----------------------------- diff --git a/components/core/Dockerfile.prod b/components/core/Dockerfile.prod index f444f614..603bd8fd 100644 --- a/components/core/Dockerfile.prod +++ b/components/core/Dockerfile.prod @@ -19,7 +19,7 @@ RUN apt-get update && \ apt-get clean # Installing the python modules -RUN ["/bin/bash", "-c", "python3", "setup.py", "develop"] +RUN python3 setup.py 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/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 index eb15d0b0..e7d04e9f 100644 --- a/deploy.sh +++ b/deploy.sh @@ -4,8 +4,10 @@ # 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 @@ -15,13 +17,23 @@ docker build --build-arg VCS_REF=$git_sha --build-arg BUILD_DATE=$build_date -t # 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-ui:latest -docker push scoreucsc/bassa-ui:v1.0.0 -docker push scoreucsc/bassa-ui:dev docker push scoreucsc/bassa-server:prod + +# Latest tag +docker push scoreucsc/bassa-ui:latest docker push scoreucsc/bassa-server:latest -docker push scoreucsc/bassa-server:v1.0.0 -docker push scoreucsc/bassa-server:dev 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 + + From aecf831d81e6097e778d3736b8af1f32b344903b Mon Sep 17 00:00:00 2001 From: K mehant Date: Mon, 1 Jun 2020 11:41:46 +0530 Subject: [PATCH 7/7] More updates for release --- components/core/routes/Download.py | 4 +++- ui/src/app/views/admin.html | 3 ++- ui/src/app/views/table.html | 37 ++++++++++++++++-------------- 3 files changed, 25 insertions(+), 19 deletions(-) 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/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 @@

There are no pending signup requests!

+

diff --git a/ui/src/app/views/table.html b/ui/src/app/views/table.html index 6a14baaa..6acdb312 100755 --- a/ui/src/app/views/table.html +++ b/ui/src/app/views/table.html @@ -5,7 +5,7 @@ check_circle_outline check_circle - +
@@ -28,6 +28,24 @@
#
+ +
    +
  • + + image caption + +
    +

    {{download.download_name}}

    +
    +
    + + +
    +
  • +
+
@@ -36,19 +54,4 @@

There are no completed downloads yet!

-
    -
  • - - image caption - -
    -

    {{download.download_name}}

    -
    -
    - - -
    -
  • -
+