From 40fa99da94c156dc6399a10d3bd9c8cf388f6694 Mon Sep 17 00:00:00 2001 From: Aakash Goel Date: Wed, 9 Sep 2020 00:48:06 +0530 Subject: [PATCH 1/6] fix: dependency issues and dockerize --- .github/workflows/deploy.yml | 36 +++++++++++++++++++ Dockerfile | 14 ++++++++ .../config_templates/default_excalibur.cfg | 2 +- setup.py | 1 + 4 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deploy.yml create mode 100644 Dockerfile diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..e9fa7ee --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,36 @@ +name: deploy + +on: + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Publish to Github Packages Registry + uses: elgohr/Publish-Docker-Github-Action@master + with: + name: aakashlpin/emailapi/excalibur + registry: docker.pkg.github.com + username: ${{ secrets.GITBUH_USERNAME }} + password: ${{ secrets.GITHUB_TOKEN }} + dockerfile: Dockerfile + tags: latest + - name: Deploy package to digitalocean + uses: appleboy/ssh-action@master + env: + GITBUH_USERNAME: ${{ secrets.GITBUH_USERNAME }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + host: ${{ secrets.DO_HOST }} + username: ${{ secrets.DO_USERNAME }} + key: ${{ secrets.SSH_ID_RSA }} + envs: GITBUH_USERNAME, GITHUB_TOKEN + script: | + docker login docker.pkg.github.com -u $GITBUH_USERNAME -p $GITHUB_TOKEN + docker pull docker.pkg.github.com/aakashlpin/emailapi/excalibur:latest + docker stop excalibur + docker run -dit --rm -p 5000:5000 --name excalibur docker.pkg.github.com/aakashlpin/emailapi/excalibur:latest diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4f8f897 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +FROM ubuntu:bionic +WORKDIR /home/root +ENV DEBIAN_FRONTEND=noninteractive +RUN apt-get update && apt-get install -y git libsm6 libxext6 libxrender1 libfontconfig1 python3 python3-pip python-pip python3-tk ghostscript && gs -version +COPY . ./excalibur +#&& perl -pi -e 's/from werkzeug import secure_filename/from werkzeug.utils import secure_filename/' excalibur/www/views.py \ +RUN cd excalibur \ + && ls -lah \ + && pip3 install . \ + && cd ../ +ENV LC_ALL=C.UTF-8 +ENV LANG=C.UTF-8 +EXPOSE 5000 +ENTRYPOINT [ "python3", "./excalibur/arthur.py" ] \ No newline at end of file diff --git a/excalibur/config_templates/default_excalibur.cfg b/excalibur/config_templates/default_excalibur.cfg index fd3dc67..2c7ef05 100644 --- a/excalibur/config_templates/default_excalibur.cfg +++ b/excalibur/config_templates/default_excalibur.cfg @@ -15,7 +15,7 @@ logging_level = INFO [webserver] # The host interface on which to listen. # 127.0.0.1 means the web server will only respond to requests from the local machine. -web_server_host = 127.0.0.1 +web_server_host = 0.0.0.0 # The port on which to run the web server. web_server_port = 5000 diff --git a/setup.py b/setup.py index a618161..168aa39 100644 --- a/setup.py +++ b/setup.py @@ -12,6 +12,7 @@ readme = f.read() requires = [ + "opencv-python==3.4.2.17", "camelot-py[cv]>=0.7.1", "celery>=4.1.1", "Click>=7.0", From 34d567885a917a03f0069cea7f977e205355be15 Mon Sep 17 00:00:00 2001 From: Aakash Goel Date: Wed, 9 Sep 2020 00:57:58 +0530 Subject: [PATCH 2/6] Update deploy.yml --- .github/workflows/deploy.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e9fa7ee..f7cb3ad 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -13,7 +13,7 @@ jobs: - name: Publish to Github Packages Registry uses: elgohr/Publish-Docker-Github-Action@master with: - name: aakashlpin/emailapi/excalibur + name: aakashlpin/excalibur/excalibur registry: docker.pkg.github.com username: ${{ secrets.GITBUH_USERNAME }} password: ${{ secrets.GITHUB_TOKEN }} @@ -31,6 +31,6 @@ jobs: envs: GITBUH_USERNAME, GITHUB_TOKEN script: | docker login docker.pkg.github.com -u $GITBUH_USERNAME -p $GITHUB_TOKEN - docker pull docker.pkg.github.com/aakashlpin/emailapi/excalibur:latest + docker pull docker.pkg.github.com/aakashlpin/excalibur/excalibur:latest docker stop excalibur - docker run -dit --rm -p 5000:5000 --name excalibur docker.pkg.github.com/aakashlpin/emailapi/excalibur:latest + docker run -dit --rm -p 5000:5000 --name excalibur docker.pkg.github.com/aakashlpin/excalibur/excalibur:latest From 97a72e497ab96b9b8e296f3f99ecda614449d7ee Mon Sep 17 00:00:00 2001 From: Aakash Goel Date: Wed, 9 Sep 2020 01:10:51 +0530 Subject: [PATCH 3/6] Update setup.py --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 168aa39..1508503 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ readme = f.read() requires = [ - "opencv-python==3.4.2.17", + "opencv-python==4.2.0.34", "camelot-py[cv]>=0.7.1", "celery>=4.1.1", "Click>=7.0", From 7927d8708b8552b0fb0b8420886b666e71245676 Mon Sep 17 00:00:00 2001 From: Aakash Goel Date: Wed, 9 Sep 2020 01:26:11 +0530 Subject: [PATCH 4/6] Update deploy.yml --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index f7cb3ad..bc4d9ca 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -18,7 +18,7 @@ jobs: username: ${{ secrets.GITBUH_USERNAME }} password: ${{ secrets.GITHUB_TOKEN }} dockerfile: Dockerfile - tags: latest + tags: v0.4.2 - name: Deploy package to digitalocean uses: appleboy/ssh-action@master env: From 401dd916b3c5d8941c0b7f1570d09b4bf837671b Mon Sep 17 00:00:00 2001 From: Aakash Goel Date: Wed, 9 Sep 2020 01:33:51 +0530 Subject: [PATCH 5/6] fetch tag --- .github/workflows/deploy.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index bc4d9ca..348ff5c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -9,7 +9,10 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - name: Checkout code + uses: actions/checkout@v2 + with: + ref: 'v0.4.2' - name: Publish to Github Packages Registry uses: elgohr/Publish-Docker-Github-Action@master with: @@ -18,7 +21,7 @@ jobs: username: ${{ secrets.GITBUH_USERNAME }} password: ${{ secrets.GITHUB_TOKEN }} dockerfile: Dockerfile - tags: v0.4.2 + tags: latest - name: Deploy package to digitalocean uses: appleboy/ssh-action@master env: From fece9f9f54233291e119733ebc92d4cf55ad4862 Mon Sep 17 00:00:00 2001 From: Aakash Goel Date: Wed, 9 Sep 2020 01:36:09 +0530 Subject: [PATCH 6/6] dead end --- .github/workflows/deploy.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 348ff5c..e2ecc56 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -11,8 +11,6 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 - with: - ref: 'v0.4.2' - name: Publish to Github Packages Registry uses: elgohr/Publish-Docker-Github-Action@master with: