Code Monkey home page Code Monkey logo

yesinteractive / dadjokes Goto Github PK

View Code? Open in Web Editor NEW
100.0 8.0 26.0 4.66 MB

Dadjokes.online: Microservice echo-service as an alternative to httpbin for testing k8s, docker, kong, istio, kuma, etc. Built on FSL php microframework. Who says testing and dev ops can't be fun?

Home Page: http://dadjokes.online

License: MIT License

Dockerfile 1.89% PHP 98.11%
microservice docker dad-jokes k8s kubernetes php dev devops kubernetes-deployment service-mesh istio kuma api api-gateway kong jokes httpbin apigee mulesoft echo-server

dadjokes's Introduction

Dad Jokes Microservice

Dad Jokes As A Microservice

Docker Pulls GitHub stars GitHub release MIT

Just a sample microservice or echo service used for testing API Gateways such as Kong, Kubernetes K8s, Openshift, Docker, Service meshes such as Kuma or Istio, etc. as an alternative to httpbin. Feel free to add your own jokes to this repo as well. In addition to a dad joke, the service will automatically echo back information about the incoming request. This is helpful for testing and troubleshooting. If you wish to not display echo back the request data, then just make the request against the /noecho endpoint or by configuring the dadjokes service with the noecho environment variable set to true.

Hosted Service / Demo

Access http://dadjokes.online to see the service in action.

Usage

Endpoint URI : /

Method : GET POST PUT PATCH DELETE

Parameters : optional

Successful Response : 200 OK

    "Joke": {
        "Opener": "I burned 2000 calories today",
        "Punchline": "I left my food in the oven for too long.",
        "Processing Time": "0.001223"
    },
    "RequestEcho": {
        "Headers": {
            "Host": "dadjokes.online",
            "Connection": "keep-alive",
            "X-Forwarded-For": "74.11.135.11",
            "X-Forwarded-Proto": "http",
            "X-Forwarded-Host": "dadjokes.online",
            "X-Forwarded-Port": "80",
            "X-Real-IP": "74.11.135.11",
            "Cache-Control": "max-age=0",
            "Upgrade-Insecure-Requests": "1",
            "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.61 Safari/537.36",
            "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
            "Accept-Encoding": "gzip, deflate",
            "Accept-Language": "en-US,en;q=0.9",
            "Cookie": "fsl=eijse8smkrfce80or4frpjnf87"
        },
        "Method": "GET",
        "Origin": "192.11.166.11",
        "URI": "/echo",
        "Arguments": {
            "uri": "/echo"
        },
        "Data": "",
        "URL": "http://dadjokes.online/echo"
    }
}

DISABLING THE ECHO FEATURE

To disable the echoing of in the incomfing response, simply add the docker environment variable DADJOKES_NOECHO=TRUE to your configuration or simply use the \noecho endpoint in the first level of your request calls. For example:

Endpoint URI : /noecho/abc/efg/

Method : GET POST PUT PATCH DELETE

Parameters : optional

Successful Response : 200 OK

{
  "Jokes": {
    "Opener": "What did the mountain climber name his son?",
    "Punchline": "Cliff",
    "Processing Time": "0.001530"
  }
}

Installation

Deployment Examples

See usage examples for Kubernetes, Kong for Kubernetes Ingress Controller, and docker-compose in the examples directory folder.

With Docker

Docker image is Alpine 3.11 based running PHP 7.3 on Apache. The containter exposes both ports 8100 (HTTP) an 8143 (HTTPS) with a self signed certificated. If you wish to alter the container configuration, feel free to use the Dockerfile in this repo (https://github.com/yesinteractive/dad-jokes_microservice/blob/master/Dockerfile). Otherwise, you can pull the latest image from DockerHub with the following command:

docker pull yesinteractive/dadjokes

Typical basic usage (below example exposes dadjokes on host ports 8100 and 8143):

$ docker run -d \
  -p 8100:8100 \
  -p 8143:8143 \
  -e DADJOKES_NOECHO=FALSE \
  yesinteractive/dadjokes

Typical usage in Dockerfile:

FROM yesinteractive/dadjokes
RUN echo <your commands here>

dadjokes's People

Contributors

nikirago avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dadjokes's Issues

Kubernetes Object Definitions

It seems worth putting in a full "prod" example on kubernetes with service mesh configuration. Was really hoping this would be a simple git clone && kubectl apply and then it's up and running.

That's what I initially interpreted when I saw "Microservice of dad jokes for k8s, docker, kong, istio, kuma, etc"

Anyway just that that would be really cool to see - cool repo regardless :)

Versioning Docker Hub images

Hi,

Would it be possible to version the images up on docker hub - https://hub.docker.com/r/yesinteractive/dadjokes ?

For example having latest, 1.0, 1.1 etc

The benefit would be for people building against a specific tag i.e 1.1 would know that the code base wouldn't change and anything built against that tag would be consistent. If no tag is used there is a risk that code changes applied to the same image (without a tag) may impact programs that call the docker image.

Thanks

Mark

Docker images not running on Apple M1

Hi,

Would it be possible to also provide docker hub images for multiple os architectures including Apple M1 ( linux/arm64/v8 ) running docker.io/yesinteractive/dadjokes via docker command causes the program to exit straight away on Apple M1.

docker run -d \                       
  -p 8100:8100 \
  -p 8143:8143 \
  -e DADJOKES_NOECHO=FALSE \
  docker.io/yesinteractive/dadjokes

Building directly from source things run correctly using docker-compose up --build on

version: '3.9'

services:

  # doesn't run on Apple M1
  dadjokesimage:
    image: docker.io/yesinteractive/dadjokes
    environment:
      - DADJOKES_NOECHO=FALSE
    ports:
      - 7100:8100
      - 7143:8143

  # builds and runs OK on Apple M1
  dadjokesbuild:
    build: https://github.com/yesinteractive/dadjokes.git
    environment:
      - DADJOKES_NOECHO=FALSE
    ports:
      - 9100:8100
      - 9143:8143

Returns error AH00023: Couldn't create the mpm-accept mutex for dadjokesimage.

As a workaround building directly from git source works (dadjokesbuild) currently with the trade-off of additional build time.

Thanks

Mark

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.