changed mind, back to hello-{lang} for better naming of tutorial

This commit is contained in:
Chad Arimura
2017-06-05 14:27:30 -07:00
parent fea5fbf7b0
commit c8fab6f224
7 changed files with 63 additions and 54 deletions

View File

@@ -6,7 +6,7 @@ This example will show you how to test and deploy Go (Golang) code to Oracle Fun
```sh ```sh
# Initialize your function creating a func.yaml file # Initialize your function creating a func.yaml file
fn init <DOCKERHUB_USERNAME>/go fn init <DOCKERHUB_USERNAME>/hello-go
# Test your function. This will run inside a container exactly how it will on the server # Test your function. This will run inside a container exactly how it will on the server
fn run fn run
@@ -18,18 +18,19 @@ cat sample.payload.json | fn run
# This will create a route to your function as well # This will create a route to your function as well
fn deploy myapp fn deploy myapp
``` ```
### Now call your function: ### Now call your function:
```sh ```sh
curl http://localhost:8080/r/myapp/go curl http://localhost:8080/r/myapp/hello-go
``` ```
Or call from a browser: [http://localhost:8080/r/myapp/go](http://localhost:8080/r/myapp/go) Or call from a browser: [http://localhost:8080/r/myapp/go](http://localhost:8080/r/myapp/hello-go)
And now with the JSON input: And now with the JSON input:
```sh ```sh
curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/go curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/hello-go
``` ```
That's it! That's it!

View File

@@ -1,43 +1,51 @@
# Oracle Functions: Java # Oracle Functions: Java
This is a hello world example of a Oracle Function using the Java runtime. This example will show you how to test and deploy Java code to Oracle Functions. It will also demonstrate passing data in through stdin.
Firstly, we initialize our function by creating a `func.yaml` using `fn init`. This command can optionally take a `--runtime` flag to explicitly specify the target function runtime. In this example, the target runtime is implied to be Java because there is a `Func.java` file in the working directory. ### First, run the following commands:
```sh ```sh
$ fn init <YOUR_DOCKERHUB_USERNAME>/hello-java # Initialize your function creating a func.yaml file
fn init <DOCKERHUB_USERNAME>/hello-go
# Test your function. This will run inside a container exactly how it will on the server
fn run
# Now try with an input
echo "Michael FassBender" | fn run
# Deploy your functions to the Oracle Functions server (default localhost:8080)
# This will create a route to your function as well
fn deploy myapp
``` ```
This is what our `func.yaml` looks like now. ### Now call your function:
```
name: mhaji/hello-java
version: 0.0.1
runtime: java
entrypoint: java Func
path: /hello-java
max_concurrency: 1
```
Next, we build and run our function using `fn run`.
```sh ```sh
$ fn run curl http://localhost:8080/r/myapp/hello-java
Hello, world!
``` ```
You can also pipe input via `stdin` into to the function as follows: Or call from a browser: [http://localhost:8080/r/myapp/hello-java](http://localhost:8080/r/myapp/hello-java)
```sh That's it!
$ echo "Michael FassBender" | fn run
Hello Michael FassBender!
```
To execute your function via a HTTP trigger:
```sh # In Review
fn apps create myapp
fn routes create myapp /hello 1. We passed in data through stdin
curl -H "Content-Type: text/plain" -X POST -d "Michael FassBender" http://localhost:8080/r/myapp/hello ```sh
``` echo "Michael FassBender" | fn run
```
2. We received our function input through **stdin**
```go
String name = bufferedReader.readLine();
```
3. We wrote our output to **stdout**
```go
System.out.println("Hello, " + name + "!");
```
# Next Up
## [Tutorial 2: Input Parameters](examples/tutorial/params)

View File

@@ -6,7 +6,7 @@ This example will show you how to test and deploy Node code to Oracle Functions.
```sh ```sh
# Initialize your function creating a func.yaml file # Initialize your function creating a func.yaml file
fn init <DOCKERHUB_USERNAME>/node fn init <DOCKERHUB_USERNAME>/hello-node
# Test your function. # Test your function.
# This will run inside a container exactly how it will on the server. It will also install and vendor dependencies from Gemfile # This will run inside a container exactly how it will on the server. It will also install and vendor dependencies from Gemfile
@@ -22,15 +22,15 @@ fn deploy myapp
### Now call your function: ### Now call your function:
```sh ```sh
curl http://localhost:8080/r/myapp/node curl http://localhost:8080/r/myapp/hello-node
``` ```
Or call from a browser: [http://localhost:8080/r/myapp/node](http://localhost:8080/r/myapp/node) Or call from a browser: [http://localhost:8080/r/myapp/hello-node](http://localhost:8080/r/myapp/hello-node)
And now with the JSON input: And now with the JSON input:
```sh ```sh
curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/node curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/hello-node
``` ```
That's it! Our `fn deploy` packaged our function and sent it to the Oracle Functions server. Try editing `func.js` That's it! Our `fn deploy` packaged our function and sent it to the Oracle Functions server. Try editing `func.js`

View File

@@ -6,7 +6,7 @@ This example will show you how to test and deploy PHP code to Oracle Functions.
```sh ```sh
# Initialize your function creating a func.yaml file # Initialize your function creating a func.yaml file
fn init <DOCKERHUB_USERNAME>/php fn init <DOCKERHUB_USERNAME>/hello-php
# Test your function. # Test your function.
# This will run inside a container exactly how it will on the server. It will also install and vendor dependencies from Gemfile # This will run inside a container exactly how it will on the server. It will also install and vendor dependencies from Gemfile
@@ -22,15 +22,15 @@ fn deploy myapp
### Now call your function: ### Now call your function:
```sh ```sh
curl http://localhost:8080/r/myapp/php curl http://localhost:8080/r/myapp/hello-php
``` ```
Or call from a browser: [http://localhost:8080/r/myapp/php](http://localhost:8080/r/myapp/php) Or call from a browser: [http://localhost:8080/r/myapp/hello-php](http://localhost:8080/r/myapp/hello-php)
And now with the JSON input: And now with the JSON input:
```sh ```sh
curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/php curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/hello-php
``` ```
That's it! Our `fn deploy` packaged our function and sent it to the Oracle Functions server. Try editing `func.php` That's it! Our `fn deploy` packaged our function and sent it to the Oracle Functions server. Try editing `func.php`

View File

@@ -6,7 +6,7 @@ This example will show you how to test and deploy Python code to Oracle Function
```sh ```sh
# Initialize your function creating a func.yaml file # Initialize your function creating a func.yaml file
fn init <DOCKERHUB_USERNAME>/python fn init <DOCKERHUB_USERNAME>/hello-python
# Test your function. # Test your function.
# This will run inside a container exactly how it will on the server. It will also install and vendor dependencies from Gemfile # This will run inside a container exactly how it will on the server. It will also install and vendor dependencies from Gemfile
@@ -22,15 +22,15 @@ fn deploy myapp
### Now call your function: ### Now call your function:
```sh ```sh
curl http://localhost:8080/r/myapp/python curl http://localhost:8080/r/myapp/hello-python
``` ```
Or call from a browser: [http://localhost:8080/r/myapp/python](http://localhost:8080/r/myapp/python) Or call from a browser: [http://localhost:8080/r/myapp/hello-python](http://localhost:8080/r/myapp/hello-python)
And now with the JSON input: And now with the JSON input:
```sh ```sh
curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/python curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/hello-python
``` ```
That's it! Our `fn deploy` packaged our function and sent it to the Oracle Functions server. Try editing `func.py` That's it! Our `fn deploy` packaged our function and sent it to the Oracle Functions server. Try editing `func.py`

View File

@@ -6,7 +6,7 @@ This example will show you how to test and deploy Ruby code to Oracle Functions.
```sh ```sh
# Initialize your function creating a func.yaml file # Initialize your function creating a func.yaml file
fn init <DOCKERHUB_USERNAME>/ruby fn init <DOCKERHUB_USERNAME>/hello-ruby
# Test your function. # Test your function.
# This will run inside a container exactly how it will on the server. It will also install and vendor dependencies from Gemfile # This will run inside a container exactly how it will on the server. It will also install and vendor dependencies from Gemfile
@@ -22,15 +22,15 @@ fn deploy myapp
### Now call your function: ### Now call your function:
```sh ```sh
curl http://localhost:8080/r/myapp/ruby curl http://localhost:8080/r/myapp/hello-ruby
``` ```
Or call from a browser: [http://localhost:8080/r/myapp/ruby](http://localhost:8080/r/myapp/ruby) Or call from a browser: [http://localhost:8080/r/myapp/hello-ruby](http://localhost:8080/r/myapp/hello-ruby)
And now with the JSON input: And now with the JSON input:
```sh ```sh
curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/ruby curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/hello-ruby
``` ```
That's it! Our `fn deploy` packaged our function and sent it to the Oracle Functions server. Try editing `func.rb` That's it! Our `fn deploy` packaged our function and sent it to the Oracle Functions server. Try editing `func.rb`

View File

@@ -34,7 +34,7 @@ fn main() {
```sh ```sh
# Initialize your function creating a func.yaml file # Initialize your function creating a func.yaml file
fn init <DOCKERHUB_USERNAME>/rust fn init <DOCKERHUB_USERNAME>/hello-rust
# Test your function. This will run inside a container exactly how it will on the server # Test your function. This will run inside a container exactly how it will on the server
fn run fn run
@@ -49,15 +49,15 @@ fn deploy myapp
### Now call your function: ### Now call your function:
```sh ```sh
curl http://localhost:8080/r/myapp/rust curl http://localhost:8080/r/myapp/hello-rust
``` ```
Or call from a browser: [http://localhost:8080/r/myapp/rust](http://localhost:8080/r/myapp/rust) Or call from a browser: [http://localhost:8080/r/myapp/hello-rust](http://localhost:8080/r/myapp/hello-rust)
And now with the JSON input: And now with the JSON input:
```sh ```sh
curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/rust curl -H "Content-Type: application/json" -X POST -d @sample.payload.json http://localhost:8080/r/myapp/hello-rust
``` ```
That's it! That's it!