Azure / draft-classic

A tool for developers to create cloud-native applications on Kubernetes.
https://draft.sh
MIT License
3.92k stars 396 forks source link

Draft Up can not ADD jar dependency failed from Dockerfile #777

Closed quantum-fusion closed 6 years ago

quantum-fusion commented 6 years ago

These are the steps that I am using to test DRAFT.

%git clone https://github.com/quantum-fusion/springboot_swagger_example-master-cassandra

%mvn clean install -DskipTests

%draft create

%draft up

Results Fail: draft up Draft Up Started: 'springboot_swagger_example-master-cassandra': 01CE78545ZSNAVCWTZGSYX69RJ springboot_swagger_example-master-cassandra: Building Docker Image: FAIL ❌ (7.0014s) Inspect the logs with draft logs 01CE78545ZSNAVCWTZGSYX69RJ

Trace results: draft logs 01CE78545ZSNAVCWTZGSYX69RJ 2018/05/23 15:38:53 error while building: Error response from daemon: Cannot locate specified Dockerfile: Dockerfile 2018/05/23 15:38:53 complete: failed to store build object for app "springboot_swagger_example-master-cassandra": ConfigMap "springboot_swagger_example-master-cassandra" is invalid: metadata.name: Invalid value: "springboot_swagger_example-master-cassandra": a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is 'a-z0-9?(.a-z0-9?)*')

Question: I added a symbolic link for the Dockerfile.lrwxr-xr-x 1 me staff 24 May 23 15:36 Dockerfile -> ./dockerbuild/Dockerfile

Errata question: Is there something wrong with DRAFT that doesn't either see the symbolic link, or some other reason that DRAFT isn't seeing the Dockerfile when I use the draft up command?

quantum-fusion commented 6 years ago

I checked, and it has nothing to do with the symbolic link to the Dockerfile.

See trace logs:

draft logs 01CE79PX6WAMDCKDS7TBD6NQEJ Step 1/6 : FROM java:8 ---> d23bdf5b1b1b Step 2/6 : MAINTAINER info@technologyventureslimited.com ---> Using cache ---> d23490ec5233 Step 3/6 : EXPOSE 8080 9042 ---> Using cache ---> eba04ddf9385 Step 4/6 : ADD ./spring-boot-web-0.0.1-SNAPSHOT.jar . 2018/05/23 16:06:03 error while building: ADD failed: stat /var/lib/docker/tmp/docker-builder413350319/spring-boot-web-0.0.1-SNAPSHOT.jar: no such file or directory 2018/05/23 16:06:03 complete: failed to store build object for app "springboot_swagger_example-master-cassandra": ConfigMap "springboot_swagger_example-master-cassandra" is invalid: metadata.name: Invalid value: "springboot_swagger_example-master-cassandra": a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is 'a-z0-9?(.a-z0-9?)*')


For some reason, draft up , thinks that it needs to do: Step 4/6 : ADD ./spring-boot-web-0.0.1-SNAPSHOT.jar . 2018/05/23 16:06:03 error while building: ADD failed: stat /var/lib/docker/tmp/docker-builder413350319/spring-boot-web-0.0.1-SNAPSHOT.jar: no such file or directory 2018/05/23 16:06:03

Why the copying of the spring-boot-web-0.0.1-SNAPSHOT.jar file to /var/lib/docker/tmp/docker-413350319/spring-boot-web-0.0.1-SNAPSHOT.jar ? The problem is that draft doesn't have the authority to do this, so I am going to try:

% sudo draft up

quantum-fusion commented 6 years ago

sudo draft up, did not solve the problem:


draft logs 01CE79Y9FDD81KY4JR2999NXYW Step 1/6 : FROM java:8 ---> d23bdf5b1b1b Step 2/6 : MAINTAINER info@technologyventureslimited.com ---> Using cache ---> d23490ec5233 Step 3/6 : EXPOSE 8080 9042 ---> Using cache ---> eba04ddf9385 Step 4/6 : ADD ./spring-boot-web-0.0.1-SNAPSHOT.jar . 2018/05/23 16:10:03 error while building: ADD failed: stat /var/lib/docker/tmp/docker-builder502155586/spring-boot-web-0.0.1-SNAPSHOT.jar: no such file or directory 2018/05/23 16:10:03 complete: failed to store build object for app "springboot_swagger_example-master-cassandra": ConfigMap "springboot_swagger_example-master-cassandra" is invalid: metadata.name: Invalid value: "springboot_swagger_example-master-cassandra": a DNS-1123 subdomain must consist of lower case alphanumeric characters, '-' or '.', and must start and end with an alphanumeric character (e.g. 'example.com', regex used for validation is 'a-z0-9?(.a-z0-9?)*')

