Commit 2f9079f9 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Added keycloak import export.

parent d9837a17
docker exec -it nomad_keycloak keycloak/bin/standalone.sh \
-Djboss.socket.binding.port-offset=100 \
-Dkeycloak.migration.action=export \
-Dkeycloak.migration.provider=singleFile \
-Dkeycloak.migration.realmName=fairdi_nomad_prod \
-Dkeycloak.migration.usersExportStrategy=REALM_FILE \
-Dkeycloak.migration.file=/export/fairdi_nomad_prod_latest.json
docker exec -it nomad_keycloak keycloak/bin/standalone.sh \
-Djboss.socket.binding.port-offset=200 \
-Dkeycloak.migration.action=import \
-Dkeycloak.migration.provider=singleFile \
-Dkeycloak.migration.realmName=fairdi_nomad_prod \
-Dkeycloak.migration.strategy=OVERWRITE_EXISTING \
-Dkeycloak.migration.file=/export/fairdi_nomad_prod_latest.json
images.nomad.tag: "stable"
images.frontend.tag: "stable"
proxy:
nodePort: 30010
external:
host: "repository.nomad-coe.eu"
path: "/app"
gui:
debug: false
app:
replicas: 2
threads: 16
worker:
replicas: 1
routing: "queue"
processes: 10
nomadNodeType: "prod-worker"
elastic:
port: 9202
dbname: fairdi_nomad_prod_v0_7
uploadurl: 'https://repository.nomad-coe.eu/app/gui/upload'
keycloak:
passwordSecret: 'nomad-keycloak-password'
realmName: 'fairdi_nomad_prod'
clientId: 'nomad_api_dev'
clientSecret: 'nomad-keycloak-prod-api-secret'
admin_user_id: '82efac55-6187-408c-8027-b98580c0e1c5'
volumes:
prefixSize: 1
public: /nomad/fairdi/prod_v0.7/fs/public
staging: /nomad/fairdi/prod_v0.7/fs/staging
tmp: /nomad/fairdi/prod_v0.7/fs/tmp
nomad: /nomad
......@@ -19,6 +19,7 @@ services:
keycloak:
volumes:
- /nomad/fairdi/db/keycloak:/opt/jboss/keycloak/standalone/data
- /nomad/backup/fairdi/keycloak:/export
# the search engine
elastic:
......
from nomad import infrastructure
from dateutil.parser import parse
import datetime
infrastructure.setup_logging()
mongo = infrastructure.setup_mongo()
calcs = mongo.fairdi_nomad_prod_v0_7.calc
datasets = mongo.fairdi_nomad_prod_v0_7.dataset
def doit(dataset_id):
example = calcs.find_one({'metadata.datasets': dataset_id})
if example is None:
print('no example for %s' % dataset_id)
return
user_id = example['metadata']['uploader']
if 'upload_time' not in example['metadata']:
print('no upload time in %s' % dataset_id)
upload_time = datetime.datetime.now()
else:
upload_time = example['metadata']['upload_time']
update = [
{'_id': dataset_id},
{'$set': {
'user_id': str(user_id),
'created': parse(str(upload_time))
}}
]
datasets.update_one(*update)
for item in datasets.distinct('_id'):
if 'user_id' not in item and 'created' not in item:
doit(item)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment