Skip to content

Commit 37a9632

Browse files
author
Carlos Santana
committed
Configure as stand-alone repo
1 parent 85757ba commit 37a9632

18 files changed

Lines changed: 394 additions & 68 deletions

File tree

.travis.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
sudo: required
2+
group: deprecated-2017Q3
3+
language: scala
4+
scala:
5+
- 2.11.8
6+
services:
7+
- docker
8+
before_install:
9+
- "./tools/travis/setup.sh"
10+
install: true
11+
script:
12+
- "./tools/travis/build.sh && ./tools/travis/build_sdk.sh && ./tools/travis/deploy.sh && ./tools/travis/test.sh"
13+
before_deploy:
14+
- "./tools/travis/rename_sdk.sh ${TRAVIS_TAG%@*} ${TRAVIS_TAG##*@}"
15+
deploy:
16+
- provider: script
17+
script: "./tools/travis/publish.sh csantanapr ${TRAVIS_TAG%@*} ${TRAVIS_TAG##*@}"
18+
on:
19+
tags: true
20+
all_branches: true
21+
condition: "${TRAVIS_TAG%@*} = dockerskeleton"
22+
- provider: releases
23+
api_key:
24+
secure: "q8erbGUKDQcrEe4H1DT0UDHnbTb7eNP4RkM3K6VIT+lfLRHJBKlVLW5MepQugyLVdJGAuvKR60pEAjTzTeRf6yy/fARvq+CQk4Kqy5rBJdvbCkCIAL+kvdFx1HJ/4YZ0rNFQf41uNpONf4bAv7fX7E2KprXgLSZ0HSEuMLD5v4FGQ8OaxOMmFVSEFOYuzUD/UdX/xTx6XMmmwIXu3NxNQeOxbOlcZMalF4NQS+tOIFVDPfprRFIyVkORfdS+yfhEZ8PjtyZ9h+oDvRiqxIP/8LVcNuuxSnShPN/hx55rE79XJc6OC74LSOa2aKRvKlcYnSZBMj+FtIj4/VCjkcSb5tEvr96243lXzg0nKCaEY9dQZ1mk0Qbw7mSo5abXqOSNqVR5y6zEw1Tc/n+h1YGoanacw4a9goueOn8cGygHvncIi4G9ctnyQ3Q6q46eMR6E1x6OCxwDmcokze//NFSflU25E2Dcq2VWE2NStofUyjETIo0JBzxbuQpMmbMQDafLh2bYLirKDE0L6O3H5cr6bCZsPfatsDjR3YGi4uIE79IdWT9hEHTDlIE4Bs48Y/+fZqOJwGiIJwk3H5KI9exXsjFS0K/njW3RP/EeYAB6sBF3+H9HhR1nZo8BZvh6cGPy8iBjwuodlvmCuklXsZKnW25V0a8bEAMFSwxWF5rhKvU="
25+
overwrite: true
26+
skip_cleanup: true
27+
file: "./build/blackbox-${TRAVIS_TAG##*@}.tar.gz"
28+
on:
29+
tags: true
30+
all_branches: true
31+
condition: "${TRAVIS_TAG%@*} = sdk"
32+

