Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
pr_prodige
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
prodige
pr_prodige
Commits
e30a8b98
Commit
e30a8b98
authored
1 month ago
by
Anthony SUZANNE
Browse files
Options
Downloads
Patches
Plain Diff
Upgrade Move prodige URL DB with command from Admin
parent
8ffc7d6d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bin/move_prodige_url_db.sh
+37
-78
37 additions, 78 deletions
bin/move_prodige_url_db.sh
with
37 additions
and
78 deletions
bin/move_prodige_url_db.sh
+
37
−
78
View file @
e30a8b98
...
@@ -389,69 +389,39 @@ function validation {
...
@@ -389,69 +389,39 @@ function validation {
}
}
function
get_db_parameters
{
function
run_command_admin
{
logOkStep
"Get parameters from configuration files"
docker
exec
-u
www-data
-w
/var/www/html/site ppr_prodige_admin_web php bin/console admin:move_url_db
\
PARAM_FILE
=
"
${
DOCKERDIR
}
/data/conf/global.env.local"
--domain
=
$DOMAIN
\
user_bdd
=
$(
eval echo
$(
awk
-F
'='
'/CATALOGUE_USER/ { print $2 }'
${
PARAM_FILE
}
))
--admin
=
$ADMIN
\
pass_bdd
=
$(
eval echo
$(
awk
-F
'='
'/CATALOGUE_PASSWORD/ { print $2 }'
${
PARAM_FILE
}
))
--admincarto
=
$ADMINCARTO
\
CATALOGUE_DB
=
$(
eval echo
$(
awk
-F
'='
'/CATALOGUE_NAME/ { print $2 }'
${
PARAM_FILE
}
))
--carto
=
$CARTO
\
PRODIGE_DB
=
$(
eval echo
$(
awk
-F
'='
'/PRODIGE_NAME/ { print $2 }'
${
PARAM_FILE
}
))
--cas
=
$CAS
\
host_bdd
=
$(
eval echo
$(
awk
-F
'='
'/PRODIGE_HOST/ { print $2 }'
${
PARAM_FILE
}
))
--catalogue
=
$CATALOGUE
\
echo
"user_bdd=
$user_bdd
"
--contribution
=
$CONTRIBUTION
\
echo
"CATALOGUE_DB=
$CATALOGUE_DB
"
--datacarto
=
$DATACARTO
\
echo
"PRODIGE_DB=
$PRODIGE_DB
"
--dataviz
=
$DATAVIZ
\
echo
"host_bdd=
$host_bdd
"
--mapserv
=
$MAPSERV
\
}
--print
=
$PRINT
\
--table
=
$TABLE
\
function
set_db
{
--traitement
=
$TRAITEMENT
\
logOkStep
"(
${
CATALOGUE_DB
}
) Setting system/server/host in public.settings"
--telechargement
=
$TELECHARGEMENT
\
docker
exec
-u
postgres prodige_database psql
-d
${
CATALOGUE_DB
}
-c
"select value from public.settings where name='system/server/host'"
--vues
=
$VUES
\
docker
exec
-u
postgres prodige_database psql
-d
${
CATALOGUE_DB
}
-c
"update public.settings set value='
${
CATALOGUE
}${
DOMAIN
}
' where name='system/server/host';"
--olddomain
=
$OLDDOMAIN
\
docker
exec
-u
postgres prodige_database psql
-d
${
CATALOGUE_DB
}
-c
"select value from public.settings where name='system/server/host'"
--oldadmin
=
$OLDADMIN
\
--oldadmincarto
=
$OLDADMINCARTO
\
logOkStep
"(
${
CATALOGUE_DB
}
) Setting metadata/resourceIdentifierPrefix in public.settings"
--oldcarto
=
$OLDCARTO
\
docker
exec
-u
postgres prodige_database psql
-d
${
CATALOGUE_DB
}
-c
"select value from public.settings where name='metadata/resourceIdentifierPrefix'"
--oldcas
=
$OLDCAS
\
docker
exec
-u
postgres prodige_database psql
-d
${
CATALOGUE_DB
}
-c
"update public.settings set value='https://
${
CATALOGUE
}${
DOMAIN
}
/geonetwork/srv/' where name='metadata/resourceIdentifierPrefix';"
--oldcatalogue
=
$OLDCATALOGUE
\
docker
exec
-u
postgres prodige_database psql
-d
${
CATALOGUE_DB
}
-c
"select value from public.settings where name='metadata/resourceIdentifierPrefix'"
--oldcontribution
=
$OLDCONTRIBUTION
\
--olddatacarto
=
$OLDDATACARTO
\
logOkStep
"(
${
PRODIGE_DB
}
) Setting account_hostpostgres, account_passwordpostgres, account_userpostgres, account_dbpostgres in carmen.account"
--olddataviz
=
$OLDDATAVIZ
\
docker
exec
-u
postgres prodige_database psql
-d
${
PRODIGE_DB
}
-c
"select account_hostpostgres, account_passwordpostgres, account_userpostgres, account_dbpostgres from carmen.account"
--oldmapserv
=
$OLDMAPSERV
\
docker
exec
-u
postgres prodige_database psql
-d
${
PRODIGE_DB
}
-c
"update carmen.account set account_hostpostgres = '
${
host_bdd
}
', account_passwordpostgres = '
${
pass_bdd
}
', account_userpostgres = '
${
user_bdd
}
' where account_dbpostgres = '
${
PRODIGE_DB
}
';"
--oldprint
=
$OLDPRINT
\
docker
exec
-u
postgres prodige_database psql
-d
${
PRODIGE_DB
}
-c
"select account_hostpostgres, account_passwordpostgres, account_userpostgres, account_dbpostgres from carmen.account"
--oldtable
=
$OLDTABLE
\
--oldtraitement
=
$OLDTRAITEMENT
\
TRAILINGDOMAIN
=
${
DOMAIN
:1:
${#
DOMAIN
}}
--oldtelechargement
=
$OLDTELECHARGEMENT
\
logOkStep
"(
${
PRODIGE_DB
}
) Setting dns_url in carmen.lex_dns"
--oldvues
=
$OLDVUES
docker
exec
-u
postgres prodige_database psql
-d
${
PRODIGE_DB
}
-c
"select dns_url from carmen.lex_dns"
ifCmdFailStep
"ppr_prodige_admin container is not running. Please start appropriate docker-compose."
docker
exec
-u
postgres prodige_database psql
-d
${
PRODIGE_DB
}
-c
"update carmen.lex_dns set dns_url = '
${
TRAILINGDOMAIN
}
';"
docker
exec
-u
postgres prodige_database psql
-d
${
PRODIGE_DB
}
-c
"select dns_url from carmen.lex_dns"
}
function
change_db
{
OLD
=(
${
OLDADMINCARTO
}
${
OLDADMIN
}
${
OLDCARTO
}
${
OLDCAS
}
${
OLDCATALOGUE
}
${
OLDCONTRIBUTION
}
${
OLDDATACARTO
}
${
OLDDATAVIZ
}
${
OLDMAPSERV
}
${
OLDPRINT
}
${
OLDTABLE
}
${
OLDTELECHARGEMENT
}
${
OLDTRAITEMENT
}
${
OLDVUES
}
)
NEW
=(
${
ADMINCARTO
}
${
ADMIN
}
${
CARTO
}
${
CAS
}
${
CATALOGUE
}
${
CONTRIBUTION
}
${
DATACARTO
}
${
DATAVIZ
}
${
MAPSERV
}
${
PRINT
}
${
TABLE
}
${
TELECHARGEMENT
}
${
TRAITEMENT
}
${
VUES
}
)
# Before
# docker exec -u postgres prodige_database psql -d ${CATALOGUE_DB} -c "select data from public.metadata"
logOkStep
"(
${
PRODIGE_DB
}
before) layer_metadata_file from carmen.layer"
docker
exec
-u
postgres prodige_database psql
-d
${
PRODIGE_DB
}
-c
"select layer_metadata_file from carmen.layer"
logOkStep
"(
${
PRODIGE_DB
}
before) wxs_url from carmen.wxs"
docker
exec
-u
postgres prodige_database psql
-d
${
PRODIGE_DB
}
-c
"select wxs_url from carmen.wxs"
for
i
in
${
!OLD[@]
}
;
do
logOkStep
"(
${
CATALOGUE_DB
}
) Replacing
${
OLD
[i]
}
$OLDDOMAIN
by
${
NEW
[i]
}
$DOMAIN
in public.metadata"
# docker exec -u postgres prodige_database psql -d ${CATALOGUE_DB} -c "select data from public.metadata"
docker
exec
-u
postgres prodige_database psql
-d
${
CATALOGUE_DB
}
-c
"update public.metadata set data = replace(data, '
${
OLD
[i]
}
$OLDDOMAIN
', '
${
NEW
[i]
}
$DOMAIN
');"
logOkStep
"(
${
PRODIGE_DB
}
) Replacing
${
OLD
[i]
}
$OLDDOMAIN
by
${
NEW
[i]
}
$DOMAIN
in layer_metadata_file from carmen.layer"
docker
exec
-u
postgres prodige_database psql
-d
${
PRODIGE_DB
}
-c
"update carmen.layer set layer_metadata_file = replace(layer_metadata_file, '
${
OLD
[i]
}
$OLDDOMAIN
', '
${
NEW
[i]
}
$DOMAIN
');"
logOkStep
"(
${
PRODIGE_DB
}
) Replacing
${
OLD
[i]
}
$OLDDOMAIN
by
${
NEW
[i]
}
$DOMAIN
in wxs_url from carmen.wxs"
docker
exec
-u
postgres prodige_database psql
-d
${
PRODIGE_DB
}
-c
"update carmen.wxs set wxs_url = replace(wxs_url, '
${
OLD
[i]
}
$OLDDOMAIN
', '
${
NEW
[i]
}
$DOMAIN
');"
done
# After
# docker exec -u postgres prodige_database psql -d ${CATALOGUE_DB} -c "select data from public.metadata"
logOkStep
"(
${
PRODIGE_DB
}
after) layer_metadata_file from carmen.layer"
docker
exec
-u
postgres prodige_database psql
-d
${
PRODIGE_DB
}
-c
"select layer_metadata_file from carmen.layer"
logOkStep
"(
${
PRODIGE_DB
}
after) wxs_url from carmen.wxs"
docker
exec
-u
postgres prodige_database psql
-d
${
PRODIGE_DB
}
-c
"select wxs_url from carmen.wxs"
}
}
########################################################################################################################################
########################################################################################################################################
...
@@ -606,8 +576,7 @@ if [[ $(id -u) -ne 0 ]] ; then
...
@@ -606,8 +576,7 @@ if [[ $(id -u) -ne 0 ]] ; then
fi
fi
# Step
# Step
NB_STEP_AL
=
3
NB_STEP_AL
=
4
STEP_AL
=
1
STEP_AL
=
1
MODE
=
"Validation"
MODE
=
"Validation"
...
@@ -615,19 +584,9 @@ logOkStep "Validation of variables"
...
@@ -615,19 +584,9 @@ logOkStep "Validation of variables"
validation
validation
STEP_AL
=
2
STEP_AL
=
2
MODE
=
"GetDatabaseParameters"
MODE
=
"RunCommand"
logOkStep
"Get database parameters"
logOkStep
"Run command from Admin service"
get_db_parameters
run_command_admin
STEP_AL
=
3
MODE
=
"SetDatabaseValues"
logOkStep
"Set database values"
set_db
STEP_AL
=
4
MODE
=
"ReplaceDatabaseValues"
logOkStep
"Replace database values"
change_db
logOk
"End of
${
SCRIPTNAME
}
"
logOk
"End of
${
SCRIPTNAME
}
"
# End
# End
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment