Giter Club home page Giter Club logo

hello-quarkus's Introduction

Function project

Welcome to your new Quarkus function project!

This sample project contains a single function: functions.Function.function(), the function just returns its argument.

Local execution

Make sure that Java 11 SDK is installed.

To start server locally run ./mvnw quarkus:dev. The command starts http server and automatically watches for changes of source code. If source code changes the change will be propagated to running server. It also opens debugging port 5005 so debugger can be attached if needed.

To run test locally run ./mvnw test.

The func CLI

It's recommended to set FUNC_REGISTRY environment variable.

# replace ~/.bashrc by your shell rc file
# replace docker.io/johndoe with your registry
export FUNC_REGISTRY=docker.io/johndoe
echo "export FUNC_REGISTRY=docker.io/johndoe" >> ~/.bashrc 

Building

This command builds OCI image for the function.

func build

By default, JVM build is used. To enable native build set following enviromnet variables to func.yaml:

buildEnvs:
- name: BP_NATIVE_IMAGE
  value: "true"
- name: BP_MAVEN_BUILT_ARTIFACT
  value: func.yaml target/native-sources/*
- name: BP_MAVEN_BUILD_ARGUMENTS
  value: package -DskipTests=true -Dmaven.javadoc.skip=true -Dquarkus.package.type=native-sources
- name: BP_NATIVE_IMAGE_BUILD_ARGUMENTS_FILE
  value: native-image.args
- name: BP_NATIVE_IMAGE_BUILT_ARTIFACT
  value: '*-runner.jar'

Running

This command runs the func locally in a container using the image created above.

func run

Deploying

This commands will build and deploy the function into cluster.

func deploy # also triggers build

Function invocation

Do not forget to set URL variable to the route of your function.

You get the route by following command.

func info

cURL

URL=http://localhost:8080/
curl -v ${URL} \
  -H "Content-Type:application/json" \
  -d "{\"message\": \"$(whoami)\"}\""
# OR
URL="http://localhost:8080/?message=$(whoami)"
curl -v ${URL} 

HTTPie

URL=http://localhost:8080/
http -v ${URL} \
  message=$(whoami)
# OR
URL="http://localhost:8080/?message=$(whoami)"
http -v ${URL}

hello-quarkus's People

Contributors

lstocchi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.