Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review of V3.0.0 changes #1842

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
f12fe9c
Feature branch for V3.0.0 started
HarryKodden Mar 12, 2021
705c5bf
Initial deposit
HarryKodden Mar 15, 2021
4cd20cc
wip
HarryKodden Mar 16, 2021
f15f821
wip
HarryKodden Mar 22, 2021
6c8ca82
wip
HarryKodden Mar 24, 2021
c0de60e
CHANGE: Permission to DynamicPermission in permission.py files
jupste Mar 25, 2021
d2b09f6
Merge branch 'v3-feature-branch' of github.com:EUDAT-B2SHARE/b2share …
jupste Mar 25, 2021
d36f200
wip
HarryKodden Mar 25, 2021
eab20db
uuid.uuid4().hex should not be used, use str(uuid.uuid4()) instead.
HarryKodden Mar 25, 2021
dad4772
Pattern fix
HarryKodden Mar 25, 2021
38acbb2
subclassing InvenioDeposit and adjust usage of uuid.uuid4().hex into …
HarryKodden Mar 25, 2021
3c5fe02
Reverting uuid.uui4d() back to uuid.uuid4().hex
HarryKodden Mar 25, 2021
5233d84
wip
HarryKodden Mar 25, 2021
a331d12
wip
HarryKodden Mar 26, 2021
81797d9
wip
HarryKodden Mar 29, 2021
84a92d5
wip
HarryKodden Mar 29, 2021
018d76c
CHANGE: http code assert in test_communities_rest
jupste Mar 30, 2021
998400d
Merge branch 'v3-feature-branch' of github.com:EUDAT-B2SHARE/b2share …
jupste Mar 30, 2021
0a5acb5
wip
HarryKodden Mar 30, 2021
013f823
Merge branch 'v3-feature-branch' of github.com:EUDAT-B2SHARE/b2share …
jupste Mar 30, 2021
13c4ef5
wip
HarryKodden Mar 31, 2021
aec47ca
Merge branch 'v3-feature-branch' of github.com:EUDAT-B2SHARE/b2share …
jupste Mar 31, 2021
b3e3179
final commit
HarryKodden Mar 31, 2021
620b968
MODIFY: commented out lines from b2share_db_load_data.sql. Made chang…
jupste Apr 12, 2021
27d5057
Merge branch 'v3-feature-branch' of github.com:EUDAT-B2SHARE/b2share …
jupste Apr 12, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 77 additions & 51 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,52 +1,78 @@
*.clisp.mem
*.cmucl.core
*.egg-info
*.fas
*.fasl
*.kdev4
*.kdevelop
*.kdevses
*.lib
*.pyc
*.sbcl.core
*.sse2f
*.x86f
*~
.DS_Store
.coverage
.eggs
.kdev4/
.noseids
.project
.pydevproject
.settings
.version
.ropeproject
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# Idea software family
.idea/
Invenio.egg-info
Makefile.in
TAGS
bower_components/
build
compile
dist
docs/_build
docs/db
docs/static
dump.rdb
instance/
invenio/base/translations/*/LC_MESSAGES/messages.mo
missing
node_modules/
org.eclipse.core.resources.prefs
tags
install/.vagrant/
b2share/base/static
nohup.out
app_instance/
webui/app/b2share-bundle.js
webui/app/b2share-bundle.js.map
webui/app/lib/
webui/app/vendors/
webui/src/version.js
webui/package-lock.json
.venv
.pytest_cache/
.vscode/*
poetry_files

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# 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

# end-to-end testing
.e2e_screenshots

# Translations
*.mo

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Vim swapfiles
.*.sw?

# Environment & secrets
.env

# Development Container
Pipfile
poetry.lock
settings.json
launch.json
111 changes: 111 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
FROM node:latest as build-deps

# Build License Selector

WORKDIR /tmp

RUN git clone https://github.com/EUDAT-B2SHARE/public-license-selector.git
WORKDIR /tmp/public-license-selector
RUN npm install --unsafe-perm
#RUN npm audit fix --force
RUN npm run build

# Build B2Share App

WORKDIR /opt

ADD webui/src src
ADD webui/package.json .
ADD webui/webpack.config.js .

RUN echo "echo 'Files copied !'" > ./copy_files.sh && chmod a+x ./copy_files.sh

RUN mv webpack.config.js webpack.config.js.0
RUN echo "require('es6-promise').polyfill();" > webpack.config.js
RUN cat webpack.config.js.0 >> webpack.config.js
RUN npm install es6-promise
RUN npm install --unsafe-perm

RUN node_modules/webpack/bin/webpack.js -p

FROM centos:7

RUN rpm -iUvh http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-13.noarch.rpm

RUN yum -y update
RUN yum -y groupinstall "Development tools"
RUN yum -y install wget gcc-c++ openssl-devel \
postgresql-devel mysql-devel \
git libffi-devel libxml2-devel libxml2 \
libxslt-devel zlib1g-dev libxslt http-parser uwsgi

# Install Python...

ENV PYTHON_VER=3.6
ENV PYTHON_PRG=/usr/bin/python${PYTHON_VER}
ENV PYTHON_ENV=/opt/.venv
ENV PYTHON_LIB=${VIRTUAL_ENV}/lib/python${PYTHON_VER}

RUN echo -e \
"\tPYTHON VERSION : $PYTHON_VER\n" \
"\tPYTHON PROGRAM : $PYTHON_PRG\n" \
"\tPYTHON VIRTUAL : $PYTHON_ENV\n" \
"\tPYTHON LIBRARY : $PYTHON_LIB\n"

RUN yum -y install python${PYTHON_VER//.} python${PYTHON_VER//.}-pip python${PYTHON_VER//.}-devel python${PYTHON_VER//.}-virtualenv
RUN yum -y install uwsgi-plugin-python${PYTHON_VER//.}

RUN ${PYTHON_PRG} -m virtualenv --python=${PYTHON_PRG} ${PYTHON_ENV}
ENV PATH="$PYTHON_ENV/bin:$PATH"

# install locale
RUN localedef -c -f UTF-8 -i en_US en_US.UTF-8
ENV LC_ALL=en_US.utf-8
ENV LANG=en_US.utf-8

# Prepare application backend...

ENV B2SHARE_INSTANCE_PATH=/opt/var

WORKDIR /opt/app

ADD MANIFEST.in .
ADD entry_points.txt .
ADD requirements.txt .
ADD README.rst .
ADD setup.py .
ADD setup.cfg .
ADD b2share b2share

RUN pip install -r requirements.txt

# Prepare application frontend...

COPY webui/app b2share/modules/b2share_main/static

RUN mv b2share/modules/b2share_main/static/index.html b2share/modules/b2share_main/templates/b2share_main/page.html
Comment on lines +84 to +86
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that these handle moving of webpack built app-folder to correct path in B2SHARE backend and renaming to index.html to b2share/modules/b2share_main/templates/b2share_main/page.html (See THEME_FRONTPAGE_TEMPLATE config.py for more info)


# Add generated files into lib sub directories...
COPY --from=build-deps /opt/app/b2share-bundle.* b2share/modules/b2share_main/static/
COPY --from=build-deps /opt/node_modules/bootstrap/dist/css/bootstrap.min.* b2share/modules/b2share_main/static/lib/css/
COPY --from=build-deps /opt/node_modules/bootstrap-grid/dist/grid.min.css b2share/modules/b2share_main/static/lib/css/bootstrap-grid.min.css
COPY --from=build-deps /opt/node_modules/react-widgets/dist/css/* b2share/modules/b2share_main/static/lib/css/
COPY --from=build-deps /opt/node_modules/font-awesome/css/* b2share/modules/b2share_main/static/lib/css/
COPY --from=build-deps /opt/node_modules/react-toggle/style.css b2share/modules/b2share_main/static/lib/css/toggle-style.css
COPY --from=build-deps /opt/node_modules/bootstrap/dist/fonts/* b2share/modules/b2share_main/static/lib/fonts/
COPY --from=build-deps /opt/node_modules/react-widgets/dist/fonts/* b2share/modules/b2share_main/static/lib/fonts/
COPY --from=build-deps /opt/node_modules/font-awesome/* b2share/modules/b2share_main/static/lib/fonts/
COPY --from=build-deps /opt/node_modules/react-widgets/dist/img/* b2share/modules/b2share_main/static/lib/img/
Comment on lines +88 to +98
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note the use of b2share/modules/b2share_main/static which essentially is default value for B2SHARE_STATIC_FOLDER used in factory.py.
Note that B2SHARE V2 uses B2SHARE_WEBUI_PATH for this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If / when we separate webui from backend codebase we need to adjust these as needed.


# Add License Selector
COPY --from=build-deps /tmp/public-license-selector/dist/license-selector.* b2share/modules/b2share_main/static/vendors/

RUN pip install --upgrade pip
RUN pip install .[all,postgresql,elasticsearch7]

# Optional for debugging....
RUN pip install flask_DebugToolBar

EXPOSE 5000

CMD ["b2share"]
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ recursive-include invenio/modules/*/templates *
recursive-include invenio/modules/*/testsuite *
recursive-include invenio/modules/*/translations *.mo *.po *.pot