Does anyone have an idea of why draft up seeks to copy the jar file to the /tmp location?

quantum-fusion commented 6 years ago

2018/05/23 15:38:53 error while building: Error response from daemon: Cannot locate specified Dockerfile: Dockerfile. Note, this was resolved by copying the Dockerfile to the root directory.

This is the real problem: ADD failed: stat /var/lib/docker/tmp/docker-builder502155586/spring-boot-web-0.0.1-SNAPSHOT.jar: no such file or directory

quantum-fusion commented 6 years ago

These are the steps that I am using to test DRAFT.

%git clone https://github.com/quantum-fusion/springboot_swagger_example-master-cassandra

%mvn clean install -DskipTests

%draft create

%draft up


This is the real problem: ADD failed: stat /var/lib/docker/tmp/docker-builder502155586/spring-boot-web-0.0.1-SNAPSHOT.jar: no such file or directory

Why the copy to the /tmp directory? Why is draft up doing this? Is this a bug?

quantum-fusion commented 6 years ago

@radu-matei Why the copy to the /tmp directory? Why is draft up doing this? Is this a bug?

squillace commented 6 years ago

@quantum-fusion draft doesn't know anything about this specific example, so I would NOT expect it to work. I think this is a conceptual/documentation bug: the "standard" create draft packs aren't "generic" in the sense that they work for every application. Instead, they work for the bare-bones example application in the examples directory of the repo.

I'll clone the example you're using and see what changes need to be made for draft create --pack to work correctly. If you look at the Dockerfile that gets pulled in by default, you'll note that it doesn't match the application at all.

Draft tries to help you use the starter service apps to get you going, then you continue to iterate by making changes to the artifacts as you require them. If you started with one java file -- or whatever -- it might likely do that correctly. But unless you already have a draft pack that knows how to build your cassandra service, there's a good chance it won't work. Nothing's correct. Draft cannot guess (yet) how to build and configure any arbitrary app. Eventually, we hope that the community will have draft packs for these types of things just like we do for charts.

quantum-fusion commented 6 years ago

Thanks for the explanation, and this explains why draft create builds a python Dockerfile example. I have included here, a real Dockerfile that describes the application at hand.

quantum-fusion commented 6 years ago

The Dockerfile of interest is here: https://github.com/quantum-fusion/springboot_swagger_example-master-cassandra/blob/master/Dockerfile

quantum-fusion commented 6 years ago

@squillace Please let me know if you have any addition questions about getting this up and running.

These are the steps that I am using to test DRAFT.

%git clone https://github.com/quantum-fusion/springboot_swagger_example-master-cassandra

%mvn clean install -DskipTests

%draft create

%draft up

quantum-fusion commented 6 years ago

First off, my interest in using draft create, with the Dockerfile that I provided, was so that I could use draft create, to help me create the chart file directory, that I wouldn't otherwise be able to do easily.

Second, I am interested in the automation aspects of draft up, which allow me to upload the built docker image to the docker hub registry. Note, I otherwise have been using scripts to perform the upload to the docker hub registry. https://github.com/quantum-fusion/springboot_swagger_example-master-cassandra/blob/master/dockerbuild/upload.script

quantum-fusion commented 6 years ago

Ultimately my interest is in using helm install myApp to help me configure the settings in my pod file, but don't yet know how to do that from the command line, since Google claims that the arguments are immutable. https://github.com/quantum-fusion/springboot_swagger_example-master-cassandra/blob/master/Kubernetes/singlePod.yaml

I envision a simple process to launch helm install myApp --value singlePod.yaml from commandLine, but am unsure of the syntax to allow such a thing.

squillace commented 6 years ago

Not a problem. I'm running home now, but tonight I'll have a look at your specific app. :-)

quantum-fusion commented 6 years ago

@squillace You were right, draft, basically just spits out a sample Dockerfile for Python: FROM python:onbuild ENV PORT 8080 EXPOSE 8080 ENTRYPOINT ["python"] CMD ["app.py"]

