Coder Social home page Coder Social logo

module-ballerina-c2c's Introduction

Ballerina Code2cloud Extension

Code2cloud extension implementation for ballerina.

License Daily build Build master branch codecov

Features:

  • Kubernetes deployment support.
  • Kubernetes service support.
  • Kubernetes liveness probe support
  • Kubernetes readiness probe support
  • Kubernetes horizontal pod autoscaler support.
  • Docker image generation.
  • Dockerfile generation.
  • Kubernetes config map support.

Refer samples for more info.

How to build

  1. Download and install JDK 11
  2. Export github personal access token & user name as environment variables.
        export packagePAT=<Token>
        export packageUser=<username>
  3. (optional) Specify the Java home path for JDK 11 ie;
        export JAVA_HOME=/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/
  4. Install Docker
  5. Get a clone or download the source from this repository (https://github.com/ballerina-platform/module-ballerina-c2c)
  6. Run the Gradle command gradle build from within the module-ballerina-c2c directory.
  7. Copy c2c-extension/build/c2c-extension-***.jar file to <BALLERINA_HOME>/bre/lib directory.
  8. Copy c2c-ballerina/build/target/c2c-ballerina-zip/bala/ballerina/cloud directory to <BALLERINA_HOME>/repo/bala/ballerina directory.
  9. Copy c2c-ballerina/build/target/c2c-ballerina-zip/cache/ballerina/cloud directory to <BALLERINA_HOME>/repo/cache/ballerina directory.

Enabling debug logs

  • Use the "BAL_DOCKER_DEBUG=true" environment variable to enable docker related debug logs when building the ballerina source(s).
  • Use the "BAL_KUBERNETES_DEBUG=true" environment variable to enable kubernetes related debug logs when building the ballerina source(s).

Usage Sample:

import ballerina/http;
import ballerina/log;

listener http:Listener helloEP = new(9090);

service /helloWorld on helloEP {
    resource function get sayHello() returns string {
        return "Hello, World from service helloWorld ! ";
    }
}

Build the program with --cloud=k8s or --cloud=docker build option.

$ bal build --cloud=k8s <source_file>.bal 

The Kubernetes and Docker artifacts will be created in following structure.

$> tree
├── docker
│   └── Dockerfile
|-kubernetes
    └── hello-world.yaml    	

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.