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

Test update #500

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 5 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,12 @@ jobs:
- name: Check code formatting with Black
run: docker-compose exec -T web black --check --verbose .

- name: Install test dependencies
run: docker-compose exec -T web pip install ".[test]"

- name: Execute the tests
run: docker-compose exec -T web python setup.py pytest
run: docker-compose exec -T web pytest

- name: Stop containers
if: always()
run: docker-compose down
run: docker-compose down
48 changes: 27 additions & 21 deletions DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Installation

Following instructions are for CentOS Linux 7 (Core).

## Base

```bash
Expand All @@ -16,8 +18,6 @@ make altinstall
sudo yum install openldap-devel nginx
```



# User and Application Source Code

We install the application under a dedicated `daisy` user.
Expand Down Expand Up @@ -45,15 +45,13 @@ apt-get update && apt-get install -y nodejs

Then you need to compile the static files.


```bash
sudo su - daisy
cd /home/daisy/daisy/web/static/vendor/
npm ci
exit
```


## Solr

```bash
Expand All @@ -68,10 +66,12 @@ cd /var/solr/data/daisy/conf
/opt/solr-7.7.1/bin/solr stop
exit
```

It is possible that by this time solr-7.7.1 is not anymore proposed for download on solr mirrors.
In this case check for last solr version available and adapt the instructions above accordingly.
You need configure the solr core 'daisy'. To do so you need to create 'schema.xml' and 'solrconfig.xml' files under
'/var/solr/data/daisy/conf'.
'/var/solr/data/daisy/conf'.

```bash
sudo cp /home/daisy/daisy/docker/solr/schema.xml /var/solr/data/daisy/conf/
sudo cp /home/daisy/daisy/docker/solr/solrconfig.xml /var/solr/data/daisy/conf/
Expand All @@ -80,6 +80,7 @@ sudo cp /home/daisy/daisy/docker/solr/elevate.xml /var/solr/data/daisy/conf/
```

Grant ownership and change privileges of `/var/solr` folder

```
sudo chown -R solr:users /var/solr
sudo chmod -R 775 /var/solr
Expand All @@ -90,7 +91,6 @@ sudo chmod -R 775 /var/solr
<p style="color:red;">By default, the Solr instance listens on port 8983 on all interfaces.
Solr has no authentication system. It is crucial to secure it by either blocking external accesses to the Solr port or by changing it's configuration to listen only on localhost (see https://stackoverflow.com/a/1955591)</p>


You can restart solr and check that it is working with the following commands

```bash
Expand All @@ -102,7 +102,6 @@ sudo systemctl restart solr

1) Create the file ```/etc/systemd/system/gunicorn.service``` as the _root_ user or with _sudo_ and with the following content:


```
[Unit]
Description=gunicorn daemon
Expand Down Expand Up @@ -278,11 +277,11 @@ In case the installation fails, follow steps in the [official documentation](htt

### Create database and roles


```bash
sudo su - postgres
vi ./10/data/pg_hba.conf
```

Change METHOD ident of IPv4 and IPv6 to md5 and add rule for daisy and postgres users.
We recommend to only allow local connection from the daisy user to the daisy database.
Example:
Expand All @@ -299,6 +298,7 @@ host all all ::1/128 md5
```

Create daisy user and database:

```
createuser daisy
createdb daisy
Expand All @@ -308,6 +308,7 @@ postgres=# grant all privileges on database daisy to daisy ;
postgres=# \q
exit
```

<span style="color:red;">You can replace password `daisy` by a password of your choice.</span>

Restart PostgreSQL:
Expand Down Expand Up @@ -386,6 +387,7 @@ Exit the daisy user.
```bash
exit
```

# Web server

1) Install nginx
Expand All @@ -396,9 +398,9 @@ exit
sudo systemctl enable nginx
sudo systemctl start nginx
```

2) As _root_ or with _sudo_ create the file ```/etc/nginx/conf.d/ssl.conf``` with the following content:

```bash
proxy_connect_timeout 600;
proxy_send_timeout 600;
Expand Down Expand Up @@ -426,8 +428,7 @@ exit
ssl_certificate /etc/ssl/certs/daisy.com.crt;
ssl_certificate_key /etc/ssl/private/daisy.com.key;
}
```

```
Changing daisy.com to your particular case.