Once I was able to figure that out, I provided mine: https://github.com/quantum-fusion/springboot_swagger_example-master-cassandra/blob/master/Dockerfile

quantum-fusion commented 6 years ago

1.) The issue of not being able to use draft up, to upload the Docker image that is built to DockerHub I view mainly to be a bug/defect. I think that should be resolvable, now that you have the steps to reproduce:

These are the steps that I am using to test DRAFT.

%git clone https://github.com/quantum-fusion/springboot_swagger_example-master-cassandra

%mvn clean install -DskipTests

%draft create

%draft up

2.) WishList --> Ultimately, If I could configure the parameters from commandLine using Helm install myApp --value singlePod.yaml, that would be great, because I want to configure these parameters from commandLine.

Problem is that Google states that configurability for Pods doesn't work, because Pod arguments are immutable, and templating is not allowed: I am trying to figure out what the helm command is, to install this package, and also to set the values for cassandra_ip, cassandra_port, login, and password , is this possible from command line?

quantum-fusion commented 6 years ago

1.) Helm Install MyApp --> I was hoping that Microsoft Draft could help me with creating the Chart files at least, which it created, but I haven't been able to test helm install myApp yet, and was hoping for some guidance.

2.) This in a vacuum of course isn't that useful without initializing the whole minikube without the singlePod.yaml file. For example, % kubectl create -f ./singlePod.yaml See example script: https://github.com/quantum-fusion/springboot_swagger_example-master-cassandra/blob/master/Kubernetes/kubectl.setup

quantum-fusion commented 6 years ago

Basically, the draft create command didn't do what I wanted to help create a Chart file. Like: https://docs.bitnami.com/kubernetes/how-to/create-your-first-helm-chart/

I tried these commands:

After I used % draft create.

helm install --dry-run --debug ./charts [debug] Created tunnel using local port: '54573'

[debug] SERVER: "127.0.0.1:54573"

[debug] Original chart version: "" [debug] CHART PATH: /Users/me/springboot_swagger_example-master-cassandra/charts

Error: no Chart.yaml exists in directory "/Users/me/springboot_swagger_example-master-cassandra/charts" MacBook-Pro-2:springboot_swagger_example-master-cassandra me$ cd chart -bash: cd: chart: No such file or directory MacBook-Pro-2:springboot_swagger_example-master-cassandra me$ cd charts MacBook-Pro-2:charts me$ ls python MacBook-Pro-2:charts me$ more python python is a directory MacBook-Pro-2:charts hottelet$ cd python MacBook-Pro-2:python me$ ls Chart.yaml charts templates values.yaml MacBook-Pro-2:python me$ more Chart.yaml apiVersion: v1 description: A Helm chart for Kubernetes name: python version: v0.1.0


@squillace I investigated and found that basically both draft create, and draft up, are assuming use of a Python simple project in all use cases, in the presence of a Maven pom.xml which is clearly a JAVA project.

squillace commented 6 years ago

@quantum-fusion draft up doesn't assume anything -- it merely uses whatever's in the repo at the time. I'm ready to try out this repo myself.

bacongobbler commented 6 years ago

If you look at the language statistics behind https://github.com/quantum-fusion/springboot_swagger_example-master-cassandra, linguist detects that the codebase is primarily 65% HTML, 17% Python and only 6% Java which is probably why it was determined to be a Python app.

This is because linguist is picking up the apache cassandra directory as part of your source code. To fix this, you can add a new field in your .gitattributes file to note that apache-cassandra-3.11.1/ is a vendored directory, like so:

apache-cassandra-3.11.1/ linguist-vendored

Once that's done, linguist (and by extension, Draft) will be able to pick up the primary programming language as Java.

><> cat .gitattributes
.gitignore text
.md text
apache-cassandra-3.11.1/ linguist-vendored
><> draft create
--> Draft detected Java (89.763960%)
--> Ready to sail

If you want to get a better picture on how Draft came to that decision in the future, you can run draft create with the --debug flag. :)

Sorry about that! More on how this all works can be found in https://github.com/Azure/draft/blob/master/docs/troubleshooting.md#my-repository-is-detected-as-the-wrong-language. Let us know if you have any other issues. :)

squillace commented 6 years ago

Yes. Even so, neither Draft nor Helm do what you mention here:

1.) Helm Install MyApp --> I was hoping that Microsoft Draft could help me with creating the Chart files at least, which it created, but I haven't been able to test helm install myApp yet, and was hoping for some guidance.

