From 04648ac6b4aef8a501cbffd4ce961c564d1560c0 Mon Sep 17 00:00:00 2001 From: Peter Weber Date: Thu, 20 Dec 2018 14:44:30 +0100 Subject: [PATCH] deployment: invenio 3.1 and kubernets corrections * BETTER Update to invenio 3.1. * BETTER Use of pipenv. * DELETE Delete old deployment scripts (in separate git repository now). Signed-off-by: Peter Weber Signed-off-by: Peter Weber --- .travis.yml | 2 + Dockerfile | 50 ++++------ Dockerfile.base | 62 ++++++++++++ MANIFEST.in | 3 +- Pipfile | 1 + Pipfile.lock | 77 ++++++++------- deployment/Dockerfile | 69 -------------- .../kubernetes/ebooks-cache-deployment.yml | 21 ----- .../kubernetes/ebooks-cache-service.yml | 16 ---- .../kubernetes/ebooks-db-deployment.yml | 36 ------- deployment/kubernetes/ebooks-db-service.yml | 16 ---- .../kubernetes/ebooks-frontend-deployment.yml | 93 ------------------ .../kubernetes/ebooks-frontend-service.yml | 15 --- .../kubernetes/ebooks-indexer-deployment.yml | 42 --------- .../kubernetes/ebooks-indexer-service.yml | 19 ---- .../ebooks-scheduler-deployment.yml | 92 ------------------ .../kubernetes/ebooks-tasks-deployment.yml | 92 ------------------ .../kubernetes/ebooks-tasksui-deployment.yml | 94 ------------------- .../kubernetes/ebooks-tasksui-service.yml | 15 --- .../kubernetes/ebooks-worker-deployment.yml | 33 ------- .../kubernetes/ebooks-worker-service.yml | 19 ---- docker-compose.full.yml | 28 ++++-- docker/nginx/conf.d/default.conf | 22 +---- docker/uwsgi/uwsgi_rest.ini | 2 + .../__init__.py => rero_ebooks/bundles.py | 26 ++++- .../static/css/rero_ebooks/ebooks.scss | 50 ++++++++++ run-tests.sh | 1 + scripts/bootstrap | 2 +- 28 files changed, 222 insertions(+), 776 deletions(-) create mode 100644 Dockerfile.base delete mode 100644 deployment/Dockerfile delete mode 100644 deployment/kubernetes/ebooks-cache-deployment.yml delete mode 100644 deployment/kubernetes/ebooks-cache-service.yml delete mode 100644 deployment/kubernetes/ebooks-db-deployment.yml delete mode 100644 deployment/kubernetes/ebooks-db-service.yml delete mode 100644 deployment/kubernetes/ebooks-frontend-deployment.yml delete mode 100644 deployment/kubernetes/ebooks-frontend-service.yml delete mode 100644 deployment/kubernetes/ebooks-indexer-deployment.yml delete mode 100644 deployment/kubernetes/ebooks-indexer-service.yml delete mode 100644 deployment/kubernetes/ebooks-scheduler-deployment.yml delete mode 100644 deployment/kubernetes/ebooks-tasks-deployment.yml delete mode 100644 deployment/kubernetes/ebooks-tasksui-deployment.yml delete mode 100644 deployment/kubernetes/ebooks-tasksui-service.yml delete mode 100644 deployment/kubernetes/ebooks-worker-deployment.yml delete mode 100644 deployment/kubernetes/ebooks-worker-service.yml rename deployment/__init__.py => rero_ebooks/bundles.py (56%) create mode 100644 rero_ebooks/static/css/rero_ebooks/ebooks.scss diff --git a/.travis.yml b/.travis.yml index 26411ca..1ea4d54 100644 --- a/.travis.yml +++ b/.travis.yml @@ -69,6 +69,8 @@ before_install: - "nvm install 6; nvm use 6" - "travis_retry pip install --upgrade setuptools py pipenv==2018.10.9" - "travis_retry pip install twine wheel coveralls" + # patch default version of travis which is mark as unsave by pipenv check + - "travis_retry pip install --upgrade numpy" install: - "./scripts/bootstrap --ci" diff --git a/Dockerfile b/Dockerfile index 5867035..2d5aeaa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,20 @@ # -*- coding: utf-8 -*- # -# This file is part of RERO Ebooks. -# Copyright (C) 2018 RERO. +# This file is part of RERO ILS. +# Copyright (C) 2017 RERO. # -# RERO Ebooks is free software; you can redistribute it +# RERO ILS is free software; you can redistribute it # and/or modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # -# RERO Ebooks is distributed in the hope that it will be +# RERO ILS is distributed in the hope that it will be # useful, but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with RERO Ebooks; if not, write to the +# along with RERO ILS; if not, write to the # Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307, USA. # @@ -22,40 +22,22 @@ # waive the privileges and immunities granted to it by virtue of its status # as an Intergovernmental Organization or submit itself to any jurisdiction. -FROM python:3.5 +ARG VERSION=latest +FROM rero/rero-ebooks-base:${VERSION} -RUN apt-get update -y && apt-get upgrade -y -RUN apt-get install -y git curl vim -RUN pip install --upgrade setuptools wheel pip uwsgi uwsgitop uwsgi-tools +USER 0 -# Install Node -RUN curl -sL https://deb.nodesource.com/setup_6.x | bash - -RUN apt-get install -y nodejs -RUN npm update - -RUN python -m site -RUN python -m site --user-site - -# Install Invenio -ENV WORKING_DIR=/opt/rero-ebooks -ENV INVENIO_INSTANCE_PATH=${WORKING_DIR}/var/instance - -# copy everything inside /src -RUN mkdir -p ${WORKING_DIR}/src COPY ./ ${WORKING_DIR}/src WORKDIR ${WORKING_DIR}/src - -# Install/create static files -RUN mkdir -p ${INVENIO_INSTANCE_PATH} -RUN ./scripts/bootstrap - -# copy uwsgi config files COPY ./docker/uwsgi/ ${INVENIO_INSTANCE_PATH} -# Set folder permissions -RUN chgrp -R 0 ${WORKING_DIR} && \ - chmod -R g=u ${WORKING_DIR} +RUN chown -R invenio:invenio ${WORKING_DIR} -RUN useradd invenio --uid 1000 --gid 0 && \ - chown -R invenio:root ${WORKING_DIR} USER 1000 + +# workaround +RUN rm -rf /invenio/src/ui/admin/node_modules +RUN npm uninstall --prefix `pipenv --venv` --silent -g node-sass clean-css uglify-js requirejs + +ENV INVENIO_COLLECT_STORAGE='flask_collect.storage.file' +RUN ./scripts/bootstrap --deploy diff --git a/Dockerfile.base b/Dockerfile.base new file mode 100644 index 0000000..9e70786 --- /dev/null +++ b/Dockerfile.base @@ -0,0 +1,62 @@ +# -*- coding: utf-8 -*- +# +# This file is part of RERO ILS. +# Copyright (C) 2017 RERO. +# +# RERO ILS is free software; you can redistribute it +# and/or modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version. +# +# RERO ILS is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with RERO ILS; if not, write to the +# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307, USA. +# +# In applying this license, RERO does not +# waive the privileges and immunities granted to it by virtue of its status +# as an Intergovernmental Organization or submit itself to any jurisdiction. + +FROM python:3.6-slim-stretch + +# require debian packages +RUN apt-get update -y && apt-get upgrade -y +RUN apt-get install --no-install-recommends -y git vim-tiny curl gcc gnupg libc6-dev && rm -rf /var/lib/apt/lists/* +RUN pip install --upgrade setuptools wheel pip pipenv + +# # uwsgi uwsgitop uwsgi-tools + +# Install Node +RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - +RUN apt-get install --no-install-recommends -y nodejs && rm -rf /var/lib/apt/lists/* +RUN npm install --silent node-sass@4.9.0 clean-css@3.4.19 uglify-js@2.7.3 requirejs@2.2.0 @angular/cli@7.0.4 + +# RUN npm update + +# RUN python -m site +# RUN python -m site --user-site + +# Install Invenio +ENV WORKING_DIR=/invenio +ENV INVENIO_INSTANCE_PATH=${WORKING_DIR}/var/instance +RUN mkdir -p ${INVENIO_INSTANCE_PATH} + +# copy everything inside /src +RUN mkdir -p ${WORKING_DIR}/src +COPY ./ ${WORKING_DIR}/src +WORKDIR ${WORKING_DIR}/src + +# copy uwsgi config files +COPY ./docker/uwsgi/ ${INVENIO_INSTANCE_PATH} + +# create user +RUN useradd invenio --uid 1000 --home ${WORKING_DIR} && \ + chown -R invenio:invenio ${WORKING_DIR} && \ + chmod -R go+w ${WORKING_DIR} + +USER 1000 diff --git a/MANIFEST.in b/MANIFEST.in index a8b1ae4..03b826f 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -46,6 +46,7 @@ include scripts/worker_beat prune docs/_build # recursive-include rero_ebooks *.po *.pot *.mo recursive-include docker *.cfg *.conf *.crt *.ini *.key *.pem *.sh +include *.base # added by check_manifest.py include *.rst @@ -55,7 +56,6 @@ include *.yml include LICENSE include babel.ini include pytest.ini -include deployment/Dockerfile recursive-include docs *.bat recursive-include docs *.py recursive-include docs *.rst @@ -72,7 +72,6 @@ recursive-include data *.json recursive-include rero_ebooks *.json # added by check_manifest.py -recursive-include deployment *.yml include *.lock include Pipfile recursive-include rero_ebooks *.png diff --git a/Pipfile b/Pipfile index 2219f16..1facf26 100644 --- a/Pipfile +++ b/Pipfile @@ -17,6 +17,7 @@ invenio-oaiserver = "*" pipenv = "*" requests = ">=2.20.0" celery = "<4.3.0" +lxml = "<4.2.6,>=3.5.0" [dev-packages] Sphinx = ">=1.5.1" diff --git a/Pipfile.lock b/Pipfile.lock index 9f42f3d..d98b133 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "4e982e0b8266559919273ee5aea19200aca5c916ef2c82a852e8bf74b373147b" + "sha256": "650888c074c9ce30f57c2d453c85f41d52ad18c391bbe70fbb3d08e619c8e1ee" }, "pipfile-spec": 6, "requires": { @@ -35,14 +35,6 @@ ], "version": "==0.3" }, - "appnope": { - "hashes": [ - "sha256:5b26757dc6f79a3b7dc9fab95359328d5747fcb2409d331ea66d0272b90ab2a0", - "sha256:8b995ffe925347a2138d7ac0fe77155e4311a0ea6d6da4f5128fe4b3cbe5ed71" - ], - "markers": "sys_platform == 'darwin'", - "version": "==0.1.0" - }, "arrow": { "hashes": [ "sha256:002f2315cf4c8404de737c42860441732d339bbc57fee584e2027520e055ecc1", @@ -755,34 +747,39 @@ }, "lxml": { "hashes": [ - "sha256:03984196d00670b2ab14ae0ea83d5cc0cfa4f5a42558afa9ab5fa745995328f5", - "sha256:0815b0c9f897468de6a386dc15917a0becf48cc92425613aa8bbfc7f0f82951f", - "sha256:175f3825f075cf02d15099eb52658457cf0ff103dcf11512b5d2583e1d40f58b", - "sha256:30e14c62d88d1e01a26936ecd1c6e784d4afc9aa002bba4321c5897937112616", - "sha256:3210da6f36cf4b835ff1be853962b22cc354d506f493b67a4303c88bbb40d57b", - "sha256:40f60819fbd5bad6e191ba1329bfafa09ab7f3f174b3d034d413ef5266963294", - "sha256:43b26a865a61549919f8a42e094dfdb62847113cf776d84bd6b60e4e3fc20ea3", - "sha256:4a03dd682f8e35a10234904e0b9508d705ff98cf962c5851ed052e9340df3d90", - "sha256:62f382cddf3d2e52cf266e161aa522d54fd624b8cc567bc18f573d9d50d40e8e", - "sha256:7b98f0325be8450da70aa4a796c4f06852949fe031878b4aa1d6c417a412f314", - "sha256:846a0739e595871041385d86d12af4b6999f921359b38affb99cdd6b54219a8f", - "sha256:a3080470559938a09a5d0ec558c005282e99ac77bf8211fb7b9a5c66390acd8d", - "sha256:ad841b78a476623955da270ab8d207c3c694aa5eba71f4792f65926dc46c6ee8", - "sha256:afdd75d9735e44c639ffd6258ce04a2de3b208f148072c02478162d0944d9da3", - "sha256:b4fbf9b552faff54742bcd0791ab1da5863363fb19047e68f6592be1ac2dab33", - "sha256:b90c4e32d6ec089d3fa3518436bdf5ce4d902a0787dbd9bb09f37afe8b994317", - "sha256:b91cfe4438c741aeff662d413fd2808ac901cc6229c838236840d11de4586d63", - "sha256:bdb0593a42070b0a5f138b79b872289ee73c8e25b3f0bea6564e795b55b6bcdd", - "sha256:c4e4bca2bb68ce22320297dfa1a7bf070a5b20bcbaec4ee023f83d2f6e76496f", - "sha256:cec4ab14af9eae8501be3266ff50c3c2aecc017ba1e86c160209bb4f0423df6a", - "sha256:e83b4b2bf029f5104bc1227dbb7bf5ace6fd8fabaebffcd4f8106fafc69fc45f", - "sha256:e995b3734a46d41ae60b6097f7c51ba9958648c6d1e0935b7e0ee446ee4abe22", - "sha256:f679d93dec7f7210575c85379a31322df4c46496f184ef650d3aba1484b38a2d", - "sha256:fd213bb5166e46974f113c8228daaef1732abc47cb561ce9c4c8eaed4bd3b09b", - "sha256:fdcb57b906dbc1f80666e6290e794ab8fb959a2e17aa5aee1758a85d1da4533f", - "sha256:ff424b01d090ffe1947ec7432b07f536912e0300458f9a7f48ea217dd8362b86" - ], - "version": "==4.3.3" + "sha256:02bc220d61f46e9b9d5a53c361ef95e9f5e1d27171cd461dddb17677ae2289a5", + "sha256:22f253b542a342755f6cfc047fe4d3a296515cf9b542bc6e261af45a80b8caf6", + "sha256:2f31145c7ff665b330919bfa44aacd3a0211a76ca7e7b441039d2a0b0451e415", + "sha256:36720698c29e7a9626a0dc802ef8885f8f0239bfd1689628ecd459a061f2807f", + "sha256:438a1b0203545521f6616132bfe0f4bca86f8a401364008b30e2b26ec408ce85", + "sha256:4815892904c336bbaf73dafd54f45f69f4021c22b5bad7332176bbf4fb830568", + "sha256:5be031b0f15ad63910d8e5038b489d95a79929513b3634ad4babf77100602588", + "sha256:5c93ae37c3c588e829b037fdfbd64a6e40c901d3f93f7beed6d724c44829a3ad", + "sha256:60842230678674cdac4a1cf0f707ef12d75b9a4fc4a565add4f710b5fcf185d5", + "sha256:62939a8bb6758d1bf923aa1c13f0bcfa9bf5b2fc0f5fa917a6e25db5fe0cfa4e", + "sha256:75830c06a62fe7b8fe3bbb5f269f0b308f19f3949ac81cfd40062f47c1455faf", + "sha256:81992565b74332c7c1aff6a913a3e906771aa81c9d0c68c68113cffcae45bc53", + "sha256:8c892fb0ee52c594d9a7751c7d7356056a9682674b92cc1c4dc968ff0f30c52f", + "sha256:9d862e3cf4fc1f2837dedce9c42269c8c76d027e49820a548ac89fdcee1e361f", + "sha256:a623965c086a6e91bb703d4da62dabe59fe88888e82c4117d544e11fd74835d6", + "sha256:a7783ab7f6a508b0510490cef9f857b763d796ba7476d9703f89722928d1e113", + "sha256:aab09fbe8abfa3b9ce62aaf45aca2d28726b1b9ee44871dbe644050a2fff4940", + "sha256:abf181934ac3ef193832fb973fd7f6149b5c531903c2ec0f1220941d73eee601", + "sha256:ae07fa0c115733fce1e9da96a3ac3fa24801742ca17e917e0c79d63a01eeb843", + "sha256:b9c78242219f674ab645ec571c9a95d70f381319a23911941cd2358a8e0521cf", + "sha256:bccb267678b870d9782c3b44d0cefe3ba0e329f9af8c946d32bf3778e7a4f271", + "sha256:c4df4d27f4c93b2cef74579f00b1d3a31a929c7d8023f870c4b476f03a274db4", + "sha256:caf0e50b546bb60dfa99bb18dfa6748458a83131ecdceaf5c071d74907e7e78a", + "sha256:d3266bd3ac59ac4edcd5fa75165dee80b94a3e5c91049df5f7c057ccf097551c", + "sha256:db0d213987bcd4e6d41710fb4532b22315b0d8fb439ff901782234456556aed1", + "sha256:dbbd5cf7690a40a9f0a9325ab480d0fccf46d16b378eefc08e195d84299bfae1", + "sha256:e16e07a0ec3a75b5ee61f2b1003c35696738f937dc8148fbda9fe2147ccb6e61", + "sha256:e175a006725c7faadbe69e791877d09936c0ef2cf49d01b60a6c1efcb0e8be6f", + "sha256:edd9c13a97f6550f9da2236126bb51c092b3b1ce6187f2bd966533ad794bbb5e", + "sha256:fa39ea60d527fbdd94215b5e5552f1c6a912624521093f1384a491a8ad89ad8b" + ], + "index": "pypi", + "version": "==4.2.5" }, "mako": { "hashes": [ @@ -1537,11 +1534,11 @@ }, "pytest-invenio": { "hashes": [ - "sha256:150a2ec52ce6ecb2c67e58289b8163fe135419f5ffbb11aceacc91808698e2fb", - "sha256:ac00481e19f6e4b26244a50119087bea6d5e5355818cf7c81fa2e388e9b8ebd1" + "sha256:5be181fbf4fa87f914f65c5f7eca8b0be1635de41a9ab69ab15c846c2bf2b963", + "sha256:e96a05bb0787d68c90f2491fefc8004ea17182124812fbb5367e5352ac7bef8e" ], "index": "pypi", - "version": "==1.1.0" + "version": "==1.1.1" }, "pytest-mock": { "hashes": [ diff --git a/deployment/Dockerfile b/deployment/Dockerfile deleted file mode 100644 index 316771d..0000000 --- a/deployment/Dockerfile +++ /dev/null @@ -1,69 +0,0 @@ -# -*- coding: utf-8 -*- -# -# This file is part of RERO Ebooks. -# Copyright (C) 2018 RERO. -# -# RERO Ebooks is free software; you can redistribute it -# and/or modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of the -# License, or (at your option) any later version. -# -# RERO Ebooks is distributed in the hope that it will be -# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with RERO Ebooks; if not, write to the -# Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, -# MA 02111-1307, USA. -# -# In applying this license, RERO does not -# waive the privileges and immunities granted to it by virtue of its status -# as an Intergovernmental Organization or submit itself to any jurisdiction. - -FROM python:3.5-slim - -LABEL maintainer="software@rero.ch" -LABEL description="Ebooks repository for RERO." - -RUN apt-get update && apt-get install -y curl git gcc gnupg \ - && apt-get install -y nodejs \ - && pip install -U setuptools pip && \ - pip install -U virtualenv - - -# Add Invenio sources to `code` and work there: -WORKDIR /ebooks/ebooks/src/rero-ebooks -COPY setup.py /ebooks/ebooks/src/rero-ebooks/ -COPY setup.cfg /ebooks/ebooks/src/rero-ebooks/ -COPY babel.ini /ebooks/ebooks/src/rero-ebooks/ -COPY MANIFEST.in /ebooks/ebooks/src/rero-ebooks/ -COPY README.rst /ebooks/ebooks/src/rero-ebooks/ -COPY requirements.txt /ebooks/ebooks/src/rero-ebooks/ -COPY rero_ebooks /ebooks/ebooks/src/rero-ebooks/rero_ebooks -COPY scripts/setup /ebooks/scripts/setup -COPY data/oaisources.yml /ebooks/data/oaisources.yml - -# # Run container as user `invenio` with UID `1000`, which should match -# # current host user in most situations: -RUN adduser --uid 1000 --disabled-password --gecos '' invenio && \ - chown -R invenio:invenio /ebooks - -USER invenio - -SHELL ["/bin/bash", "-c"] -WORKDIR /ebooks -RUN virtualenv ebooks - -RUN source ebooks/bin/activate && \ - pip install -r /ebooks/ebooks/src/rero-ebooks/requirements.txt && \ - pip install ebooks/src/rero-ebooks && \ - pip install flower && \ - pip install gunicorn - -USER root -RUN rm -rf /var/lib/apt/lists/* - -USER invenio -CMD ["/ebooks/ebooks/bin/gunicorn", "-w", "3", "-b", "0.0.0.0:5000", "invenio_app.wsgi"] diff --git a/deployment/kubernetes/ebooks-cache-deployment.yml b/deployment/kubernetes/ebooks-cache-deployment.yml deleted file mode 100644 index 28fd48f..0000000 --- a/deployment/kubernetes/ebooks-cache-deployment.yml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: ebooks-cache -spec: - replicas: 1 - template: - metadata: - labels: - app: ebooks - tier: cache - spec: - containers: - - name: ebooks-cache - image: redis - env: - - name: GET_HOSTS_FROM - value: dns - ports: - - containerPort: 6379 - name: cache diff --git a/deployment/kubernetes/ebooks-cache-service.yml b/deployment/kubernetes/ebooks-cache-service.yml deleted file mode 100644 index 1ff64c2..0000000 --- a/deployment/kubernetes/ebooks-cache-service.yml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: ebooks-cache - labels: - app: ebooks - tier: cache -spec: - type: NodePort - ports: - - port: 6379 - nodePort: 30054 - name: cache - selector: - app: ebooks - tier: cache diff --git a/deployment/kubernetes/ebooks-db-deployment.yml b/deployment/kubernetes/ebooks-db-deployment.yml deleted file mode 100644 index 2a0a108..0000000 --- a/deployment/kubernetes/ebooks-db-deployment.yml +++ /dev/null @@ -1,36 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: ebooks-db -spec: - replicas: 1 - template: - metadata: - labels: - app: ebooks - tier: db - spec: - containers: - - name: ebooks-db - image: postgres:9.6 - env: - - name: GET_HOSTS_FROM - value: dns - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: rero-ebooks - key: db-user - - name: POSTGRES_DB - valueFrom: - secretKeyRef: - name: rero-ebooks - key: db-name - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: rero-ebooks - key: db-password - ports: - - containerPort: 5432 - name: db diff --git a/deployment/kubernetes/ebooks-db-service.yml b/deployment/kubernetes/ebooks-db-service.yml deleted file mode 100644 index 6f294fa..0000000 --- a/deployment/kubernetes/ebooks-db-service.yml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: ebooks-db - labels: - app: ebooks - tier: db -spec: - type: NodePort - ports: - - port: 5432 - nodePort: 30053 - name: db - selector: - app: ebooks - tier: db diff --git a/deployment/kubernetes/ebooks-frontend-deployment.yml b/deployment/kubernetes/ebooks-frontend-deployment.yml deleted file mode 100644 index 06056a8..0000000 --- a/deployment/kubernetes/ebooks-frontend-deployment.yml +++ /dev/null @@ -1,93 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: ebooks-frontend -spec: - replicas: 1 - template: - metadata: - labels: - app: ebooks - tier: frontend - spec: - containers: - - name: rero-ebooks - image: rero/rero-ebooks:latest - imagePullPolicy: Always - env: - - name: PATH - value: /usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/ebooks/ebooks/bin - - name: GET_HOSTS_FROM - value: dns - - name: RABBITMQ_DEFAULT_USER - valueFrom: - secretKeyRef: - name: rero-ebooks - key: worker-user - - name: RABBITMQ_DEFAULT_PASS - valueFrom: - secretKeyRef: - name: rero-ebooks - key: worker-password - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: rero-ebooks - key: db-user - - name: POSTGRES_DB - valueFrom: - secretKeyRef: - name: rero-ebooks - key: db-name - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: rero-ebooks - key: db-password - - name: INVENIO_APP_ENABLE_SECURE_HEADERS - value: 'False' - - name: INVENIO_APP_ALLOWED_HOSTS - value: None - - name: INVENIO_SEARCH_ELASTIC_HOSTS - value: ebooks-indexer:$(EBOOKS_INDEXER_SERVICE_PORT_API) - - name: INVENIO_SQLALCHEMY_DATABASE_URI - value: postgresql+psycopg2://$(POSTGRES_USER):$(POSTGRES_PASSWORD)@ebooks-db:$(EBOOKS_DB_SERVICE_PORT_DB)/$(POSTGRES_DB) - - name: INVENIO_CELERY_BROKER_URL - value: 'amqp://$(RABBITMQ_DEFAULT_USER):$(RABBITMQ_DEFAULT_PASS)@ebooks-worker:$(EBOOKS_WORKER_SERVICE_PORT_WORKER)//' - - name: INVENIO_CELERY_RESULT_BACKEND - value: 'redis://ebooks-cache:$(EBOOKS_CACHE_SERVICE_PORT_CACHE)/1' - - name: INVENIO_CACHE_REDIS_URL - value: 'redis://ebooks-cache:$(EBOOKS_CACHE_SERVICE_PORT_CACHE)/1' - - name: INVENIO_RATELIMIT_STORAGE_URL - value: 'redis://ebooks-cache:$(EBOOKS_CACHE_SERVICE_PORT_CACHE)/3' - - name: INVENIO_ACCOUNTS_SESSION_REDIS_URL - value: 'redis://ebooks-cache:$(EBOOKS_CACHE_SERVICE_PORT_CACHE)/0' - - name: INVENIO_DB_VERSIONING - value: '0' - - name: INVENIO_MAIL_SUPPRESS_SEND - value: '0' - - name: INVENIO_MAIL_SERVER - valueFrom: - secretKeyRef: - name: rero-ebooks - key: mail-server - - name: INVENIO_SECURITY_EMAIL_SENDER - valueFrom: - secretKeyRef: - name: rero-ebooks - key: mail-sender - - name: INVENIO_JSONSCHEMAS_HOST - value: ebooks.test.rero.ch - - name: INVENIO_OAISERVER_ID_PREFIX - value: 'oai:ebooks.test.rero.ch:' - - name: INVENIO_OAISERVER_PAGE_SIZE - value: '500' - ports: - - containerPort: 5000 - volumeMounts: - - mountPath: /data - name: ebooks-data - volumes: - - name: ebooks-data - hostPath: - path: /data/docker/ebooks diff --git a/deployment/kubernetes/ebooks-frontend-service.yml b/deployment/kubernetes/ebooks-frontend-service.yml deleted file mode 100644 index 7352018..0000000 --- a/deployment/kubernetes/ebooks-frontend-service.yml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: ebooks-frontend - labels: - app: ebooks - tier: frontend -spec: - type: NodePort - ports: - - port: 5000 - nodePort: 30050 - selector: - app: ebooks - tier: frontend diff --git a/deployment/kubernetes/ebooks-indexer-deployment.yml b/deployment/kubernetes/ebooks-indexer-deployment.yml deleted file mode 100644 index f5180bb..0000000 --- a/deployment/kubernetes/ebooks-indexer-deployment.yml +++ /dev/null @@ -1,42 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: ebooks-indexer -spec: - replicas: 1 - template: - metadata: - labels: - app: ebooks - tier: indexer - spec: - initContainers: - - name: init-sysctl - image: busybox:1.27.2 - command: - - sysctl - - -w - - vm.max_map_count=262144 - env: - - name: bootstrap.memory_lock - value: "true" - securityContext: - privileged: true - containers: - - name: ebooks-indexer - image: docker.elastic.co/elasticsearch/elasticsearch:6.2.2 - resources: - requests: - cpu: 100m - memory: 512Mi - ports: - - containerPort: 9300 - name: api - - containerPort: 9200 - name: cluster - env: - - name: cluster.name - value: ebooks - - name: ES_JAVA_OPTS - value: -Xms512m -Xmx512m - diff --git a/deployment/kubernetes/ebooks-indexer-service.yml b/deployment/kubernetes/ebooks-indexer-service.yml deleted file mode 100644 index 017ff33..0000000 --- a/deployment/kubernetes/ebooks-indexer-service.yml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: ebooks-indexer - labels: - app: ebooks - tier: indexer -spec: - type: NodePort - ports: - - port: 9200 - nodePort: 30051 - name: api - - port: 9300 - nodePort: 30052 - name: cluster - selector: - app: ebooks - tier: indexer diff --git a/deployment/kubernetes/ebooks-scheduler-deployment.yml b/deployment/kubernetes/ebooks-scheduler-deployment.yml deleted file mode 100644 index e25dd06..0000000 --- a/deployment/kubernetes/ebooks-scheduler-deployment.yml +++ /dev/null @@ -1,92 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: ebooks-scheduler -spec: - replicas: 1 - template: - metadata: - labels: - app: ebooks - tier: scheduler - spec: - containers: - - name: rero-ebooks - image: rero/rero-ebooks:latest - command: ["celery", "-A", "invenio_app.celery", "--loglevel=INFO", "beat"] - imagePullPolicy: Always - env: - - name: PATH - value: /usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/ebooks/ebooks/bin - - name: GET_HOSTS_FROM - value: dns - - name: RABBITMQ_DEFAULT_USER - valueFrom: - secretKeyRef: - name: rero-ebooks - key: worker-user - - name: RABBITMQ_DEFAULT_PASS - valueFrom: - secretKeyRef: - name: rero-ebooks - key: worker-password - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: rero-ebooks - key: db-user - - name: POSTGRES_DB - valueFrom: - secretKeyRef: - name: rero-ebooks - key: db-name - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: rero-ebooks - key: db-password - - name: INVENIO_APP_ENABLE_SECURE_HEADERS - value: 'False' - - name: INVENIO_APP_ALLOWED_HOSTS - value: None - - name: INVENIO_SEARCH_ELASTIC_HOSTS - value: ebooks-indexer:$(EBOOKS_INDEXER_SERVICE_PORT_API) - - name: INVENIO_SQLALCHEMY_DATABASE_URI - value: postgresql+psycopg2://$(POSTGRES_USER):$(POSTGRES_PASSWORD)@ebooks-db:$(EBOOKS_DB_SERVICE_PORT_DB)/$(POSTGRES_DB) - - name: INVENIO_CELERY_BROKER_URL - value: 'amqp://$(RABBITMQ_DEFAULT_USER):$(RABBITMQ_DEFAULT_PASS)@ebooks-worker:$(EBOOKS_WORKER_SERVICE_PORT_WORKER)//' - - name: INVENIO_CELERY_RESULT_BACKEND - value: 'redis://ebooks-cache:$(EBOOKS_CACHE_SERVICE_PORT_CACHE)/1' - - name: INVENIO_CACHE_REDIS_URL - value: 'redis://ebooks-cache:$(EBOOKS_CACHE_SERVICE_PORT_CACHE)/1' - - name: INVENIO_RATELIMIT_STORAGE_URL - value: 'redis://ebooks-cache:$(EBOOKS_CACHE_SERVICE_PORT_CACHE)/3' - - name: INVENIO_ACCOUNTS_SESSION_REDIS_URL - value: 'redis://ebooks-cache:$(EBOOKS_CACHE_SERVICE_PORT_CACHE)/0' - - name: INVENIO_DB_VERSIONING - value: '0' - - name: INVENIO_MAIL_SUPPRESS_SEND - value: '0' - - name: INVENIO_MAIL_SERVER - valueFrom: - secretKeyRef: - name: rero-ebooks - key: mail-server - - name: INVENIO_SECURITY_EMAIL_SENDER - valueFrom: - secretKeyRef: - name: rero-ebooks - key: mail-sender - - name: INVENIO_JSONSCHEMAS_HOST - value: ebooks.test.rero.ch - - name: INVENIO_OAISERVER_ID_PREFIX - value: 'oai:ebooks.test.rero.ch:' - - name: INVENIO_OAISERVER_PAGE_SIZE - value: '500' - volumeMounts: - - mountPath: /data - name: ebooks-data - volumes: - - name: ebooks-data - hostPath: - path: /data/docker/ebooks diff --git a/deployment/kubernetes/ebooks-tasks-deployment.yml b/deployment/kubernetes/ebooks-tasks-deployment.yml deleted file mode 100644 index 951ffa0..0000000 --- a/deployment/kubernetes/ebooks-tasks-deployment.yml +++ /dev/null @@ -1,92 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: ebooks-tasks -spec: - replicas: 1 - template: - metadata: - labels: - app: ebooks - tier: tasks - spec: - containers: - - name: rero-ebooks - image: rero/rero-ebooks:latest - command: ["celery", "-A", "invenio_app.celery", "--loglevel=INFO", "worker"] - imagePullPolicy: Always - env: - - name: PATH - value: /usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/ebooks/ebooks/bin - - name: GET_HOSTS_FROM - value: dns - - name: RABBITMQ_DEFAULT_USER - valueFrom: - secretKeyRef: - name: rero-ebooks - key: worker-user - - name: RABBITMQ_DEFAULT_PASS - valueFrom: - secretKeyRef: - name: rero-ebooks - key: worker-password - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: rero-ebooks - key: db-user - - name: POSTGRES_DB - valueFrom: - secretKeyRef: - name: rero-ebooks - key: db-name - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: rero-ebooks - key: db-password - - name: INVENIO_APP_ENABLE_SECURE_HEADERS - value: 'False' - - name: INVENIO_APP_ALLOWED_HOSTS - value: None - - name: INVENIO_SEARCH_ELASTIC_HOSTS - value: ebooks-indexer:$(EBOOKS_INDEXER_SERVICE_PORT_API) - - name: INVENIO_SQLALCHEMY_DATABASE_URI - value: postgresql+psycopg2://$(POSTGRES_USER):$(POSTGRES_PASSWORD)@ebooks-db:$(EBOOKS_DB_SERVICE_PORT_DB)/$(POSTGRES_DB) - - name: INVENIO_CELERY_BROKER_URL - value: 'amqp://$(RABBITMQ_DEFAULT_USER):$(RABBITMQ_DEFAULT_PASS)@ebooks-worker:$(EBOOKS_WORKER_SERVICE_PORT_WORKER)//' - - name: INVENIO_CELERY_RESULT_BACKEND - value: 'redis://ebooks-cache:$(EBOOKS_CACHE_SERVICE_PORT_CACHE)/1' - - name: INVENIO_CACHE_REDIS_URL - value: 'redis://ebooks-cache:$(EBOOKS_CACHE_SERVICE_PORT_CACHE)/1' - - name: INVENIO_RATELIMIT_STORAGE_URL - value: 'redis://ebooks-cache:$(EBOOKS_CACHE_SERVICE_PORT_CACHE)/3' - - name: INVENIO_ACCOUNTS_SESSION_REDIS_URL - value: 'redis://ebooks-cache:$(EBOOKS_CACHE_SERVICE_PORT_CACHE)/0' - - name: INVENIO_DB_VERSIONING - value: '0' - - name: INVENIO_MAIL_SUPPRESS_SEND - value: '0' - - name: INVENIO_MAIL_SERVER - valueFrom: - secretKeyRef: - name: rero-ebooks - key: mail-server - - name: INVENIO_SECURITY_EMAIL_SENDER - valueFrom: - secretKeyRef: - name: rero-ebooks - key: mail-sender - - name: INVENIO_JSONSCHEMAS_HOST - value: ebooks.test.rero.ch - - name: INVENIO_OAISERVER_ID_PREFIX - value: 'oai:ebooks.test.rero.ch:' - - name: INVENIO_OAISERVER_PAGE_SIZE - value: '500' - volumeMounts: - - mountPath: /data - name: ebooks-data - volumes: - - name: ebooks-data - hostPath: - path: /data/docker/ebooks diff --git a/deployment/kubernetes/ebooks-tasksui-deployment.yml b/deployment/kubernetes/ebooks-tasksui-deployment.yml deleted file mode 100644 index 348c1cc..0000000 --- a/deployment/kubernetes/ebooks-tasksui-deployment.yml +++ /dev/null @@ -1,94 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: ebooks-tasksui -spec: - replicas: 1 - template: - metadata: - labels: - app: ebooks - tier: tasksui - spec: - containers: - - name: rero-ebooks - image: rero/rero-ebooks:latest - command: ["celery", "-A", "invenio_app", "flower"] - imagePullPolicy: Always - env: - - name: PATH - value: /usr/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/ebooks/ebooks/bin - - name: GET_HOSTS_FROM - value: dns - - name: RABBITMQ_DEFAULT_USER - valueFrom: - secretKeyRef: - name: rero-ebooks - key: worker-user - - name: RABBITMQ_DEFAULT_PASS - valueFrom: - secretKeyRef: - name: rero-ebooks - key: worker-password - - name: POSTGRES_USER - valueFrom: - secretKeyRef: - name: rero-ebooks - key: db-user - - name: POSTGRES_DB - valueFrom: - secretKeyRef: - name: rero-ebooks - key: db-name - - name: POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: rero-ebooks - key: db-password - - name: INVENIO_APP_ENABLE_SECURE_HEADERS - value: 'False' - - name: INVENIO_APP_ALLOWED_HOSTS - value: None - - name: INVENIO_SEARCH_ELASTIC_HOSTS - value: ebooks-indexer:$(EBOOKS_INDEXER_SERVICE_PORT_API) - - name: INVENIO_SQLALCHEMY_DATABASE_URI - value: postgresql+psycopg2://$(POSTGRES_USER):$(POSTGRES_PASSWORD)@ebooks-db:$(EBOOKS_DB_SERVICE_PORT_DB)/$(POSTGRES_DB) - - name: INVENIO_CELERY_BROKER_URL - value: 'amqp://$(RABBITMQ_DEFAULT_USER):$(RABBITMQ_DEFAULT_PASS)@ebooks-worker:$(EBOOKS_WORKER_SERVICE_PORT_WORKER)//' - - name: INVENIO_CELERY_RESULT_BACKEND - value: 'redis://ebooks-cache:$(EBOOKS_CACHE_SERVICE_PORT_CACHE)/1' - - name: INVENIO_CACHE_REDIS_URL - value: 'redis://ebooks-cache:$(EBOOKS_CACHE_SERVICE_PORT_CACHE)/1' - - name: INVENIO_RATELIMIT_STORAGE_URL - value: 'redis://ebooks-cache:$(EBOOKS_CACHE_SERVICE_PORT_CACHE)/3' - - name: INVENIO_ACCOUNTS_SESSION_REDIS_URL - value: 'redis://ebooks-cache:$(EBOOKS_CACHE_SERVICE_PORT_CACHE)/0' - - name: INVENIO_DB_VERSIONING - value: '0' - - name: INVENIO_MAIL_SUPPRESS_SEND - value: '0' - - name: INVENIO_MAIL_SERVER - valueFrom: - secretKeyRef: - name: rero-ebooks - key: mail-server - - name: INVENIO_SECURITY_EMAIL_SENDER - valueFrom: - secretKeyRef: - name: rero-ebooks - key: mail-sender - - name: INVENIO_JSONSCHEMAS_HOST - value: ebooks.test.rero.ch - - name: INVENIO_OAISERVER_ID_PREFIX - value: 'oai:ebooks.test.rero.ch:' - - name: INVENIO_OAISERVER_PAGE_SIZE - value: '500' - ports: - - containerPort: 5555 - volumeMounts: - - mountPath: /data - name: ebooks-data - volumes: - - name: ebooks-data - hostPath: - path: /data/docker/ebooks diff --git a/deployment/kubernetes/ebooks-tasksui-service.yml b/deployment/kubernetes/ebooks-tasksui-service.yml deleted file mode 100644 index 942bdef..0000000 --- a/deployment/kubernetes/ebooks-tasksui-service.yml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: ebooks-tasksui - labels: - app: ebooks - tier: tasksui -spec: - type: NodePort - ports: - - port: 5555 - nodePort: 30057 - selector: - app: ebooks - tier: tasksui diff --git a/deployment/kubernetes/ebooks-worker-deployment.yml b/deployment/kubernetes/ebooks-worker-deployment.yml deleted file mode 100644 index 6437053..0000000 --- a/deployment/kubernetes/ebooks-worker-deployment.yml +++ /dev/null @@ -1,33 +0,0 @@ -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: ebooks-worker -spec: - replicas: 1 - template: - metadata: - labels: - app: ebooks - tier: worker - spec: - containers: - - name: ebooks-worker - image: rabbitmq:3-management - env: - - name: RABBITMQ_DEFAULT_USER - valueFrom: - secretKeyRef: - name: rero-ebooks - key: worker-user - - name: RABBITMQ_DEFAULT_PASS - valueFrom: - secretKeyRef: - name: rero-ebooks - key: worker-password - - name: GET_HOSTS_FROM - value: dns - ports: - - containerPort: 5672 - name: worker - - containerPort: 15672 - name: ui diff --git a/deployment/kubernetes/ebooks-worker-service.yml b/deployment/kubernetes/ebooks-worker-service.yml deleted file mode 100644 index 1157fbd..0000000 --- a/deployment/kubernetes/ebooks-worker-service.yml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: ebooks-worker - labels: - app: ebooks - tier: worker -spec: - type: NodePort - ports: - - port: 5672 - nodePort: 30058 - name: worker - - port: 15672 - nodePort: 30055 - name: ui - selector: - app: ebooks - tier: worker diff --git a/docker-compose.full.yml b/docker-compose.full.yml index c3e26c2..f28ac29 100644 --- a/docker-compose.full.yml +++ b/docker-compose.full.yml @@ -37,21 +37,37 @@ services: file: docker-services.yml service: frontend volumes: - - static_data:/opt/rero-ebooks/var/instance/static + - static_data:/invenio/instance/static links: - web-ui - web-api + # UI Application + web-ui: + extends: + file: docker-services.yml + service: app + command: pipenv run uwsgi /invenio/var/instance/uwsgi_ui.ini + image: rero-ebooks-web--ui + ports: + - "5000:5000" + volumes: + - static_data:/invenio/var/instance/static + links: + - cache + - es + - mq + - db # API Rest Application web-api: extends: file: docker-services.yml service: app - command: uwsgi /opt/rero-ebooks/var/instance/uwsgi_rest.ini + command: pipenv run uwsgi /invenio/var/instance/uwsgi_rest.ini image: rero-ebooks-web-api ports: - - "5001" + - "5001:5001" volumes: - - static_data:/opt/rero-ebooks/var/instance/static + - static_data:/invenio/var/instance/static links: - cache - es @@ -63,7 +79,7 @@ services: file: docker-services.yml service: app restart: "always" - command: "celery worker -A invenio_app.celery --loglevel=INFO" + command: "pipenv run celery worker -A invenio_app.celery --loglevel=INFO" image: rero-ebooks-worker links: - cache @@ -76,7 +92,7 @@ services: file: docker-services.yml service: app restart: "always" - command: "celery beat -A invenio_app.celery --loglevel=INFO" + command: "pipenv run celery beat -A invenio_app.celery --loglevel=INFO" image: rero-ebooks-beat links: - cache diff --git a/docker/nginx/conf.d/default.conf b/docker/nginx/conf.d/default.conf index 9e6dd21..d878e40 100644 --- a/docker/nginx/conf.d/default.conf +++ b/docker/nginx/conf.d/default.conf @@ -29,10 +29,10 @@ # which is expected to be running on port 5000/5001. upstream ui_server { - server web-ui:5000 fail_timeout=0; + server localhost:5000 fail_timeout=0; } upstream api_server { - server web-api:5001 fail_timeout=0; + server localhost:5001 fail_timeout=0; } # HTTP server @@ -48,15 +48,14 @@ server { # HTTPS server server { - listen 443; # IPv4 - listen [::]:443; # IPv6 + listen 443 ssl; # IPv4 + listen [::]:443 ssl; # IPv6 server_name _; charset utf-8; keepalive_timeout 5; # SSL configuration according to best practices from # https://mozilla.github.io/server-side-tls/ssl-config-generator/ - ssl on; # The provided certificate (test.crt) and private key (test.key) is only for # testing and must never be used in production environment. ssl_certificate /etc/ssl/certs/test.crt; @@ -105,21 +104,10 @@ server { # Max upload size (except for files) is set to 100mb as default. client_max_body_size 100m; } - location /api/files { - uwsgi_pass api_server; - include uwsgi_params; - uwsgi_buffering off; - uwsgi_request_buffering off; - uwsgi_param Host $host; - uwsgi_param X-Forwarded-For $proxy_add_x_forwarded_for; - uwsgi_param X-Forwarded-Proto $scheme; - # Max upload size for files is set to 50GB (configure as needed). - client_max_body_size 50G; - } # Static content is served directly by nginx and not the application server. location /static { - alias /opt/rero-ebooks/var/instance/static; + alias /invenio/instance/static; autoindex off; } } diff --git a/docker/uwsgi/uwsgi_rest.ini b/docker/uwsgi/uwsgi_rest.ini index bbfa700..b0816fb 100644 --- a/docker/uwsgi/uwsgi_rest.ini +++ b/docker/uwsgi/uwsgi_rest.ini @@ -29,3 +29,5 @@ master = true die-on-term = true processes = 2 threads = 2 +mount = /api=invenio_app.wsgi_rest:application +manage-script-name = true diff --git a/deployment/__init__.py b/rero_ebooks/bundles.py similarity index 56% rename from deployment/__init__.py rename to rero_ebooks/bundles.py index 48d3ed3..6b20afb 100644 --- a/deployment/__init__.py +++ b/rero_ebooks/bundles.py @@ -1,23 +1,41 @@ # -*- coding: utf-8 -*- # -# This file is part of RERO Ebooks. +# This file is part of RERO EBOOKS. # Copyright (C) 2018 RERO. # -# RERO Ebooks is free software; you can redistribute it +# RERO EBOOKS is free software; you can redistribute it # and/or modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of the # License, or (at your option) any later version. # -# RERO Ebooks is distributed in the hope that it will be +# RERO EBOOKS is distributed in the hope that it will be # useful, but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with RERO Ebooks; if not, write to the +# along with RERO EBOOKS; if not, write to the # Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, # MA 02111-1307, USA. # # In applying this license, RERO does not # waive the privileges and immunities granted to it by virtue of its status # as an Intergovernmental Organization or submit itself to any jurisdiction. + +"""JS/CSS bundles for theme.""" + +from __future__ import absolute_import, print_function + +from invenio_assets import NpmBundle + +ebooks_css = NpmBundle( + 'css/rero_ebooks/ebooks.scss', + filters='node-scss,cleancssurl', + output='gen/ebooks.%(version)s.css', + npm={ + 'almond': '~0.3.1', + 'bootstrap-sass': '~3.3.5', + 'font-awesome': '~4.4.0', + 'jquery': '~1.9.1', + } +) diff --git a/rero_ebooks/static/css/rero_ebooks/ebooks.scss b/rero_ebooks/static/css/rero_ebooks/ebooks.scss new file mode 100644 index 0000000..fb56739 --- /dev/null +++ b/rero_ebooks/static/css/rero_ebooks/ebooks.scss @@ -0,0 +1,50 @@ +h1,h2,h3,h4,h5,h6 { + color: #1A4162; +} + +header { + height: 60px; + background-color: #1A4162; + margin-bottom: 40px; +} + +footer { + margin-top: 40px; +} + +#header-logo { + margin-top: 14px; +} + +.ebooks-list { + list-style-type: none; + margin: 0; + padding: 0; +} + +.margin-top-remove { + margin-top: 0; +} + +.margin-top-large { + margin-top: 20px; +} + +.margin-top-extra-large { + margin-top: 40px; +} + + +.service { + background-color: #204b73; + padding: 5px 20px; + margin-top: 4px; + margin-right: 6px; + border-radius: 5px; + display: inline-block; +} + +.service img { + height: 44px; + margin: 4px; +} diff --git a/run-tests.sh b/run-tests.sh index 5d7a63a..024b07a 100755 --- a/run-tests.sh +++ b/run-tests.sh @@ -23,6 +23,7 @@ # waive the privileges and immunities granted to it by virtue of its status # as an Intergovernmental Organization or submit itself to any jurisdiction. + pipenv run pydocstyle rero_ebooks tests docs && \ pipenv run isort -rc -c -df && \ pipenv run check-manifest --ignore ".travis-*,docs/_build*" && \ diff --git a/scripts/bootstrap b/scripts/bootstrap index a87711d..7b15182 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -54,4 +54,4 @@ pipenv install ${flags[@]} # build the web assets pipenv run invenio collect -v -pipenv run invenio webpack buildall \ No newline at end of file +pipenv run invenio webpack buildall