Created
          October 6, 2016 18:12 
        
      - 
      
- 
        Save joeljuca/ebcf06f4cf4754933ffe96db15babaa0 to your computer and use it in GitHub Desktop. 
    Example of deployment script http://blog.triadworks.com.br/deploy-automatizado-feito-e-melhor-que-perfeito
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | #!/bin/bash | |
| # settings | |
| HOST='myapp.com.br' | |
| USER='john' | |
| BASE_PATH='/tomcat_home' | |
| WEBAPPS_PATH="${PROJECT_PATH}/webapps" | |
| # local steps | |
| mvn package | |
| scp path/to/my-app.war "${USER}@${HOST}:/tmp" | |
| # remote steps | |
| step_01="${BASE_PATH}/bin/shutdown.sh" | |
| step_02="sleep 5" | |
| step_03="rm -fR ${WEBAPPS_PATH}/MyApp ${WEBAPPS_PATH}/MyApp.war" | |
| step_04="cp /tmp/my-app.war ${WEBAPPS_PATH}" | |
| step_05="${BASE_PATH}/bin/startup.sh" | |
| # execute remote steps into one single SSH tunnel | |
| steps="${step_01}; ${step_02}; ${step_03}; ${step_04}; ${step_05}" | |
| ssh "${USER}@${HOST}" "${commands}" | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment