{"id":18627370,"url":"https://github.com/dizys/docker-http2-mock-service","last_synced_at":"2025-11-04T01:30:35.429Z","repository":{"id":96763782,"uuid":"375576739","full_name":"dizys/docker-http2-mock-service","owner":"dizys","description":null,"archived":false,"fork":false,"pushed_at":"2021-06-11T04:02:32.000Z","size":38,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-20T20:03:03.474Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dizys.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-10T05:09:06.000Z","updated_at":"2021-06-11T04:02:34.000Z","dependencies_parsed_at":"2023-03-14T02:45:15.174Z","dependency_job_id":null,"html_url":"https://github.com/dizys/docker-http2-mock-service","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dizys%2Fdocker-http2-mock-service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dizys%2Fdocker-http2-mock-service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dizys%2Fdocker-http2-mock-service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dizys%2Fdocker-http2-mock-service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dizys","download_url":"https://codeload.github.com/dizys/docker-http2-mock-service/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239425311,"owners_count":19636346,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T04:42:08.282Z","updated_at":"2025-11-04T01:30:35.389Z","avatar_url":"https://github.com/dizys.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HTTP2 Mock Server\n\nA mock HTTP2 (/HTTP1 also)\nserver. Docker image available [here](https://hub.docker.com/r/dizy/http2-mock-server).\n\n## Getting started\n\nPull image from the command line:\n\n```bash\n$ docker pull dizy/http2-mock-server:latest\n```\n\nor use as base image in DockerFile:\n\n```bash\nFROM dizy/http2-mock-server:latest\n```\n\n## Configuration\n\nThe server is reading from two places in the container for configuration: `/node_app/mock-config.json`, `/etc/http2/mock-config.json` (seek in this order). If the configuration file changes, the server will restart and apply the changes automatically.\n\nExample config JSON:\n\n```jsonc\n{\n  \"port\": 3000, // main HTTP/2 port\n  \"http1Port\": 3001, // HTTP/1.1 port for testing purposes\n  \"failureRate\": 0.5, // Rate for mocking requests to fail\n  \"averageResponseTime\": 500, // Mock response delay time (average) in milliseconds\n  \"responseTimeDeviation\": 100 // Deviation on the delay time (+/- milliseconds at most)\n}\n```\n\n### Enable HTTP/2 SSL\n\nPutting SSL keys (`mock-server.key` and `mock-server.crt`) under one of these two folders: `/node_app/keys/` or `/etc/http2/` (seek in this order). If the keys exist, the server will enable SSL for HTTP/2 transport automatically. If the keys change, the server will restart and apply the changes automatically.\n\n### Configure through Env variables\n\n- PORT: `port` main HTTP/2 port\n- HTTP1_PORT: `http1Port` HTTP/1.1 port for testing purposes\n- FAILURE_RATE: `failureRate`\n- AVERAGE_RESPONSE_TIME: `averageResponseTime`\n- RESPONSE_TIME_DEVIATION: `responseTimeDeviation`\n\nYou can set environment variables when [Docker run](https://docs.docker.com/engine/reference/commandline/run/#set-environment-variables--e---env---env-file) or when using [Docker Compose](https://docs.docker.com/compose/environment-variables/).\n\n### Kubernetes YAML\n\nWhen deploy this image as services/deployments in Kubernetes, you can utilize ConfigMap to manage config files and SSL keys.\n\nExample:\n\n```yml\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: http2-mock\nspec:\n  ports:\n    - name: http2\n      port: 81\n      targetPort: 3000\n    - name: http1\n      port: 80\n      targetPort: 3001\n  selector:\n    app: http2-mock\n---\napiVersion: apps/v1\nkind: Deployment\nmetadata:\n  name: http2-mock\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: http2-mock\n  strategy:\n    type: RollingUpdate\n  template:\n    metadata:\n      labels:\n        app: http2-mock\n    spec:\n      containers:\n        - name: http2-mock\n          image: docker.io/dizy/http2-mock-server:latest\n          ports:\n            - name: http2\n              containerPort: 3000\n            - name: http1\n              containerPort: 3001\n          volumeMounts:\n            - name: http2-mock-volume\n              mountPath: '/etc/http2'\n              readOnly: true\n      volumes:\n        - name: http2-mock-volume\n          configMap:\n            name: http2-mock-config\n---\napiVersion: v1\nkind: ConfigMap\nmetadata:\n  name: http2-mock-config\ndata:\n  mock-config.json: |\n    {\n      \"port\": 3000,\n      \"http1Port\": 3001,\n      \"failureRate\": 0.5,\n      \"averageResponseTime\": 500,\n      \"responseTimeDeviation\": 100\n    }\n  mock-server.key: |\n    ...\n  mock-server.crt: |\n    ...\n```\n\n## License\n\nMIT license\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdizys%2Fdocker-http2-mock-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdizys%2Fdocker-http2-mock-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdizys%2Fdocker-http2-mock-service/lists"}