Open quantum-fusion opened 6 years ago
@bacongobbler see bash scripts that work just fine for the example-spring-boot project.
1.) Aside from the .JAR file binding problem, that you had in the example, I was able to fix it for this example. 2.) It appears that the problem was with port forwarding, and it wasn't enabled properly. 3.) It appears that name collisions of the image name uploaded to docker hub were causing connectivity problems with the port numbers as well, and there were strange error messages, which necessitated me to change the name in the draft.toml file to example-javahello , which was kind of a pain.
As it turns out the helm package manager has a bug in it, which won't allow you to add a package to helm ls, therefore it has to be ignored, and the package image has to be added using kubectl run command, in addition I implemented port forwarding which was needed in order to allow access to the external port, since the internal port isn't the correct one.
@squillace @berndverst This one is for you guys, I scripted it up, and got equivalent functionality for spring boot.
The problem was that the Dockerfile and draft up and draft connect script did not work for the spring boot example.
Dockerfile---
FROM java:8 MAINTAINER info@technologyventureslimited.com EXPOSE 8080 9042 ADD ./target/spring-boot-web-0.0.1-SNAPSHOT.jar . ENTRYPOINT ["java", "-jar", "spring-boot-web-0.0.1-SNAPSHOT.jar"] CMD java -jar spring-boot-web-0.0.1-SNAPSHOT.jar $@
draft.up script---
cd dockerbuild
./build.script
./upload.script
cd ..
build.script--- cp ../Dockerfile Dockerfile
cp ../target/spring-boot-web-0.0.1-SNAPSHOT.jar ./target/spring-boot-web-0.0.1-SNAPSHOT.jar
docker build -t joethecoder2/spring-boot-web:1.0.0 .
rm ./target/spring-boot-web-0.0.1-SNAPSHOT.jar
upload.script ----
docker login --username=joethecoder2
docker push joethecoder2/spring-boot-web
draft.connect script-----
kubectl delete pod $(kubectl get pods | grep metoo | awk '{print $1}')
kubectl delete deploy metoo kill -9 $(lsof -n -i4TCP:12345 | awk '{print $2}')
kubectl run metoo --image=joethecoder2/spring-boot-web:1.0.0
sleep 15
echo "curl http://localhost:12345/restaurant/helloworld"
kubectl port-forward $(kubectl get pods | grep metoo | awk '{print $1}') 12345:8080
See transcripts:
./draft.up Sending build context to Docker daemon 52.96MB Step 1/6 : FROM java:8 ---> d23bdf5b1b1b Step 2/6 : MAINTAINER info@technologyventureslimited.com ---> Using cache ---> 3c7b649c8ebc Step 3/6 : EXPOSE 8080 9042 ---> Using cache ---> 563feac19d11 Step 4/6 : ADD ./target/spring-boot-web-0.0.1-SNAPSHOT.jar . ---> Using cache ---> c1dfe0365ae7 Step 5/6 : ENTRYPOINT ["java", "-jar", "spring-boot-web-0.0.1-SNAPSHOT.jar"] ---> Using cache ---> ecf037cb2bc7 Step 6/6 : CMD java -jar spring-boot-web-0.0.1-SNAPSHOT.jar $@ ---> Using cache ---> eb59ec1536ce Successfully built eb59ec1536ce Successfully tagged joethecoder2/spring-boot-web:1.0.0 Password: Login Succeeded The push refers to repository [docker.io/joethecoder2/spring-boot-web] f87db4ff1d4e: Layer already exists 35c20f26d188: Layer already exists c3fe59dd9556: Layer already exists 6ed1a81ba5b6: Layer already exists a3483ce177ce: Layer already exists ce6c8756685b: Layer already exists 30339f20ced0: Layer already exists 0eb22bfb707d: Layer already exists a2ae92ffcd29: Layer already exists 1.0.0: digest: sha256:c564fc8add812a83620fed4a6903b94df2ed1377d187a93f65cf324b7771de8a size: 2212 f87db4ff1d4e: Layer already exists 35c20f26d188: Layer already exists c3fe59dd9556: Layer already exists 6ed1a81ba5b6: Layer already exists a3483ce177ce: Layer already exists ce6c8756685b: Layer already exists 30339f20ced0: Layer already exists 0eb22bfb707d: Layer already exists a2ae92ffcd29: Layer already exists latest: digest: sha256:c564fc8add812a83620fed4a6903b94df2ed1377d187a93f65cf324b7771de8a size: 2212 MacBook-Pro:~/Desktop/Projects/springboot_swagger_example-master-cassandra quantum-fusion$
./draft.connect pod "metoo-5565455fd6-92lt9" deleted deployment.extensions "metoo" deleted kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec] deployment.apps "metoo" created curl http://localhost:12345/restaurant/helloworld Forwarding from 127.0.0.1:12345 -> 8080 Forwarding from [::1]:12345 -> 8080
curl http://localhost:12345/restaurant/helloworld helloworld!MacBook-Pro:~/Desktop/Projects/springboot_swagger_example-master-cassandra quantum-fusion$