Draft will give you a chart for java per https://github.com/Azure/draft/issues/777#issuecomment-392975221, but the real problem is that you will STILL have to modify the chart files using the values from your deployment manifests. and you STILL will have to ensure that your DockerFile builds the container correctly. THEN you will have a chart that will do the same thing as the deployment manifests.

At that point, you can begin using draft to iterate and debug. But we still don't have an easy way to create a helm chart unless you already understand all your manifest files. Do you? If so, then you can read the chart docs on https://helm.sh and you should be able to modify the one draft gives you, OR create a helm chart from scratch.

Does that all make sense?

quantum-fusion commented 6 years ago

@squillace Do you have a chart example for JAVA for a hello world program that you can give me for DRAFT? A test case would be great if you have it, then we can work together on this DRAFT JAVA use case?

squillace commented 6 years ago

It's easier than that. Just go into your app, and type draft create --pack=java and you'll get a default java configuration. Now, you're going to need to modify:

  1. the DockerFile to including the proper .jars and files and so on specific to your app
  2. The charts/ files to include the proper values from the manifests that you already have. For details on the chart files and values, see the docs at https://helm.sh.

Have a look, and let me know if that makes sense once you look at them. Helm charts are just K8s manifests broken out into logical file separation (one for deployment, one for services, one for ingresses, and so on). Inside each of those files are go templating, which call in values from either the main template, the helpers.tpl file, but largerly from the values.yaml file. This is because by far the MOST COMMON values in a manifest are repeated all over, so it is much easier to specify them once in a values file and reuse them inside the chart files.

squillace commented 6 years ago

but if you want a sample java app that fits it, try azure/draft/examples/example-java.

quantum-fusion commented 6 years ago

@squillace The one that I will try is the draft/examples/example-spring-boot Lets see if it works with Draft, because the Dockerfile and Charts are not shipped with the build. This will be a great test case to see what Draft can do.

squillace commented 6 years ago

yeah, sure! Let's use this issue as a way of discussing your experience here. Once you get that Draft only knows what it can detect by way of language, you start realizing that it's not magic, it's just that the collective knowledge of apps and charts and kubernetes helps move devs past the first steps.

That said, you BET we are thinking about how we can do better detection/streamlining.

quantum-fusion commented 6 years ago

@squillace My best suggestions are if you detect a pom.xml then that means it is a JAVA project. If you detect an SBT project then it must be Scala. The Dockerfile could reside anywhere in the hierarchy and should not be generated if it already exists. I also noted a defect if the Dockerfile is a symbolic link, and it doesn't detect the Dockerfile at the correct part of the hierarchy. The nasty bug that reads properties from Git settings isn't really the right way to know if you have a JAVA project, and this should be an enhancement request. I will try the SpringBoot test case example to see what you are assuming as a base line.

squillace commented 6 years ago

linguist at the moment detects only coding language, so it knows nothing about pom.xml, and will likely never know whether that's a maven or gradle or that kind of thing. It's simply NOT a feature of the library to detect that.

so the larger question becomes, how does one detect random custom apps like yours? You know it's a "java" app, but because your repo contains all kinds of crap from other things, any detection library cannot possibly know that.

So, how would you do this, generally?

squillace commented 6 years ago

BTW, there are lots of java issues and this is a larger problem not only for java but definitely WITH it: https://github.com/Azure/draft/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+java. @arun-gupta has had several great points and we're working on a more general approach.

bacongobbler commented 6 years ago

I'll also give another example where code detection based on certain filenames being present in the codebase becomes a problem:

Ruby apps (Rails apps in particular) fairly commonly have a lot of javascript code in the root URL, such as a package.json, gulpfile.js, but they also contain Gemfiles, Rakefiles and whatnot. How do we determine from the codebase whether it's a javascript app containing ruby code or vice versa?

Jekyll sites also have the same problem; the actual code being deployed is statically generated HTML through jekyll build, however the codebase is primarily Ruby, Markdown and/or Javascript. draft create won't work here at all because the end result is code that doesn't exist in the codebase to begin with, so jekyll/hugo users have to run draft create with the --pack flag to get started.

I agree this is a larger general problem we are working on solving with regards to HOW people approach Draft and start using it to get productive writing their apps. We really appreciate your feedback, @quantum-fusion, so thank you. :)

quantum-fusion commented 6 years ago

