forked from zenodo/zenodo-rdm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwipe_recreate.sh
45 lines (38 loc) · 1.51 KB
/
wipe_recreate.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env sh
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020 CERN.
#
# Demo-InvenioRDM is free software; you can redistribute it and/or modify it
# under the terms of the MIT License; see LICENSE file for more details.
# Quit on errors
set -o errexit
# Quit on unbound symbols
set -o nounset
# Wipe
# ----
invenio shell --no-term-title -c "import redis; redis.StrictRedis.from_url(app.config['CACHE_REDIS_URL']).flushall(); print('Cache cleared')"
# NOTE: db destroy is not needed since DB keeps being created
# Just need to drop all tables from it.
invenio db drop --yes-i-know
invenio index destroy --force --yes-i-know
invenio index queue init purge
# Recreate
# --------
# NOTE: db init is not needed since DB keeps being created
# Just need to create all tables from it.
invenio db create
# TODO: add back when pipenv access problem is fixed
#invenio files location create --default 'default-location' $(pipenv run invenio shell --no-term-title -c "print(app.instance_path)")'/data'
invenio files location create --default 'default-location' /opt/invenio/var/instance/data
invenio roles create admin
invenio access allow superuser-access role admin
invenio index init --force
# Add demo and fixtures data
# -------------
invenio rdm-records fixtures
invenio vocabularies import -v names -f ./app_data/vocabularies-future.yaml # zenodo specific names
# cannot create records since fixtures are async and might not be present
# invenio rdm-records demo
# Enable admin user
invenio users activate [email protected]