recursive-include b2share/modules/* *.json

recursive-include invenio/testsuite *

recursive-include scripts *.sh
Expand Down
34 changes: 6 additions & 28 deletions b2share/__init__.py
Original file line number Diff line number Diff line change
@@ -1,36 +1,14 @@
# -*- coding: utf-8 -*-
# This file is part of EUDAT B2Share.
# Copyright (C) 2015 CERN.
#
# Invenio 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.
# Copyright (C) 2020 EUDAT.
#
# Invenio 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 Invenio; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

r"""EUDAT B2Share Digital Repository.
# B2SHARE is free software; you can redistribute it and/or modify it under
# the terms of the MIT License; see LICENSE file for more details.

B2SHARE is based on the Invenio framework. It uses multiple Invenio **modules**
enabling the storage and processing and of its data.
For a complete list of Invenio modules used by B2SHARE see the
**requirements.txt** file.
"""B2SHARE."""

As an Invenio application, B2SHARE uses Flask to handle HTTP requests. A
B2SHARE service is initialized by the function :func:`~.factory.create_app`.
This function creates the Flask application and loads all B2SHARE and Invenio
modules.

"""
from __future__ import absolute_import, print_function

from .version import __version__


__all__ = ("__version__",)
__all__ = ('__version__', )
8 changes: 4 additions & 4 deletions b2share/cli.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-

"""mysite base Invenio configuration."""
"""B2SHARE base Invenio configuration."""

from __future__ import absolute_import, print_function

from invenio_base.app import create_cli

from .factory import create_app
from .factory import create_app as b2share_cli


cli = create_cli(create_app=create_app)
# B2SHARE CLI application.
cli = create_cli(create_app=b2share_cli)
Loading