diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97ae957f..0c60df56 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,7 +48,7 @@ jobs: matrix: postgres-version: [12, 13] es-image: ['elasticsearch:7.1.1', 'amazon/opendistro-for-elasticsearch:1.13.2'] - python-version: [ '3.6', '3.7', '3.8' ] + python-version: [ '3.7', '3.8', '3.9' ] # Service containers to run with `runner-job` services: @@ -138,7 +138,7 @@ jobs: py.test -vv tests/*_test.py - name: Setup Sauce Connect uses: saucelabs/sauce-connect-action@main - if: startsWith(matrix.postgres-version, '12') && startsWith(matrix.es-image, 'amazon/opendistro') && startsWith(matrix.python-version, '3.6') + if: startsWith(matrix.postgres-version, '12') && startsWith(matrix.es-image, 'amazon/opendistro') && startsWith(matrix.python-version, '3.9') with: username: ${{ secrets.SAUCE_USERNAME }} accessKey: ${{ secrets.SAUCE_ACCESS_KEY }} @@ -147,7 +147,7 @@ jobs: scVersion: 4.7.0 verbose: true - name: Run end-to-end tests - if: startsWith(matrix.postgres-version, '12') && startsWith(matrix.es-image, 'amazon/opendistro') && startsWith(matrix.python-version, '3.6') + if: startsWith(matrix.postgres-version, '12') && startsWith(matrix.es-image, 'amazon/opendistro') && startsWith(matrix.python-version, '3.9') env: SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} @@ -155,7 +155,7 @@ jobs: run: | if [[ -n ${{ secrets.SAUCE_USERNAME }} && -n ${{ secrets.SAUCE_ACCESS_KEY}} ]]; then py.test -vv tests/e2e; fi - name: Run coveralls - if: startsWith(matrix.postgres-version, '12') && startsWith(matrix.es-image, 'amazon/opendistro') && startsWith(matrix.python-version, '3.6') + if: startsWith(matrix.postgres-version, '12') && startsWith(matrix.es-image, 'amazon/opendistro') && startsWith(matrix.python-version, '3.9') env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COVERALLS_SERVICE_NAME: github diff --git a/.readthedocs.yml b/.readthedocs.yml index bb03f8f4..b58b62ba 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -14,7 +14,7 @@ formats: all # Optionally set the version of Python and requirements required to build your docs python: - version: 3.6 + version: 3.8 install: - requirements: requirements.txt - method: pip diff --git a/Dockerfile b/Dockerfile index 7e202169..e9a72ab9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,19 @@ -FROM inspirehep/python:3.6 +FROM python:3.9 + +WORKDIR /usr/src/app + +ENV PYTHONBUFFERED=0 \ + SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt" \ + REQUESTS_CA_BUNDLE="/etc/ssl/certs/ca-certificates.crt" + +COPY certs/CERN_Root_Certification_Authority_2.pem /usr/local/share/ca-certificates/CERN_Root_Certification_Authority_2.crt +COPY certs/CERN_Grid_Certification_Authority.crt /usr/local/share/ca-certificates/CERN_Grid_Certification_Authority.crt + +RUN update-ca-certificates \ + && pip config set global.cert "${REQUESTS_CA_BUNDLE}" + +ENTRYPOINT [ "python3" ] +CMD [ "--version" ] ARG APP_ENVIRONMENT @@ -27,8 +42,8 @@ RUN hepdata collect -v && \ RUN bash -c "echo $APP_ENVIRONMENT" -RUN bash -c "set -x; [[ ${APP_ENVIRONMENT:-prod} = local-web ]] && (cd /usr/local/var && wget https://saucelabs.com/downloads/sc-4.6.2-linux.tar.gz && \ - tar -xvf sc-4.6.2-linux.tar.gz) || echo 'Not installing SC on prod or worker build'" +RUN bash -c "set -x; [[ ${APP_ENVIRONMENT:-prod} = local-web ]] && (cd /usr/local/var && wget https://saucelabs.com/downloads/sc-4.7.1-linux.tar.gz && \ + tar -xvf sc-4.7.1-linux.tar.gz) || echo 'Not installing SC on prod or worker build'" WORKDIR /code diff --git a/INSTALL.rst b/INSTALL.rst index bae46234..1571e800 100644 --- a/INSTALL.rst +++ b/INSTALL.rst @@ -29,15 +29,16 @@ Running services locally Prerequisites ============= -HEPData uses several services, which you will need to install before running HEPData: +HEPData runs with Python 3.7, 3.8 or 3.9. It also uses several services, which you will need to install before running HEPData: * `PostgreSQL `_ (version 12) database server * `Redis `_ for caching * `Elasticsearch `_ (version 7) for indexing and information retrieval. See below for further instructions. - * `Node.js `_ (version 14) JavaScript run-time environment and its package manager `npm `_. (If you're using a Debian-based OS, please follow the `official installation instructions `_ to install NodeJS (which will also install npm), to avoid issues with ``node-sass``.) + * `Node.js `_ (version 14) JavaScript run-time environment and its package manager `npm `_. [If you're using a Debian-based OS, please follow the `official installation instructions `_ to install NodeJS (which will also install npm), to avoid issues with ``node-sass``.] These services can be installed using the relevant package manager for your system, for example, using ``yum`` or ``apt-get`` for Linux or ``brew`` for macOS. + Elasticsearch ------------- @@ -91,12 +92,12 @@ Installation Python ------ -The HEPData code is only compatible with Python 3 (not Python 2). It has been tested with Python 3.6. -It has also been tested with Python 3.8 on an M1 MacBook where some changes were required (documented below). +The HEPData code is only compatible with Python 3.7, 3.8 or 3.9 (not Python 2 or other 3.x versions). We recommend Python 3.9. -First install all requirements in a `virtualenv `_. -(Use `virtualenvwrapper `_ if you prefer.) -The instructions below use ``virtualenv`` directly (Python module `venv `_) +First install all requirements in a Python virtual environment. +(Use `virtualenv `_ or +`virtualenvwrapper `_ if you prefer.) +The instructions below use the Python module `venv `_ directly with a target directory also called ``venv`` (change it if you prefer). .. code-block:: console @@ -121,6 +122,10 @@ reinstall PyYAML to ensure it's built with LibYAML bindings, e.g. on an M1 MacBo (venv)$ LDFLAGS="-L$(brew --prefix)/lib" CFLAGS="-I$(brew --prefix)/include" pip install --global-option="--with-libyaml" --force pyyaml==5.4.1 + (venv)$ export FLASK_ENV=development + +The last line sets an environment variable to switch Flask to run in development mode. +You may want to set this automatically in your bash or zsh profile. Use of config_local.py ---------------------- @@ -144,6 +149,19 @@ use a local converter URL, and specify custom temporary and data directories: An example file ``hepdata/config_local.local.py`` is provided, which can be copied to ``hepdata/config_local.py``. +With ``TESTING=True`` emails will be output to the terminal, but links are suppressed preventing some functionality +such as clicking on confirmation links when a new user is created (see +`HEPData/hepdata#493 `_). +With ``TESTING=False`` you will need to configure an SMTP server to send emails such as +`SMTP2GO `_ that offers a free plan with a limit of 1000 emails/month. +An alternative is to install `MailCatcher `_ (e.g. ``brew install mailcatcher``) where you +just need to add these lines to ``hepdata/config_local.py``: + +.. code-block:: python + + MAIL_SERVER = '127.0.0.1' + MAIL_PORT = 1025 + JavaScript ---------- @@ -157,7 +175,7 @@ On an M1 MacBook, until an `issue with Invenio-Assets `_ version) in the ``package.json`` file of the ``invenio-assets`` installation -(e.g. ``venv/lib/python3.8/site-packages/invenio_assets/assets/package.json``). +(e.g. ``venv/lib/python3.9/site-packages/invenio_assets/assets/package.json``). Celery ------ @@ -166,7 +184,7 @@ Run Celery (-B runs celery beat): .. code-block:: console - (hepdata)$ celery worker -l info -E -B -A hepdata.celery -Q celery,priority,datacite + (hepdata)$ celery -A hepdata.celery worker -l info -E -B -Q celery,priority,datacite PostgreSQL ---------- @@ -186,11 +204,7 @@ executing the steps below. On macOS you can install with ``brew install postgre Next, create the database and database tables. Also create a user and populate the database with some records. Make sure that Celery is running before proceeding further. -Until an `issue `_ is addressed and ``Invenio-Accounts`` is upgraded -to at least v1.4.9, you will need to manually -`patch `_ -the ``invenio_accounts/cli.py`` file (e.g. ``venv/lib/python3.8/site-packages/invenio_accounts/cli.py``) before the -next step. Pass your email address and a password as an argument to the script: +Pass your email address and a password as an argument to the script: .. code-block:: console @@ -212,6 +226,9 @@ Inspect the ``hepdata`` database from the command line as the ``hepdata`` user: 58 | 1299143 | 2014-08-05 17:55:54 (4 rows) + hepdata=> update accounts_user set confirmed_at=NOW() where id=1; + UPDATE 1 + If you're having problems with access permissions to the database (on Linux), a simple solution is to edit the PostgreSQL Client Authentication Configuration File (e.g. ``/var/lib/pgsql/12/data/pg_hba.conf``) to ``trust`` local and IPv4/IPv6 connections (instead of ``peer`` or ``ident``), then restart the PostgreSQL @@ -220,11 +237,10 @@ server (e.g. ``sudo systemctl restart postgresql-12``). Run a local development server ------------------------------ -Now, switch Flask to the development environment and enable debug mode, then start the HEPData web application: +Now start the HEPData web application in debug mode: .. code-block:: console - (hepdata)$ export FLASK_ENV=development (hepdata)$ hepdata run --debugger --reload (hepdata)$ firefox http://localhost:5000/ @@ -315,7 +331,7 @@ To run the tests: .. code-block:: console - $ docker-compose exec web bash -c "/usr/local/var/sc-4.5.4-linux/bin/sc -u $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY -x https://eu-central-1.saucelabs.com/rest/v1 & ./run-tests.sh" + $ docker-compose exec web bash -c "/usr/local/var/sc-4.7.1-linux/bin/sc -u $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY --region eu-central & ./run-tests.sh" .. _docker-compose-tips: diff --git a/certs/CERN_Grid_Certification_Authority.crt b/certs/CERN_Grid_Certification_Authority.crt new file mode 100644 index 00000000..84605e95 --- /dev/null +++ b/certs/CERN_Grid_Certification_Authority.crt @@ -0,0 +1,53 @@ +-----BEGIN CERTIFICATE----- +MIIJdjCCB16gAwIBAgIKYZhqPwAAAAAAAzANBgkqhkiG9w0BAQ0FADBKMQswCQYD +VQQGEwJjaDENMAsGA1UEChMEQ0VSTjEsMCoGA1UEAxMjQ0VSTiBSb290IENlcnRp +ZmljYXRpb24gQXV0aG9yaXR5IDIwHhcNMTMwNDIyMTExMDE2WhcNMjMwNDIyMTEy +MDE2WjBWMRIwEAYKCZImiZPyLGQBGRYCY2gxFDASBgoJkiaJk/IsZAEZFgRjZXJu +MSowKAYDVQQDEyFDRVJOIEdyaWQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggIi +MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDS9Ypy1csm0aZA4/QnWe2oaiQI +LqfeekV8kSSvOhW2peo5cLNIKbXATOo1l2iwIbCWV8SRU2TLKxHIL8fAOJud5n9K +mEKBew7nzubl1wG93B4dY0KREdb3/QB/7OkG8ZZvLqrvQZVGT1CgJ+NFFUiJ315D +FWkKctZv27LjQamzCxpX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leZZSqfEkRl7WK9trRYXHqkqVSnmwNJNsediqioBBDHn/ZMnyc25Z +OLbM+99Z+awvoMbyPy0moUrR7ZqKi3C02N2mkiidO0m3bYnXKwxDUvka5n06oLnI +YSZfwFNJ7IEvSSF4mEzdDeQI+A+87+deb5XOTXee8i1ZUyI08Cg6tuZ8W6NdvY7t ++5iNxRmZJ6DBVwrvXutz0JSqklBCw267osEpX0AKGSL9fE2yGlWBX8WfDLB43lVE +z/HP7kQwYEmsfnfT2yTLzkMJrHSeR0Zymm/oB3amZziKex4kGk+/v7yV1pSYKJce +9QDZE+LYio/ndz01sejMPS87prYJqnII5hDYUjg9F1CoaejhjOlpmCU/10wyEVN0 +nhSP9Wc5z0+lhzU5C1A9r1gXQMuqCA2e7Cv5wv+r9dS+12Uly52jwmYf8mm6H0ZY +LZQbvMayHebD4WCnB7HNdp2Va4z5JrLvwG3J1EXfTjWiPhqOweevOg0rc6t2yhkM +iB9RXMlFoFzbsuE/4Z4Hd0GQcDijcnWJ/VbT15OD2C16yyBiLvu88nXX1gKuOzxL +vu4cw9FOuQZo147y9KPelpUT/SO+nrePzVs= +-----END CERTIFICATE----- diff --git a/certs/CERN_Root_Certification_Authority_2.pem b/certs/CERN_Root_Certification_Authority_2.pem new file mode 100644 index 00000000..646831be --- /dev/null +++ b/certs/CERN_Root_Certification_Authority_2.pem @@ -0,0 +1,38 @@ +-----BEGIN CERTIFICATE----- +MIIGqTCCBJGgAwIBAgIQAojDcLlcbrhBX0qrEka4mzANBgkqhkiG9w0BAQ0FADBK +MQswCQYDVQQGEwJjaDENMAsGA1UEChMEQ0VSTjEsMCoGA1UEAxMjQ0VSTiBSb290 +IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IDIwHhcNMTMwMzE5MTI1NTM2WhcNMzMw +MzE5MTMwNTM0WjBKMQswCQYDVQQGEwJjaDENMAsGA1UEChMEQ0VSTjEsMCoGA1UE +AxMjQ0VSTiBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5I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dABlACAAUABvAGwAaQBjAHkAIABhAG4AZAAgAEMAZQByAHQAaQBmAGkA +YwBhAHQAZQAgAFAAcgBhAGMAdABpAGMAZQAgAFMAdABhAHQAZQBtAGUAbgB0MEoG +CCsGAQUFBwIBFj5odHRwOi8vY2FmaWxlcy5jZXJuLmNoL2NhZmlsZXMvY3AtY3Bz +L2Nlcm4tcm9vdC1jYTItY3AtY3BzLnBkZjANBgkqhkiG9w0BAQ0FAAOCAgEAo0Px +l4CZ6C6bDH+b6jV5uUO0NIHtvLuVgQLMdKVHtQ2UaxeIrWwD+Kz1FyJCHTRXrCvE +OFOca9SEYK2XrbqZGvRKdDRsq+XYts6aCampXj5ahh6r4oQJ8U7aLVfziKTK13Gy +dYFoAUeUrlNklICt3v2wWBaa1tg2oSlU2g4iCg9kYpRnIW3VKSrVsdVk2lUa4EXs +nTEJ30OS7rqX3SdqZp8G+awtBEReh2XPhRgJ6w3xiScP/UdWYUam2LflCGX3RibB +/DZhgGHRRoE4/D0kQMP2XTz6cClbNklECTlp0qZIbiaf350HbcDEFzYRSSIi0emv +kRGcMgsi8yTTU87q8Cr4hETxAF3ZbSVNC0ZaTZ8RBbM9BXguhYzKkVBgG/cMpUjs +B6tY2HMZbAZ3TKQRb/bRyUigM9DniKWeXkeL/0Nsno+XbcpAqLjtVIRwCg6jTLUi +1NRsl3BP6C824dVaoI8Ry7m+o6O+mtocw4BMhHfTcoWCO8CWjT0ME67JzaAYa5eM ++OqoWtgbgweBlfO0/3GMnVGMAmI4FlhH2oWKWQgWdgr0Wgh9K05VcxSpJ87/zjhb +MQn/bEojWmp6eUppPaqNFcELvud41qoe6hLsOYQVUQ1sHi7n6ouhg4BAbwS2iyD2 +uiA6FHTCeLreFGUzs5osPKiz3GE5D6V9she9xIQ= +-----END CERTIFICATE----- diff --git a/docker-compose.yml b/docker-compose.yml index f96829b0..08d4a900 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -28,7 +28,7 @@ services: - ".:/code" worker: build: . - command: "celery worker -A hepdata.celery --loglevel=INFO -Q celery,priority,datacite" + command: "celery -A hepdata.celery worker -l info -E -B -Q celery,priority,datacite" environment: - "APP_CELERY_BROKER_URL=redis://cache:6379/0" - "APP_CACHE_REDIS_URL=redis://cache:6379/0" diff --git a/hepdata/config_local.local.py b/hepdata/config_local.local.py index a28df567..0e48eaa9 100644 --- a/hepdata/config_local.local.py +++ b/hepdata/config_local.local.py @@ -3,9 +3,10 @@ NO_DOI_MINTING = True USE_TWITTER = False CFG_CONVERTER_URL = 'http://localhost:5500' -CFG_TMPDIR = '/Users/watt/tmp/hepdata/tmp' # replace with a suitable local directory -CFG_DATADIR = '/Users/watt/tmp/hepdata/data' # replace with a suitable local directory -MAIL_SERVER = 'localhost' +CFG_TMPDIR = '/Users/watt/tmp/hepdata/tmp' # replace with a suitable existing local directory +CFG_DATADIR = '/Users/watt/tmp/hepdata/data' # replace with a suitable existing local directory +MAIL_SERVER = '127.0.0.1' +MAIL_PORT = 1025 CELERY_BEAT_SCHEDULE = {} # RUN_SELENIUM_LOCALLY = True # RATELIMIT_ENABLED = False diff --git a/hepdata/modules/email/utils.py b/hepdata/modules/email/utils.py index acf59517..b8946f42 100644 --- a/hepdata/modules/email/utils.py +++ b/hepdata/modules/email/utils.py @@ -107,7 +107,10 @@ def send_error_mail(exception): def connect(): - smtp = SMTP(current_app.config['MAIL_SERVER']) + if current_app.config['SMTP_ENCRYPTION']: + smtp = SMTP(current_app.config['MAIL_SERVER']) + else: + smtp = SMTP() smtp.connect(current_app.config['MAIL_SERVER'], current_app.config['MAIL_PORT']) if not current_app.config['SMTP_NO_PASSWORD']: if current_app.config['SMTP_ENCRYPTION']: diff --git a/hepdata/version.py b/hepdata/version.py index ebd64f1d..fa44200c 100644 --- a/hepdata/version.py +++ b/hepdata/version.py @@ -28,4 +28,4 @@ and parsed by ``setup.py``. """ -__version__ = "0.9.4dev20220108" +__version__ = "0.9.4dev20220414" diff --git a/requirements.txt b/requirements.txt index f0e4502d..0f441530 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,26 +1,25 @@ Babel==2.9.1 beautifulsoup4==4.5.1 bleach==3.3.0 -celery==4.4.6 +celery==5.1.2 click==7.1.1 datacite==1.1.2 -elasticsearch==7.1.0 -elasticsearch-dsl==7.1.0 +elasticsearch==7.10.1 +elasticsearch-dsl==7.4.0 email-validator==1.1.0 Flask==1.1.4 -Flask-CeleryExt==0.3.4 +Flask-CeleryExt==0.4.1 Flask-Cors==3.0.9 Flask-Login==0.3.2 -gevent==1.4.0 gunicorn==19.5.0 hepdata-converter-ws-client==0.2.2 hepdata-validator==0.3.3 invenio-access==1.4.2 # Indirect (needed by invenio-admin) -invenio-accounts==1.4.6 +invenio-accounts==1.4.9 invenio-admin==1.3.0 invenio-app==1.3.1 invenio-assets==1.2.6 -invenio-base==1.2.4 +invenio-base==1.2.5 invenio-config==1.0.3 invenio-db==1.0.9 invenio-logging[sentry-sdk]==1.3.0 @@ -38,7 +37,7 @@ msgpack==0.6.2 psycopg2-binary==2.9.3 python-dateutil==2.8.1 pyyaml==5.4.1 -requests==2.23.0 +requests==2.27.1 responses==0.10.9 speaklater==1.3 SQLAlchemy-Continuum==1.3.11 # Indirect: see https://github.com/inveniosoftware/invenio-records/issues/250 diff --git a/setup.py b/setup.py index 88995233..b262898f 100644 --- a/setup.py +++ b/setup.py @@ -40,7 +40,7 @@ 'pytest-mock>=3.1.0', 'pytest-timeout>=1.4.2', 'requests-mock>=1.8.0', - 'selenium>=3.141.0', + 'selenium>=4.0.0', 'lxml' ] @@ -184,5 +184,5 @@ def run_tests(self): 'Development Status :: Production', ], cmdclass={'test': PyTest}, - python_requires='>=3.6', + python_requires='>=3.7, <3.10', ) diff --git a/tests/e2e/test_records.py b/tests/e2e/test_records.py index 070cc278..d277d316 100644 --- a/tests/e2e/test_records.py +++ b/tests/e2e/test_records.py @@ -216,10 +216,8 @@ def test_record_update(live_server, logged_in_browser): delete_widget.find_element_by_class_name('confirm-delete').click() # Wait for confirmation of deletion WebDriverWait(browser, 10).until( - EC.presence_of_element_located((By.ID, 'delete-success')) + EC.text_to_be_present_in_element((By.ID, 'delete-success'), 'Submission deleted') ) - assert 'Submission deleted' in \ - delete_widget.find_element_by_css_selector('#delete-success p').text # Should now only be 1 version of our submission submissions = HEPSubmission.query \