@bacongobbler @squillace Why not include a command to tell the draft tools what type of project it is, for java, python, scala, ruby, etc. you could have a flag to help provide more intelligence as an option. Obviously you could still auto-detect language based on all kinds of stuff that is outside the scope of this feature request. The other complication is that some projects are multi language for example some JAVA projects include JSP pages which is javascript, however what to focus on is the build mechanism used for the project. For example a node.js application that is standalone is different than a JAVA project that may use JSP javascript pages embedded.

quantum-fusion commented 6 years ago

@squillace I tested the example-spring-boot project.

Started up Docker on MAC/OS.

This was the transcript of results:

minikube start helm init cd $HOME/draft/examples/example-spring-boot draft create draft up Draft Up Started: 'example-spring-boot': 01CESC1PTH7BPVD46TWC2H341R example-spring-boot: Building Docker Image: SUCCESS ⚓ (115.0699s) example-spring-boot: Pushing Docker Image: SUCCESS ⚓ (44.5014s) example-spring-boot: Releasing Application: SUCCESS ⚓ (2.3197s) Inspect the logs with draft logs 01CESC1PTH7BPVD46TWC2H341R

draft connect Error: cannot get pod with buildID 01CESC1PTH7BPVD46TWC2H341R: timed out

quantum-fusion commented 6 years ago

kubectl get pods NAME READY STATUS RESTARTS AGE cassandra-0 0/1 ImagePullBackOff 0 7d cassandra-1 0/1 Pending 0 7d example-java-java-3821510223-7z284 1/1 Running 1 7d example-python-python-3748734271-lmjcd 1/1 Running 1 7d example-spring-boot-java-3924634356-pm8bm 0/1 ImagePullBackOff 0 2m my-release-minecraft-1980511755-z5kt2 0/1 Pending 0 7d spring-boot-web-4126579859-jmphs 0/1 ImagePullBackOff 0 7d spring-boot-web-4126579859-pph77 0/1 ImagePullBackOff 0 7d

quantum-fusion commented 6 years ago

helm ls NAME REVISION UPDATED STATUS CHART NAMESPACE example-java 3 Sat May 19 09:38:59 2018 DEPLOYED java-v0.1.0 default
example-python 2 Wed May 23 13:45:36 2018 DEPLOYED python-v0.1.0 default
example-spring-boot 1 Wed May 30 16:35:33 2018 DEPLOYED java-v0.1.0 default
lopsided-donkey 1 Wed May 2 13:08:09 2018 DEPLOYED minecraft-0.2.1 default
my-release 1 Wed May 2 13:08:45 2018 DEPLOYED minecraft-0.2.1 default

quantum-fusion commented 6 years ago

draft history BUILD_ID CONTEXT_ID CREATED_AT RELEASE
01CESC1PTH7BPVD46TWC2H341R 5D0F650C99 Wed May 30 16:35:35 2018 example-spring-boot

quantum-fusion commented 6 years ago

kubectl -n kube-system get pod NAME READY STATUS RESTARTS AGE kube-addon-manager-minikube 1/1 Running 12 295d kube-dns-910330662-q1dc9 3/3 Running 37 295d kubernetes-dashboard-9tc2j 1/1 Running 13 295d registry-7fm7z 1/1 Running 1 7d tiller-deploy-420032274-ssdn0 1/1 Running 1 7d

squillace commented 6 years ago

first, re https://github.com/Azure/draft/issues/777#issuecomment-393265867: we DO! That's the draft create --pack command, wherein you tell it precisely what kind of app it is! All you'd do is create a draft-pack for that kind of app, put it in a repo, and then add the repo to draft with draft pack-repo add.

that functionality is already there. :-)

quantum-fusion commented 6 years ago

According to @radu-matei from #776 The main reasons draft connect times out: the pod it is trying to connect to is not in Ready state the pod annotation (with the build ID) and label is not correctly set in the Helm chart

@radu-matei @squillace However, after further testing, we find out that example-spring-boot-java is stuck in the ImagePullBackOff state, and this may explain the draft connect Error: cannot get pod with buildID 01CESC1PTH7BPVD46TWC2H341R: timed out

bacongobbler commented 6 years ago

yea I was just about to point that out

what's the output of kubectl describe po example-spring-boot-java-3924634356-pm8bm?

quantum-fusion commented 6 years ago