3) To have a redirect from http to https, as _root_ or with _sudo_ create the file ```/etc/nginx/conf.d/daisy.conf``` with the following content:
Expand Down Expand Up @@ -472,7 +473,7 @@ exit

# Initialization

Once everything is set up, the definitions and lookup values need to be inserted into the database.
Once everything is set up, the definitions and lookup values need to be inserted into the database.
To do this run the following.

```bash
Expand Down Expand Up @@ -522,7 +523,7 @@ sudo systemctl restart celery_worker
sudo systemctl restart celery_beat
```

# Setting up reminders
# Setting up reminders

DAISY can generate reminders on approaching deadlines (e.g. data storage end date or document expiry). To enable this feature, do the following:

Expand All @@ -540,7 +541,7 @@ DAISY can generate reminders on approaching deadlines (e.g. data storage end dat
4.5) Click 'SAVE'.

5) You may repeat the steps in (4) to create a daily periodic task also for `notification.tasks.data_storage_expiry_notifications`,

# Updating DAISY


Expand Down Expand Up @@ -574,6 +575,7 @@ git pull
cd /home/daisy/daisy/web/static/vendor/
npm ci
```

As root user:

```bash
Expand All @@ -589,23 +591,22 @@ cd /home/daisy/daisy
python3.9 manage.py migrate && python3.9 manage.py build_solr_schema -c /var/solr/data/daisy/conf/ -r daisy && yes | python3.9 manage.py clear_index && yes "yes" | python3.9 manage.py collectstatic;
```


4) Reload initial data (optional).
4) Reload initial data (optional).


**IMPORTANT NOTE:** The initial data package provides some default values for various lookup lists e.g. data sensitivity classes, document or data types. If, while using DAISY, you have customized these default lists, please keep in mind that running the ``load_initial_data`` command
during update will re-introduce those default values. If this is not desired, then please skip the reloading of initial data step during your update. You manage lookup lists through the application interface.<br/><br/>

As daisy user:
```bash
cd /home/daisy/daisy/core/fixtures/
wget https://git-r3lab.uni.lu/pinar.alper/metadata-tools/raw/master/metadata_tools/resources/edda.json -O edda.json && wget https://git-r3lab.uni.lu/pinar.alper/metadata-tools/raw/master/metadata_tools/resources/hpo.json -O hpo.json && wget https://git-r3lab.uni.lu/pinar.alper/metadata-tools/raw/master/metadata_tools/resources/hdo.json -O hdo.json && wget https://git-r3lab.uni.lu/pinar.alper/metadata-tools/raw/master/metadata_tools/resources/hgnc.json -O hgnc.json

cd /home/daisy/daisy
python3.9 manage.py load_initial_data
```
```

**IMPORTANT NOTE:** This step can take several minutes to complete.
**IMPORTANT NOTE:** This step can take several minutes to complete.


5) Reimport the users (optional).
Expand Down Expand Up @@ -678,7 +679,12 @@ systemctl start celery_beat
```

# Migration
## Daisy 1.7.12 to 1.7.13

## Daisy 1.7.12 to 1.8.0

The migration introduced breaking change and update of `settings.py` file is required. The new scheduled tasks as defined in [settings_template.py](https://github.com/elixir-luxembourg/daisy/blob/de64e17355700dc029133f48a295be82341486ed/elixir_daisy/settings_local.template.py#L91) must be included to fully support new features.

For enabling the new notification feature, see section [above](#setting-up-reminders) on how to set up reminders.

Update of nodejs is required:

Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ RUN cd /static/vendor \

WORKDIR /code

RUN pip install --upgrade pip
# Copy the list of Python dependencies
COPY ./setup.py /code/.
# Try to install as many Python dependencies as possible...
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@
test_suite="tests",
tests_require=test_requirements,
package_data={"elixir-daisy": ["elixir_daisy/resources/*"]},
extras_require={"dev": dev_requirements},
extras_require={"dev": dev_requirements, "test": test_requirements},
scripts=["manage.py"],
)
Loading