yesllc/dadjokes 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

yesllc/dadjokes

Composer 安装命令:

composer require yesllc/dadjokes

包简介

Dad jokes microservice used for testing of Kubernetes, Kong, Istio, Kuma, Nginx, Apigee, Mulesoft, etc

README 文档

README

Dad Jokes As A Microservice

Docker Pulls GitHub stars GitHub release MIT

Just a sample humurous 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 optionally echo back information about the incoming request. This is helpful for testing and troubleshooting things like API gateways or proxies. See below for instructions on how to enable echoing per request or by default.

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": "What did one wall say to the other wall?",
    "Punchline": "I'll meet you at the corner.",
    "Processing Time": "0.000537"
  },
  "DadJokesInfo": {
    "SourceCode": "https://github.com/yesinteractive/dadjokes",
    "Version": "20250315"
  }
}

ENABLING THE ECHO FEATURE

To enable the echoing of in the incoming request back into the response, simply add the docker environment variable DADJOKES_NOECHO=FALSE to your configuration or simply use the /echo anywhere in your request calls or as part of a query string. For example:

Endpoint URI : /echo/abc/efg/

Method : GET POST PUT PATCH DELETE

Parameters : optional

Successful Response : 200 OK

{
  "Joke": {
    "Opener": "What do you call a deer with no eyes?",
    "Punchline": "No idea!",
    "Processing Time": "0.000434"
  },
  "RequestEcho": {
    "Headers": {
      "Host": "somehost.com",
      "Connection": "keep-alive",
      "sec-ch-ua": "\"Chromium\";v=\"134\", \"Not:A-Brand\";v=\"24\", \"Google Chrome\";v=\"134\"",
      "sec-ch-ua-mobile": "?0",
      "sec-ch-ua-platform": "\"Windows\"",
      "DNT": "1",
      "Upgrade-Insecure-Requests": "1",
      "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
      "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
      "Accept-Encoding": "gzip, deflate, br, zstd",
      "Accept-Language": "en-US,en;q=0.9",
      "Cookie": "mycooking=myvalue;"
    },
    "Method": "GET",
    "Origin": "123.45.67.123",
    "URI": "/echo/abc/efg/",
    "Arguments": {
      "uri": "/echo/abc/efg/"
    },
    "Data": "",
    "URL": "https://somehost.com/echo/abc/efg/"
  },
  "DadJokesInfo": {
    "SourceCode": "https://github.com/yesinteractive/dadjokes",
    "Version": "20250315"
  }
}

BEHIND REVERSE PROXY CONFIGURATION

If behind an API gateway or reverse proxy, you may wish to have only the URI of the original request echoed back and not the URI of the upstream proxy target. To do this you may add the docker environment variable DADJOKES_BEHIND_PROXY=TRUE to your configuration or set the global behind_proxyconfiguration to true in the config/fsl_config.php file.

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 and enables auto echo of request data):

$ 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>

yesllc/dadjokes 适用场景与选型建议

yesllc/dadjokes 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 6 次下载、GitHub Stars 达 109, 最近一次更新时间为 2020 年 01 月 16 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「api」 「micro」 「router」 「docker」 「fun」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 yesllc/dadjokes 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 yesllc/dadjokes 我们能提供哪些服务?
定制开发 / 二次开发

基于 yesllc/dadjokes 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 110
  • 点击次数: 20
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 109
  • Watchers: 6
  • Forks: 21
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-01-16