@squillace Basically I compared the results of the example-python to the example-spring-boot-java tests, and the python test case passed with flying colors, after @radu-matei had helped me debug the killing of pods that were resource hogs. The example-spring-boot-java test case however times out.

See trace files requested by @bacongobbler

kubectl describe po example-spring-boot-java-3924634356-pm8bm Name: example-spring-boot-java-3924634356-pm8bm Namespace: default Node: minikube/192.168.64.3 Start Time: Wed, 30 May 2018 16:35:33 -0400 Labels: app=example-spring-boot-java draft=example-spring-boot pod-template-hash=3924634356 Annotations: buildID=01CESC1PTH7BPVD46TWC2H341R kubernetes.io/created-by={"kind":"SerializedReference","apiVersion":"v1","reference":{"kind":"ReplicaSet","namespace":"default","name":"example-spring-boot-java-3924634356","uid":"00372a4f-6449-11e8-8... Status: Pending IP: 172.17.0.11 Controllers: ReplicaSet/example-spring-boot-java-3924634356 Containers: java: Container ID:
Image: docker.io/joethecoder2/example-spring-boot:6d0dd3b2de3a10a201d7d8328d4afd4c74366d1d Image ID:
Port: 4567/TCP State: Waiting Reason: ImagePullBackOff Ready: False Restart Count: 0 Limits: cpu: 100m memory: 128Mi Requests: cpu: 100m memory: 128Mi Environment: Mounts: /var/run/secrets/kubernetes.io/serviceaccount from default-token-wgdn6 (ro) Conditions: Type Status Initialized True Ready False PodScheduled True Volumes: default-token-wgdn6: Type: Secret (a volume populated by a Secret) SecretName: default-token-wgdn6 Optional: false QoS Class: Guaranteed Node-Selectors: Tolerations: Events: FirstSeen LastSeen Count From SubObjectPath Type Reason Message


16m 16m 1 default-scheduler Normal Scheduled Successfully assigned example-spring-boot-java-3924634356-pm8bm to minikube 16m 16m 1 kubelet, minikube Normal SuccessfulMountVolume MountVolume.SetUp succeeded for volume "default-token-wgdn6" 15m 3m 5 kubelet, minikube spec.containers{java} Normal Pulling pulling image "docker.io/joethecoder2/example-spring-boot:6d0dd3b2de3a10a201d7d8328d4afd4c74366d1d" 13m 1m 5 kubelet, minikube spec.containers{java} Warning Failed Failed to pull image "docker.io/joethecoder2/example-spring-boot:6d0dd3b2de3a10a201d7d8328d4afd4c74366d1d": rpc error: code = 2 desc = Network timed out while trying to connect to https://index.docker.io/v1/repositories/joethecoder2/example-spring-boot/images. You may want to check your internet connection or if you are behind a proxy. 13m 6s 22 kubelet, minikube Warning FailedSync Error syncing pod 13m 6s 17 kubelet, minikube spec.containers{java} Normal BackOff Back-off pulling image "docker.io/joethecoder2/example-spring-boot:6d0dd3b2de3a10a201d7d8328d4afd4c74366d1d"

bacongobbler commented 6 years ago

boot:6d0dd3b2de3a10a201d7d8328d4afd4c74366d1d": rpc error: code = 2 desc = Network timed out while trying to connect to https://index.docker.io/v1/repositories/joethecoder2/example-spring-boot/images. You may want to check your internet connection or if you are behind a proxy.

there's our smoking gun :)

hmm, does your k8s cluster have a working connection to dockerhub? might be a network blip or something.

quantum-fusion commented 6 years ago

@squillace @radu-matei The example project was loaded here: https://hub.docker.com/r/joethecoder2/example-spring-boot/

@radu-matei draft connect Error: cannot get pod with buildID 01CESC1PTH7BPVD46TWC2H341R: timed out

@radu-matei @squillace Any idea why the java project example for spring boot would be timed out?

bacongobbler commented 6 years ago

because that image is definitely there: https://hub.docker.com/r/joethecoder2/example-spring-boot/tags/

squillace commented 6 years ago

@bacongobbler here's what I got against AKS:

╭─ralph at surfacebook in ~ using
╰─○ k logs example-spring-boot-java-cc767bcf4-k2fm8
kError: -jar requires jar file specification
quantum-fusion commented 6 years ago

@bacongobbler I am trying to run a check to see if docker.io is there. Do you see it?

ping index.docker.io PING us-east-1-elbio-rm5bon1qaeo4-623296237.us-east-1.elb.amazonaws.com (54.84.81.66): 56 data bytes Request timeout for icmp_seq 0 Request timeout for icmp_seq 1 Request timeout for icmp_seq 2 Request timeout for icmp_seq 3 Request timeout for icmp_seq 4 Request timeout for icmp_seq 5 Request timeout for icmp_seq 6 Request timeout for icmp_seq 7 Request timeout for icmp_seq 8 Request timeout for icmp_seq 9

squillace commented 6 years ago

image

quantum-fusion commented 6 years ago

@squillace @bacongobbler I had to do a mvn clean install, because for some reason after that was done, the draft up, followed by draft connect gave results. draft up Draft Up Started: 'example-spring-boot': 01CESDJD6963H1D6PBQDNV7HNV example-spring-boot: Building Docker Image: SUCCESS ⚓ (1.0005s) example-spring-boot: Pushing Docker Image: SUCCESS ⚓ (2.7386s) example-spring-boot: Releasing Application: SUCCESS ⚓ (2.5002s) Inspect the logs with draft logs 01CESDJD6963H1D6PBQDNV7HNV Henrys-MacBook-Pro-2:example-spring-boot hottelet$ draft connect Connect to java:4567 on localhost:51887 java: Error: -jar requires jar file specification java: Usage: java [-options] class args...: (to execute a class) java: or java [-options] -jar jarfile args...: (to execute a jar file) java: where options include: java: -d32 use a 32-bit data model if available java: -d64 use a 64-bit data model if available java: -server to select the "server" VM java: -zero to select the "zero" VM java: -dcevm to select the "dcevm" VM java: The default VM is server, java: because you are running on a server-class machine. java: java: java: -cp <class search path of directories and zip/jar files> java: -classpath <class search path of directories and zip/jar files> java: A : separated list of directories, JAR archives, java: and ZIP archives to search for class files.

java: set a system property

java: enable verbose output java: -version print product version and exit

java: Warning: this feature is deprecated and will be removed java: in a future release. java: require the specified version to run java: -showversion print product version and continue java: -jre-restrict-search | -no-jre-restrict-search java: Warning: this feature is deprecated and will be removed java: in a future release. java: include/exclude user private JREs in the version search java: -? -help print this help message java: -X print help on non-standard options

java: enable assertions with specified granularity

java: disable assertions with specified granularity java: -esa | -enablesystemassertions java: enable system assertions java: -dsa | -disablesystemassertions java: disable system assertions

java: load native agent library , e.g. -agentlib:hprof java: see also, -agentlib:jdwp=help and -agentlib:hprof=help

java: load native agent library by full pathname

java: load Java programming language agent, see java.lang.instrument

java: show splash screen with specified image java: See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.

quantum-fusion commented 6 years ago

@squillace @bacongobbler draft connect tried to bring up the service example, on port 4567 but failed.

%curl localhost:4567 curl: (7) Failed to connect to localhost port 4567: Connection refused

radu-matei commented 6 years ago

@quantum-fusion - that's because the process inside your application is not running (same issue as in @squillace's photo above)

draft connect assumes that the process inside the container is listening on the port forwarded - in your case, since that process is not running, the connection is refused.

quantum-fusion commented 6 years ago

@squillace Is on to something, he is right.

draft connect Connect to java:4567 on localhost:52329 [java]: Error: -jar requires jar file specification

@radu-matei Why wouldn't the process inside the application not be running, after draft up was executed? Is there another command to execute before draft connect?

squillace commented 6 years ago

yeah, hang on. The dockerfile is incorrect for some reason. When we get a chance to look at it, we'll fix it. you cannot connect to a process that isn't working properly. it's a bug in the example, and that needs to be fixed. you did all the right things here.

quantum-fusion commented 6 years ago

@squillace This is the docker file that was created by draft create for /draft/examples/example-spring-boot.

more Dockerfile FROM maven:3.5-jdk-8 as BUILD

COPY . /usr/src/app RUN mvn --batch-mode -f /usr/src/app/pom.xml clean package

FROM openjdk:8-jdk ENV PORT 4567 EXPOSE 4567 COPY --from=BUILD /usr/src/app/target /opt/target WORKDIR /opt/target

CMD ["/bin/bash", "-c", "find -type f -name '*-with-dependencies.jar' | xargs java -jar"]