Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
What's new
4
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gitlab-com
migration
Commits
48da8a37
Commit
48da8a37
authored
Aug 06, 2018
by
Matteo Melli
Browse files
Fixed SHELLCHECK and sanity check
Use bash -n to check script sanity instead of actually executing it
parent
aa8e7d92
Pipeline
#88696
passed with stage
in 14 seconds
Changes
20
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
bin/migration
View file @
48da8a37
...
...
@@ -10,6 +10,7 @@ export ENVIRONMENT=$1
export
ROLE
=
$2
export
GITLAB_ENV
=
$ENVIRONMENT
# shellcheck source=/dev/null
source
"
${
BASE
}
/source_vars"
source
"
${
BASE
}
/env_
${
ENVIRONMENT
}
"
# That is, .env_staging or .env_production (test also supported)
source
"
${
BASE
}
/utilities"
...
...
bin/sanity-check-scripts
View file @
48da8a37
...
...
@@ -13,6 +13,6 @@ find_scripts | while IFS='' read -r file; do
if
[[
-x
${
file
}
]]
;
then
echo
"
${
file
}
"
SANITY_CHECK_ONLY
=
1
"
${
file
}
"
bash
-n
"
${
file
}
"
fi
done
bin/scripts/01_preflight/050_configuration_checks/110-check-repmgr-state.sh
View file @
48da8a37
...
...
@@ -2,6 +2,7 @@
set
-eu
# shellcheck source=/dev/null
source
"
${
BASE
}
/env_
${
ENVIRONMENT
}
"
for
host
in
"
${
AZURE_HOSTS
[@]
}
"
"
${
GCP_HOSTS
[@]
}
"
...
...
bin/scripts/01_preflight/050_configuration_checks/111-check-replication-topology.sh
View file @
48da8a37
...
...
@@ -2,6 +2,7 @@
set
-eu
# shellcheck source=/dev/null
source
"
${
BASE
}
/env_
${
ENVIRONMENT
}
"
all_ok
=
true
...
...
bin/scripts/02_failover/060_go/p03/050-create-tombstone-table.sh
View file @
48da8a37
...
...
@@ -2,6 +2,7 @@
set
-eu
# shellcheck source=/dev/null
source
"
${
BASE
}
/env_
${
ENVIRONMENT
}
"
echo
"Create tombstone database and table if not already existing"
...
...
bin/scripts/02_failover/060_go/p03/051-check-gcp-replication-delay.sh
View file @
48da8a37
...
...
@@ -2,6 +2,7 @@
set
-eu
# shellcheck source=/dev/null
source
"
${
BASE
}
/env_
${
ENVIRONMENT
}
"
tombstone_msg
=
$(
date
+
'%Y%m%d_%H%M%S'
)
"_
${
ENVIRONMENT
}
"
...
...
bin/scripts/02_failover/060_go/p04/040-disable-chef.sh
View file @
48da8a37
...
...
@@ -2,6 +2,7 @@
set
-eu
# shellcheck source=/dev/null
source
"
${
BASE
}
/env_
${
ENVIRONMENT
}
"
for
host
in
"
${
AZURE_HOSTS
[@]
}
"
"
${
GCP_HOSTS
[@]
}
"
;
do
...
...
bin/scripts/02_failover/060_go/p04/041-disable-consul.sh
View file @
48da8a37
...
...
@@ -2,6 +2,7 @@
set
-eu
# shellcheck source=/dev/null
source
"
${
BASE
}
/env_
${
ENVIRONMENT
}
"
for
host
in
"
${
AZURE_PGBOUNCERS
[@]
}
"
...
...
bin/scripts/02_failover/060_go/p04/042-disable-automatic-failover.sh
View file @
48da8a37
...
...
@@ -2,6 +2,7 @@
set
-eu
# shellcheck source=/dev/null
source
"
${
BASE
}
/env_
${
ENVIRONMENT
}
"
for
host
in
"
${
GCP_HOSTS
[@]
}
"
...
...
bin/scripts/02_failover/060_go/p04/043-reset-automatic-failover-state.sh
View file @
48da8a37
...
...
@@ -2,6 +2,7 @@
set
-eu
# shellcheck source=/dev/null
source
"
${
BASE
}
/env_
${
ENVIRONMENT
}
"
ssh_remote
"
$AZURE_MASTER
"
sudo
-u
gitlab-psql gitlab-psql
-d
gitlab_repmgr
-c
\
...
...
bin/scripts/02_failover/060_go/p04/050-convert-azure-master-to-standby.sh
View file @
48da8a37
...
...
@@ -2,12 +2,13 @@
set
-eu
# shellcheck source=/dev/null
source
"
${
BASE
}
/env_
${
ENVIRONMENT
}
"
echo
"standby_mode = 'on'
primary_conninfo = 'user=gitlab_repmgr host=''
$GCP_MASTER_CANDIDATE
'' password=
$GITLAB_REPMGR_PASSWORD
port=5432 fallback_application_name=repmgr sslmode=prefer sslcompression=1 application_name=''
$AZURE_MASTER
'''
primary_slot_name = secondary_azureprd
restore_command = '/usr/bin/envdir /etc/wal-e.d/env /opt/wal-e/bin/wal-e wal-fetch -p 32 "
%f
" "
%p
"'
restore_command = '/usr/bin/envdir /etc/wal-e.d/env /opt/wal-e/bin/wal-e wal-fetch -p 32
\
"
%f
\
"
\
"
%p
\
"
'
recovery_target_timeline = 'latest'"
|
\
ssh_remote
"
$AZURE_MASTER
"
sudo tee
/var/lib/opt/gitlab/postgresql/data/recovery.conf
>
/dev/null
ssh_remote
"
$AZURE_MASTER
"
sudo chown
postgres:postgres /var/lib/opt/gitlab/postgresql/data/recovery.conf
...
...
bin/scripts/02_failover/060_go/p04/051-check-azure-master-is-standby.sh
View file @
48da8a37
...
...
@@ -2,6 +2,7 @@
set
-eu
# shellcheck source=/dev/null
source
"
${
BASE
}
/env_
${
ENVIRONMENT
}
"
if
ssh_remote
"
$AZURE_MASTER
"
sudo
-u
gitlab-psql gitlab-psql postgres
\
...
...
bin/scripts/02_failover/060_go/p04/052-check-gcp-nodes-has-same-azure-lsn.sh
View file @
48da8a37
...
...
@@ -2,6 +2,7 @@
set
-eu
# shellcheck source=/dev/null
source
"
${
BASE
}
/env_
${
ENVIRONMENT
}
"
azure_master_lsn
=
"
$(
ssh_remote
"
$AZURE_MASTER
"
sudo
-u
gitlab-psql gitlab-psql postgres
\
...
...
bin/scripts/02_failover/060_go/p04/060-perform-gcp-candidate-master-promote.sh
View file @
48da8a37
...
...
@@ -2,6 +2,7 @@
set
-eu
# shellcheck source=/dev/null
source
"
${
BASE
}
/env_
${
ENVIRONMENT
}
"
# WARNING WARNING WARNING here switchover happens!
...
...
bin/scripts/02_failover/060_go/p04/061-check-gcp-candidate-master-is-master.sh
View file @
48da8a37
...
...
@@ -2,6 +2,7 @@
set
-eu
# shellcheck source=/dev/null
source
"
${
BASE
}
/env_
${
ENVIRONMENT
}
"
if
ssh_remote
"
$GCP_MASTER_CANDIDATE
"
sudo
-u
gitlab-psql gitlab-psql postgres
\
...
...
bin/scripts/02_failover/060_go/p04/070-enable-automatic-failover-on-gcp-only.sh
View file @
48da8a37
...
...
@@ -2,6 +2,7 @@
set
-eu
# shellcheck source=/dev/null
source
"
${
BASE
}
/env_
${
ENVIRONMENT
}
"
echo
"Register
$GCP_MASTER_CANDIDATE
as master with repmgr"
...
...
bin/scripts/02_failover/060_go/p04/071-check-repmgr-master.sh
View file @
48da8a37
...
...
@@ -2,6 +2,7 @@
set
-eu
# shellcheck source=/dev/null
source
"
${
BASE
}
/env_
${
ENVIRONMENT
}
"
echo
"Checking state of
$GCP_MASTER_CANDIDATE
"
...
...
bin/scripts/02_failover/060_go/p04/072-enable-consul-on-gcp-only.sh
View file @
48da8a37
...
...
@@ -2,6 +2,7 @@
set
-eu
# shellcheck source=/dev/null
source
"
${
BASE
}
/env_
${
ENVIRONMENT
}
"
# chef
...
...
bin/scripts/02_failover/060_go/p04/073-check-pgbouncer-node-in-gcp.sh
View file @
48da8a37
...
...
@@ -2,6 +2,7 @@
set
-eu
# shellcheck source=/dev/null
source
"
${
BASE
}
/env_
${
ENVIRONMENT
}
"
for
host
in
"
${
GCP_PGBOUNCERS
[@]
}
"
...
...
@@ -9,7 +10,7 @@ do
echo
"Check pgbouncer on
$host
"
ssh_remote
"
$host
"
gitlab-ctl pgb-console
-c
"SHOW DATABASES"
ssh_remote
"
$host
"
gitlab-ctl pgb-console
-c
"SHOW SERVERS"
read
-s
-N
1
-p
"Press [y] to continue, any other key to abort."
key
read
-r
-s
-N
1
-p
"Press [y] to continue, any other key to abort."
key
if
[
"
$key
"
!=
"y"
]
then
return
1
...
...
bin/utilities
View file @
48da8a37
...
...
@@ -72,9 +72,9 @@ function do_menu(){
fi
if
which rlwrap
>
/dev/null 2>&1
then
command
=
"
$(
rlwrap
-f
migration.dict
-C
migration bash
-c
'read -p "'
"
$read_prompt
"
'" command; echo "$command"'
)
"
command
=
"
$(
rlwrap
-f
migration.dict
-C
migration bash
-c
'read
-r
-p "'
"
$read_prompt
"
'" command; echo "$command"'
)
"
else
read
-p
"
$read_prompt
"
command
read
-r
-p
"
$read_prompt
"
command
fi
step
=
case
"
$command
"
in
...
...
@@ -126,7 +126,7 @@ function do_menu(){
cat
"
$script
"
fi
echo
read
-s
-N
1
-p
"Press [y] to continue, any other key to abort."
key
read
-r
-s
-N
1
-p
"Press [y] to continue, any other key to abort."
key
if
[
"
$key
"
==
"y"
]
then
next_step
=
"
$(
printf
"%03d"
"
$((
$(
step_number
"
$step
"
)
+
1
))
"
)
"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment