Skip to content

Instantly share code, notes, and snippets.

@calebwashburn
Created August 23, 2022 14:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save calebwashburn/ff10b1452f3947b2fdc37502596d946f to your computer and use it in GitHub Desktop.
Save calebwashburn/ff10b1452f3947b2fdc37502596d946f to your computer and use it in GitHub Desktop.
Spring Music Deploy

Deploy Script

Pre-requistes

Copy files to deploy directory

From this gist copy

  • deploy.sh
  • manifest.yml

Ensure deploy.sh is executable

chmod +x deploy.sh

log-in to cloud foundry with cf cli and set your org / space to push app to.

cf api https://api.sys.dhaka.cf-app.com
cf login
cf target -o <org> -s <space>

Build application

git clone https://github.com/cloudfoundry-samples/spring-music
cd spring-music
./gradlew clean assemble

Copy binary to deploy directory

Within spring-music directory

cp build/libs/spring-music-1.0.jar <target directory coexising with deploy.sh>

Run script

  • set iterations variable to define how many times the push will happen

  • Run it

./deploy.sh
#!/bin/bash -e
iterations=2
for (( c=1; c<=$iterations; c++ ))
do
echo "Doing push $c of $iterations"
cf push
sleep 30
cf delete spring-music -f
done
---
applications:
- name: spring-music
memory: 1G
random-route: true
instances: 2
path: spring-music-1.0.jar
env:
JBP_CONFIG_SPRING_AUTO_RECONFIGURATION: '{enabled: false}'
SPRING_PROFILES_ACTIVE: http2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment