|
19 | 19 |
|
20 | 20 | # Apache OpenWhisk runtimes for java |
21 | 21 |
|
22 | | -[](https://travis-ci.org/apache/incubator-openwhisk-runtime-java) |
| 22 | +[](https://travis-ci.org/apache/openwhisk-runtime-java) |
23 | 23 |
|
24 | 24 | ## Changelogs |
25 | 25 | - [Java 8 CHANGELOG.md](core/java8/CHANGELOG.md) |
@@ -94,19 +94,40 @@ wsk action invoke --result helloJava --param name World |
94 | 94 | ``` |
95 | 95 |
|
96 | 96 | ## Local development |
| 97 | + |
| 98 | +### Pre-requisites |
| 99 | +- Gradle |
| 100 | +- Docker Desktop (local builds) |
| 101 | + |
| 102 | +### Build and Push image to a local Docker registry |
| 103 | + |
| 104 | +1. Start Docker Desktop (i.e., Docker daemon) |
| 105 | + |
| 106 | +2. Build the Docker runtime image locally using Gradle: |
97 | 107 | ``` |
98 | 108 | ./gradlew core:java8:distDocker |
99 | 109 | ``` |
100 | | -This will produce the image `whisk/java8action` |
| 110 | +This will produce the image `whisk/java8action` and push it to the local Docker Desktop registry with the `latest` tag. |
| 111 | + |
| 112 | +3. Verify the image was registered: |
| 113 | +``` |
| 114 | +$ docker images whisk/* |
| 115 | +REPOSITORY TAG IMAGE ID CREATED SIZE |
| 116 | +whisk/java8action latest 35f90453905a 7 minutes ago 521MB |
| 117 | +``` |
| 118 | + |
| 119 | +### Build and Push image to a remote Docker registry |
101 | 120 |
|
102 | | -Build and Push image |
| 121 | +Build the Docker runtime image locally using Gradle supplying the image Prefix and Registry domain (default port): |
103 | 122 | ``` |
104 | 123 | docker login |
105 | 124 | ./gradlew core:java8:distDocker -PdockerImagePrefix=$prefix-user -PdockerRegistry=docker.io |
106 | 125 | ``` |
107 | 126 |
|
| 127 | +## Deploying the Java runtime image to OpenWhisk |
| 128 | + |
108 | 129 | Deploy OpenWhisk using ansible environment that contains the kind `java:8` |
109 | | -Assuming you have OpenWhisk already deploy locally and `OPENWHISK_HOME` pointing to root directory of OpenWhisk core repository. |
| 130 | +Assuming you have OpenWhisk already deployed locally and `OPENWHISK_HOME` pointing to root directory of OpenWhisk core repository. |
110 | 131 |
|
111 | 132 | Set `ROOTDIR` to the root directory of this repository. |
112 | 133 |
|
@@ -159,7 +180,35 @@ wsk action update helloJava hello.jar --main Hello --docker $user_prefix/java8ac |
159 | 180 | ``` |
160 | 181 | The `$user_prefix` is usually your dockerhub user id. |
161 | 182 |
|
| 183 | +--- |
| 184 | + |
| 185 | +# Troubleshooting |
| 186 | + |
| 187 | +### Gradle build fails with "Too many files open" |
| 188 | + |
| 189 | +This may occur on MacOS as the default maximum # of file handles per session is `256`. The gradle build requires many more and is unable to open more files (e.g., `java.io.FileNotFoundException`). For example, you may see something like: |
| 190 | + |
| 191 | +``` |
| 192 | +> java.io.FileNotFoundException: /Users/XXX/.gradle/caches/4.6/scripts-remapped/build_4mpzm2wl8gipqoxzlms7n6ctq/7gdodk7z6t5iivcgfvflmhqsm/cp_projdf5583fde4f7f1f2f3f5ea117e2cdff1/cache.properties (Too many open files) |
| 193 | +
|
| 194 | +``` |
| 195 | +You can see this limit by issuing: |
| 196 | +``` |
| 197 | +$ ulimit -a |
| 198 | +open files (-n) 256 |
| 199 | +``` |
| 200 | + |
| 201 | +In order to increase the limit, open a new terminal session and issue the command (and verify): |
| 202 | +``` |
| 203 | +$ ulimit -n 10000 |
| 204 | +
|
| 205 | +$ ulimit -a |
| 206 | +open files (-n) 10000 |
| 207 | +``` |
| 208 | + |
| 209 | +### Gradle Task fails on `:core:java8:tagImage` |
162 | 210 |
|
| 211 | +Docker daemon is not started and the Task is not able to push the image to your local registry. |
163 | 212 |
|
164 | 213 | # License |
165 | 214 | [Apache 2.0](LICENSE.txt) |
0 commit comments