-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added some handy scripts to export cells from psql pod in legacy db s…
…chema [used in tinydb]
- Loading branch information
1 parent
52e2751
commit bfc6f69
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
vreapis/catalog/management/commands/export-from-psql-pod-in-legacy-db-schema.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
$project_root = Resolve-Path "$PSScriptRoot/../../.." | ||
|
||
$vreapi_pod_inf = kubectl get pod | sls '^vrepaas-vreapi-\w+-\w+' | ||
$vreapi_pod_name = $vreapi_pod_inf.Matches.Value | ||
$psql_pod_inf = kubectl get pod -owide | sls '^vrepaas-postgresql-0' | ||
$psql_pod_IP = ($psql_pod_inf.Line | sls '\d+\.\d+\.\d+\.\d+').Matches.Value | ||
|
||
cd $project_root | ||
$var = Get-Content export_VARS | ||
$off_DB_HOST = ($var | sls '^export DB_HOST=').LineNumber - 1 | ||
$off_DB_NAME = ($var | sls '^export DB_NAME=').LineNumber - 1 | ||
$off_DB_USER = ($var | sls '^export DB_USER=').LineNumber - 1 | ||
$off_DB_PASSWORD = ($var | sls '^export DB_PASSWORD=').LineNumber - 1 | ||
$var[$off_DB_HOST] = "export DB_HOST=$psql_pod_IP" | ||
$var[$off_DB_NAME] = "export DB_NAME=vrepaas" | ||
$var[$off_DB_USER] = "export DB_USER=vrepaas" | ||
$var[$off_DB_PASSWORD] = "export DB_PASSWORD=vrepaas" | ||
|
||
$var > /tmp/export_VARS | ||
kubectl cp /tmp/export_VARS "${vreapi_pod_name}:/tmp" | ||
kubectl cp "$PSScriptRoot/export-from-psql-pod-in-legacy-db-schema.sh" "${vreapi_pod_name}:/tmp" | ||
kubectl exec -it $vreapi_pod_name -- bash "/tmp/export-from-psql-pod-in-legacy-db-schema.sh" | ||
|
||
kubectl cp "${vreapi_pod_name}:/app/NaaVRE_db.json" $project_root/NaaVRE_db.json |
3 changes: 3 additions & 0 deletions
3
vreapis/catalog/management/commands/export-from-psql-pod-in-legacy-db-schema.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source /opt/venv/bin/activate | ||
source /tmp/export_VARS | ||
python manage.py export_in_legacy_db_schema Cell |