Coder Social home page Coder Social logo

andrewyuau / codeengine Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ibm/codeengine

0.0 1.0 0.0 129 KB

Samples for using Code Engine

Home Page: https://cloud.ibm.com/codeengine

License: Apache License 2.0

Shell 64.05% Dockerfile 4.62% JavaScript 1.20% Go 30.14%

codeengine's Introduction

Samples for IBM Cloud Code Engine

This repository contains samples for how to use IBM Cloud Code Engine.

These samples are designed such that they should be able to be fully built and used by anyone. Unless otherwise noted the overall pattern that will be followed is:

  • a build script shows how each container image used in the sample is built. By default, the script will push the image to the ibmcom namespace on DockerHub, so to use this yourself you'll need to set the REGISTRY environment variable to your own registry and/or namespace. Also, you MUST use a registry that allows for anonymous/public downloads of your images, since as of now (to keep the scripts simple) they do not deal with private registry access tokens by default.
  • a run script will execute the sample. Most will also include logic to verify the output to ensure everything is working as expected. As with build, it will default to using the ibmcom container images, so to use your own you'll need to set the REGISTRY environment variable. This means that you should be able to just execute run without running build first, and it'll just use the pre-built images from ibmcom.
    • invoking run clean should clean up from any previous execution without re-running the sample.

Most samples will try to be relatively small to focus on one particular task so that it can be re-used easily and integrated into a larger use-case.

It is assumed that the following are installed:

It is also assumed that you have a Code Engine project already created and selected, e.g.:

$ ibmcloud ce project create --name demos

Samples

Apps

  • hello
    Very basic "hello world!" type of application written in Node.js. Start here!
  • helloworld
    Similar to hello except this is written in golang and adds a few bells-n-whistles to allow you to control what it does when invoked.
  • bind-app
    This will create an instance of DB2 in the IBM Cloud and then ask Code Engine to bind it to an Application so we can access it from the App. The credentials, etc. will be injected into the App via environment variables.
  • cecli
    Show how to invoke the Code Engine CLI from within an App. This can be used to then start additional Code Engine resources (Apps/Jobs) dynamically. Same logic could be used in Batch Jobs.

Batch Jobs

  • job
    This will create a Batch Job that will print basic debugging information to the logs, and then show those logs. It'll create the Batch Job with and without a Job definition to show both options.
  • app-n-job
    This will use the same image for both an Application and a Batch Job. Just to show that it's possible.
  • app2job
    This will show how to submit a Job from an Application based on an incoming HTTP request to the Application.
  • bind-job
    This will create an instance of DB2 in the IBM Cloud and then ask Code Engine to bind it to a Batch Job so we can access it from the Job. The credentials, etc. will be injected into the Job via environment variables.
  • job2app
    This will demostrate how to create a simple Batch Job and how to have it communicate with an Application running within the same project.

Source-to-Image

  • s2i-buildpacks
    This will show how to use the source-to-image feature of Code Engine to build an Application from a git repo (using a Buildpack), push it to a private registry, and then deploy an Application using that image.
  • s2i-dockerfile
    This will show how to use the source-to-image feature of Code Engine to build an Application from a git repo (using a Dockerfile), push it to a private registry, and then deploy an app using that image.

Eventing

  • ping
    This will show how to setup a simple Ping(cron) Event Source and send its events to an Application.
  • cos-event
    This will show how to setup a COS Event Source and send its events to an Application.

Misc

  • configmaps-env
    Shows how to define and inject a ConfigMap as environment variables into an Application.
  • configmaps-vol
    Shows how to define and inject a ConfigMap as a volume into an Application.
  • secrets-env
    Shows how to define and inject a Secret as environment variables into an Application.
  • secrets-vol
    Shows how to define and inject a Secret as a volume into an Application.
  • sessions
    Starts a stateful application that scales based on load. The state is kept in an instance of Redis, also running within Code Engine. Demonstrates the use of non-http components and private networking between components.

Resources

You may also open issues and PRs in the repository too.

codeengine's People

Contributors

andrewyuau avatar reggeenr avatar saschaschwarze0 avatar scarlettanager avatar zhangtbj 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.