Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
Terraform Openstack
Manage
Activity
Members
Labels
Plan
Issues
10
Issue boards
Milestones
Wiki
Code
Merge requests
6
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
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
rc
Terraform Openstack
Merge requests
!41
refactor steps before vol snapshot
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
refactor steps before vol snapshot
refactor-vol-snapshot-process
into
master
Overview
0
Commits
1
Pipelines
1
Changes
1
Merged
Eesaan Atluri
requested to merge
refactor-vol-snapshot-process
into
master
1 year ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
closes
#17 (closed)
👍
0
👎
0
Merge request reports
Viewing commit
94917cb9
Show latest version
1 file
+
2
−
9
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
94917cb9
Shutoff instance before vol snapshot instead of turning off services by sshing in
· 94917cb9
Eesaan Atluri
authored
1 year ago
.gitlab-ci.yml
+
2
−
9
Options
@@ -43,20 +43,13 @@ prep-deploy:
export prod_instance_id=$(openstack floating ip show $prod_floating_ip -c port_details -f value | awk -F', ' '{print $2}' | awk -F"'" '{print $2}')
export prod_volume=$(openstack server show $prod_instance_id -c volumes_attached -f value | awk -F"'" '{print $4}')
echo "Detaching prod_volume=${prod_volume} from prod_instance_id=${prod_instance_id} and creating a snapshot"
eval $(ssh-agent -s)
chmod 400 "${SSH_PRIV_KEY}"
ssh-add "${SSH_PRIV_KEY}"
mkdir ~/.ssh
chmod 700 ~/.ssh
ssh -o StrictHostKeyChecking=no $SSH_USERNAME@$prod_floating_ip sudo systemctl stop mariadb
ssh -o StrictHostKeyChecking=no $SSH_USERNAME@$prod_floating_ip sudo umount /var/lib/mysql && df -h
openstack server stop $prod_instance_id
openstack server remove volume $prod_instance_id $prod_volume
openstack volume snapshot create --volume $prod_volume xdmod-prod-vol-snapshot-$BUILD_DATE
echo "Reattach the prod_volume=${prod_volume} to prod_instance_id=${prod_instance_id} after snapshot is created"
openstack server start $prod_instance_id
openstack server add volume $prod_instance_id $prod_volume --device /dev/vdb
ssh -o StrictHostKeyChecking=no $SSH_USERNAME@$prod_floating_ip sudo mount /dev/vdb1 /var/lib/mysql && df -h
ssh -o StrictHostKeyChecking=no $SSH_USERNAME@$prod_floating_ip sudo systemctl start mariadb
echo "Make a copy of prod volume $prod_volume to be used in tf-apply"
TF_VAR_data_volume="xdmod-prod-vol-$BUILD_DATE"
Loading