README.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Apache OpenWhisk runtimes for nodejs
2+
[![Build Status](https://travis-ci.org/apache/incubator-openwhisk-runtime-docker.svg?branch=master)](https://travis-ci.org/apache/incubator-openwhisk-runtime-docker)
3+
4+
5+
### Give it a try today
6+
Create a zip action with a `exec` in the root of the zip
7+
```
8+
echo \
9+
'#!/bin/bash
10+
echo "{\"messag\":\"Hello World\"}"' > exec
11+
```
12+
```
13+
chmod +x exec
14+
zip myAction.zip exec
15+
```
16+
17+
Create the action using the docker image for the runtime
18+
```
19+
wsk action update myAction myAction.zip --docker openwhisk/dockerskeleton:1.0.0
20+
```
21+
22+
This works on any deployment of Apache OpenWhisk
23+
24+
### To use on a deployment that contains the runtime deployed
25+
26+
Create action using `--native`
27+
```
28+
wsk action update myAction myAction.zip --native
29+
```
30+
31+
### Local development
32+
```
33+
./gradlew :core:actionProxy:distDocker :sdk:docker:distDocker
34+
```
35+
This will produce the image `whisk/dockerskeleton`
36+
37+
Build and Push image
38+
```
39+
docker login
40+
./gradlew core:actionProxy:distDocker -PdockerImagePrefix=$prefix-user -PdockerRegistry=docker.io
41+
```
42+
43+
Deploy OpenWhisk using ansible environment that contains the runtime of type `blackboxes` with name `dockerskeleton`
44+
Assuming you have OpenWhisk already deploy localy and `OPENWHISK_HOME` pointing to root directory of OpenWhisk core repository.
45+
46+
Set `ROOTDIR` to the root directory of this repository.
47+
48+
Redeploy OpenWhisk
49+
```
50+
cd $OPENWHISK_HOME/ansible
51+
ANSIBLE_CMD="ansible-playbook -i ${ROOTDIR}/ansible/environments/local"
52+
$ANSIBLE_CMD setup.yml
53+
$ANSIBLE_CMD couchdb.yml
54+
$ANSIBLE_CMD initdb.yml
55+
$ANSIBLE_CMD wipe.yml
56+
$ANSIBLE_CMD openwhisk.yml
57+
```
58+
59+
Or you can use `wskdev` and create a soft link to the target ansible environment, for example:
60+
```
61+
ln -s ${ROOTDIR}/ansible/environments/local ${OPENWHISK_HOME}/ansible/environments/local-docker
62+
wskdev fresh -t local-docker
63+
```
64+
65+
To use as docker action push to your own dockerhub account
66+
```
67+
docker tag whisk/dockerskeleton $user_prefix/dockerskeleton
68+
docker push $user_prefix/dockerskeleton
69+
```
70+
Then create the action using your image from dockerhub
71+
```
72+
wsk action update myAction myAction.zip --docker $user_prefix/dockerskeleton
73+
```
74+
The `$user_prefix` is usually your dockerhub user id.
75+
76+
77+
78+
# License
79+
[Apache 2.0](LICENSE.txt)
80+
81+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
whisk_version_name: local
2+
config_root_dir: /tmp
3+
whisk_logs_dir: /tmp/wsklogs
4+
docker_registry: ""
5+
docker_dns: ""
6+
7+
db_prefix: whisk_local_
8+
9+
# Auto lookup to find the db credentials
10+
db_provider: "{{ lookup('ini', 'db_provider section=db_creds file={{ playbook_dir }}/db_local.ini') }}"
11+
db_username: "{{ lookup('ini', 'db_username section=db_creds file={{ playbook_dir }}/db_local.ini') }}"
12+
db_password: "{{ lookup('ini', 'db_password section=db_creds file={{ playbook_dir }}/db_local.ini') }}"
13+
db_protocol: "{{ lookup('ini', 'db_protocol section=db_creds file={{ playbook_dir }}/db_local.ini') }}"
14+
db_host: "{{ lookup('ini', 'db_host section=db_creds file={{ playbook_dir }}/db_local.ini') }}"
15+
db_port: "{{ lookup('ini', 'db_port section=db_creds file={{ playbook_dir }}/db_local.ini') }}"
16+
17+
# API GW connection configuration
18+
apigw_auth_user: ""
19+
apigw_auth_pwd: ""
20+
apigw_host_v2: "http://{{ groups['apigateway']|first }}:{{apigateway.port.api}}/v2"
21+
22+
controller_arguments: '-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=1098'
23+
invoker_arguments: "{{ controller_arguments }}"
24+
25+
invoker_allow_multiple_instances: true
26+
27+
runtimes_manifest:
28+
defaultImagePrefix: "openwhisk"
29+
defaultImageTag: "latest"
30+
runtimes:
31+
nodejs:
32+
- kind: "nodejs:6"
33+
default: true
34+
image:
35+
name: "nodejs6action"
36+
deprecated: false
37+
blackboxes:
38+
- name: "dockerskeleton"

ansible/environments/local/hosts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
; the first parameter in a host is the inventory_hostname
2+
3+
; used for local actions only
4+
ansible ansible_connection=local
5+
6+
[edge]
7+
172.17.0.1 ansible_host=172.17.0.1 ansible_connection=local
8+
9+
[controllers]
10+
controller0 ansible_host=172.17.0.1 ansible_connection=local
11+
12+
[kafka]
13+
172.17.0.1 ansible_host=172.17.0.1 ansible_connection=local
14+
15+
[invokers]
16+
invoker0 ansible_host=172.17.0.1 ansible_connection=local
17+
18+
; db group is only used if db_provider is CouchDB
19+
[db]
20+
172.17.0.1 ansible_host=172.17.0.1 ansible_connection=local
21+
22+
[redis]
23+
172.17.0.1 ansible_host=172.17.0.1 ansible_connection=local
24+
25+
[apigateway]
26+
172.17.0.1 ansible_host=172.17.0.1 ansible_connection=local

sdk/docker/build_tgz.sh

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
set -ex
3+
4+
SCRIPTDIR=$(cd $(dirname "$0") && pwd)
5+
ROOTDIR="${SCRIPTDIR}/../.."
6+
BUILDOUTPUTDIR="${ROOTDIR}/build"
7+
BUILDOUTPUT=$1
8+
BUILDOUTPUT=${BUILDOUTPUT:="blackbox-0.1.0.tar.gz"}
9+
10+
BUILDTMPDIR=`mktemp -d`
11+
mkdir -p ${BUILDTMPDIR}/dockerSkeleton
12+
13+
cp -a \
14+
${SCRIPTDIR}/buildAndPush.sh \
15+
${SCRIPTDIR}/Dockerfile \
16+
${SCRIPTDIR}/example.c \
17+
${SCRIPTDIR}/README.md \
18+
${BUILDTMPDIR}/dockerSkeleton
19+
20+
21+
sed -i -e 's/FROM dockerskeleton/FROM openwhisk\/dockerskeleton/' ${BUILDTMPDIR}/dockerSkeleton/Dockerfile
22+
cat ${BUILDTMPDIR}/dockerSkeleton/Dockerfile
23+
chmod +x ${BUILDTMPDIR}/dockerSkeleton/buildAndPush.sh
24+
25+
mkdir -p ${BUILDOUTPUTDIR}
26+
pushd ${BUILDTMPDIR}
27+
tar -czf ${BUILDOUTPUTDIR}/${BUILDOUTPUT} dockerSkeleton
28+
ls ${BUILDTMPDIR}/dockerSkeleton
29+
ls -lh ${BUILDOUTPUTDIR}/${BUILDOUTPUT}
30+

settings.gradle

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,20 @@
1-
include 'common:scala'
1+
def owPath = System.getenv("OPENWHISK_HOME") ?: '../open'
2+
def owDirectory = new File(owPath)
23

3-
include 'core:controller'
4-
include 'core:invoker'
5-
include 'core:nodejsActionBase'
6-
include 'core:nodejs6Action'
7-
include 'core:actionProxy'
8-
include 'core:pythonAction'
9-
include 'core:python2Action'
10-
include 'core:swift3Action'
11-
include 'core:swift3.1.1Action'
12-
include 'core:javaAction'
13-
include 'core:php7.1Action'
4+
include 'common:scala'; project(':common:scala').projectDir = new File(owDirectory, 'common/scala')
5+
include 'core:controller'; project(':core:controller').projectDir = new File(owDirectory, 'core/controller')
6+
include 'core:invoker'; project(':core:invoker').projectDir = new File(owDirectory, 'core/invoker')
7+
include 'whisktests'; project(':whisktests').projectDir = new File(owDirectory, 'tests')
148

15-
include 'tools:cli'
9+
include 'tests'
1610

1711
include 'sdk:docker'
12+
include 'core:actionProxy'
1813

19-
include 'tests'
2014
include 'tests:dat:blackbox:badaction'
2115
include 'tests:dat:blackbox:badproxy'
2216

23-
rootProject.name = 'openwhisk'
17+
rootProject.name = 'runtime-docker'
2418

2519
gradle.ext.scala = [
2620
version: '2.11.8',

tests/build.gradle

Lines changed: 4 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ apply plugin: 'scala'
22
apply plugin: 'eclipse'
33
compileTestScala.options.encoding = 'UTF-8'
44

5+
evaluationDependsOn(':whisktests')
6+
57
repositories {
68
mavenCentral()
79
}
810

911
tasks.withType(Test) {
10-
systemProperties(System.getProperties())
11-
1212
testLogging {
1313
events "passed", "skipped", "failed"
1414
showStandardStreams = true
@@ -17,63 +17,18 @@ tasks.withType(Test) {
1717
outputs.upToDateWhen { false } // force tests to run every time
1818
}
1919

20-
task testLean(type: Test) {
21-
exclude '**/*Swift*'
22-
exclude '**/*Python*'
23-
exclude '**/*Java*'
24-
exclude '**/*ThrottleTests*'
25-
exclude '**/MaxActionDurationTests*'
26-
exclude '**/*ApiGwTests*'
27-
}
28-
2920
// Add all images needed for local testing here
3021
test.dependsOn([
31-
':core:nodejs6Action:distDocker',
32-
':core:actionProxy:distDocker',
33-
':core:pythonAction:distDocker',
34-
':core:python2Action:distDocker',
35-
':core:javaAction:distDocker',
36-
':core:swift3Action:distDocker',
37-
':core:swift3.1.1Action:distDocker',
38-
':sdk:docker:distDocker',
3922
':tests:dat:blackbox:badaction:distDocker',
4023
':tests:dat:blackbox:badproxy:distDocker'
4124
])
4225

4326
dependencies {
4427
compile "org.scala-lang:scala-library:${gradle.scala.version}"
45-
compile 'org.apache.commons:commons-lang3:3.3.2'
46-
compile 'org.apache.httpcomponents:httpclient:4.5.2:tests'
47-
compile 'org.apache.httpcomponents:httpmime:4.3.6'
48-
compile 'junit:junit:4.11'
49-
compile 'com.jayway.restassured:rest-assured:2.6.0'
50-
compile 'org.scalatest:scalatest_2.11:3.0.1'
51-
compile 'com.typesafe.akka:akka-testkit_2.11:2.5.4'
52-
compile 'com.google.code.gson:gson:2.3.1'
53-
compile 'org.scalamock:scalamock-scalatest-support_2.11:3.4.2'
54-
compile 'com.typesafe.akka:akka-testkit_2.11:2.4.16'
55-
compile 'com.typesafe.akka:akka-http-testkit_2.11:10.0.10'
56-
compile 'com.github.java-json-tools:json-schema-validator:2.2.8';
57-
58-
compile project(':common:scala')
59-
compile project(':core:controller')
60-
compile project(':core:invoker')
28+
compile project(':whisktests')
29+
compile project(':whisktests').sourceSets.test.output
6130
}
6231

6332
tasks.withType(ScalaCompile) {
6433
scalaCompileOptions.additionalParameters = gradle.scala.compileFlags
6534
}
66-
67-
def keystorePath = new File(sourceSets.test.scala.outputDir, 'keystore')
68-
task deleteKeystore(type: Delete) {
69-
delete keystorePath
70-
}
71-
task createKeystore(dependsOn: deleteKeystore) {
72-
doLast {
73-
Properties props = new Properties()
74-
props.load(new FileInputStream(file('../whisk.properties')))
75-
def cmd = ['keytool', '-import', '-alias', 'Whisk', '-noprompt', '-trustcacerts', '-file', file(props['whisk.ssl.cert']), '-keystore', keystorePath, '-storepass', 'openwhisk']
76-
cmd.execute().waitForProcessOutput(System.out, System.err)
77-
}
78-
}
79-
compileTestScala.finalizedBy createKeystore

tests/src/test/scala/actionContainers/ActionContainer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
package actionContainers
18+
package runtime.actionContainers
1919

2020
import java.io.ByteArrayOutputStream
2121
import java.io.File

tests/src/test/scala/actionContainers/ActionProxyContainerTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
package actionContainers
18+
package runtime.actionContainers
1919

2020
import java.io.File
2121
import java.util.Base64

tests/src/test/scala/actionContainers/DockerExampleContainerTests.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
*/
1717

18-
package actionContainers
18+
package runtime.actionContainers
1919

2020
import java.util.concurrent.TimeoutException
2121

0 commit comments

Comments
 (0)