-
Notifications
You must be signed in to change notification settings - Fork 30
/
wipe_recreate.sh
executable file
·67 lines (59 loc) · 2.25 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env sh
# -*- coding: utf-8 -*-
#
# Copyright (C) 2020-2023 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.
if [ "$SENTRY_ENVIRONMENT" == "production" ]
then
echo "ERROR: you tried to run setup script on production. ABORTING."
else
# 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
invenio files location create --default 'default-location' $(invenio shell --no-term-title -c "print(app.instance_path)")'/data'
#
# Create roles
#
# Superuser role
invenio roles create admin
invenio access allow superuser-access role admin
# Administration access role
invenio roles create administration
invenio access allow administration-access role administration
# Administration moderation role
invenio roles create administration-moderation
invenio access allow administration-moderation role administration-moderation
# Media files uploader role
invenio roles create media-files-uploader
invenio access allow manage-media-files role media-files-uploader
# External DOI files manager role
invenio roles create files-manager
invenio access allow manage-external-doi-files role files-manager
invenio index init --force
invenio rdm-records custom-fields init
invenio communities custom-fields init
# Add demo and fixtures data
# -------------
invenio rdm-records fixtures
# psql << "DELETE FROM accounts_user WHERE id=1;" # remove [email protected]
# invenio rdm-records demo
invenio vocabularies import -v names -f ./app_data/vocabularies-future.yaml # zenodo specific names
# Enable admin user
# invenio users activate [email protected]
fi