adrian-d of Rouge Devs
10/19/2016 - 8:50 AM

Landmark development and deployment process

Landmark development and deployment process

# Beforehand, be aware of which of the two environments are Production and which of the two are Staging, and sync down from Production to Development.
# If available, put the production site into Read Only Mode before running the syncscript to prevent form submissions while
# you are deploying any updates

# NOTE: the sync script does a find and replace on the database before it is imported to replace the s3 URL with sites/default/files. You need
# to ensure that the following line is in the .htaccess file of your development site or files with a 'sites/default/files' URL will not resolve to the s3 bucket:

# RewriteRule ^sites/default/files/(.*) http://yoursitesdevbucket.s3.amazonaws.com/s3fs-public/$1 [R=301,L]

cd ~/landmark-deployments
python syncscript.py [site] status
python syncscript.py [site] live dev

# This should return information looking like this:

Live = "landmarkCorp1"
Site is currently Running
Staging = "landmarkCorp2"
Site is currently Running

# Make sure that the Bucket you are pointing to is correct. If you're in your dev area, you must set the dev Bucket. You can do this by finding out which is the correct Bucket first.

cd ~/landmark-deployments
python syncscript.py [site] status

# Browse to the configuration area for the installation that you want to check or amend the Bucket for. You can do this by logging in as an administrator and, on the black admin bar, navigating to Configuration > Media > S3 File System. The Bucket name appears at the top.

# Begin in your development directory

cd /var/www/html/krisyoung/landmark-corp

# Development should always occur in feature branches, unless initial site development.
# Feature branches should be always be checked out from the latest master branch.

git checkout master
git pull origin master
git checkout -b new_feature_branch

# Make any required development amends

git add .
git commit -m "[development commit - date and time]"
git push origin new_feature_branch

# You may pull new features from master in at any point. This is especially advisable before # making staging deployments. 

# Deploy the feature branch code to Staging

eb deploy [staging site]

# Twin this with the database move, ensuring your content/configuration changes have gone over too

cd ~/landmark-deployments
python syncscript.py [site] dev staging

# Make sure that you are now pointing to the Staging Bucket.  You can do this by finding out which is the correct Bucket first.

cd ~/landmark-deployments
python syncscript.py [site] status

# Browse to the configuration area for the installation that you want to check or amend the # Bucket for. You can do this by logging in as an administrator and, on the black admin bar, # navigating to Configuration > Media > S3 File System. The Bucket name appears at the top.

# At this point, you would aim for signoff on the Staging site. Then we need to merge into 
# the master branch.

git checkout master
git merge new_feature_branch
git push origin master
eb deploy [staging site]

# Test that merging the feature branch back into master hasn't caused any issues.
# If all tests pass, then we are ready to deploy the code to live.

git checkout production
git merge master
git push origin production
eb deploy [staging site]

# When you reach the point where you are ready to run the 'swap', and everything is good to go from a Staging point of view, run the following command from your development directory.

eb swap [staging environment] --destination_name [production environment]

# The swap will deploy the codebase AND database from Staging to Production.

# Change the site Bucket to match the Production environment after this swap has propagated. You can do this by finding out which is the correct Bucket first.

cd ~/landmark-deployments
python syncscript.py [site] status

# Browse to the configuration area for the installation that you want to amend the Bucket for. You can do this by logging in as an administrator and, on the black admin bar, navigating to Configuration > Media > S3 File System. The Bucket name appears at the top.

# Communicate to the client that the changes won't be visible to internal Landmark users for the next 24 hours due to their network configuration.

# Switch back to the Master branch so you are ready for future development and don't accidentally work on Production.

git checkout master