Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -112,4 +112,6 @@ dmypy.json

# Editors
.sonarlint
.vscode
.vscode

.DS_Store
17 changes: 8 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Build container

FROM alpine:3.17.1 as build
FROM alpine:3.21.2 AS build

RUN apk add build-base curl git make python3 python3-dev

Expand All @@ -15,17 +15,16 @@ RUN make package

# Distribution container

FROM alpine:3.17.1
FROM alpine:3.21.2

COPY --from=build /opt/dummyserver/dist/dummyserver-*.tar.gz /tmp/dummyserver.tar.gz
COPY ./script/entrypoint /entrypoint

RUN apk add --no-cache curl python3 openssl && \
curl https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py && \
python3 /tmp/get-pip.py && \
pip install requests /tmp/dummyserver.tar.gz && \
rm -f /tmp/get-pip.py /tmp/dummyserver.tar.gz
RUN apk add --no-cache curl python3 openssl py3-pip py-requests && \
pip install --break-system-packages /tmp/dummyserver.tar.gz && \
rm -f /tmp/dummyserver.tar.gz && \
chmod +x /entrypoint

EXPOSE 8080 8181 8282 8383
EXPOSE 8001 8002 8003 8004

ENTRYPOINT [ "/entrypoint"]
ENTRYPOINT [ "/entrypoint" ]
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
OTHER DEALINGS IN THE SOFTWARE.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ test: venv
${PYTEST} test

run: venv
${PYTHON} dummyserver
SERVER_CRT_PATH=test/test_handler/server-bundle.crt CLIENT_CA_PATH=test/test_handler/rootCA.crt ${PYTHON} dummyserver

package: venv
${PYTHON} setup.py sdist
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Dummy Webserver

This is just a dummy webserver. All the requests are recorded.
It will answer 200 to GET requests and to POST requests with a valid json body. In case of validation error when parsing the json body it will return a 418.
It will answer 200 to GET requests and to POST requests.
<!-- with a valid json body. In case of validation error when parsing the json body it will return a 418. -->

It exposes 3 different endpoints:

Expand Down
28 changes: 28 additions & 0 deletions charts/dummyserver-stage-config/dummyserver-stage-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
service:
type: LoadBalancer
httpPort: 80
httpsPort: 443
mgmtPort: 8004

image:
tag: "0.7.0"
pullPolicy: Always

ingress:
enabled: false
host: dummy-webserver.dev.everyware.io

className: alb
basePath: /
# backend:
# serviceName: ec-console
# servicePort: 8080
annotations:
# Simple configuration for AWS ALB Ingress Controller (https://kubernetes-sigs.github.io/aws-alb-ingress-controller/guide/ingress/annotation/)
alb.ingress.kubernetes.io/certificate-arn: arn:aws:acm:us-east-1:332696098873:certificate/1021f82e-83ad-420e-bac9-f6640d89e129
alb.ingress.kubernetes.io/listen-ports: '[{"HTTP": 80}, {"HTTPS": 443}]'
alb.ingress.kubernetes.io/actions.ssl-redirect: '{"Type": "redirect", "RedirectConfig": { "Protocol": "HTTPS", "Port": "443", "StatusCode": "HTTP_301"}}'
alb.ingress.kubernetes.io/scheme: internet-facing
alb.ingress.kubernetes.io/target-type: ip
alb.ingress.kubernetes.io/ssl-policy: ELBSecurityPolicy-FS-1-2-2019-08
alb.ingress.kubernetes.io/group.name: everyware-cloud-stage
163 changes: 163 additions & 0 deletions charts/dummyserver.template.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
NAME: dummyserver
LAST DEPLOYED: Fri Jun 9 11:47:20 2023
NAMESPACE: default
STATUS: pending-install
REVISION: 1
HOOKS:
---
# Source: dummyserver/templates/tests/test-connection.yaml
apiVersion: v1
kind: Pod
metadata:
name: "dummyserver-test-connection"
labels:
helm.sh/chart: dummyserver-0.1.0
app.kubernetes.io/name: dummyserver
app.kubernetes.io/instance: dummyserver
app.kubernetes.io/version: "0.6.0"
app.kubernetes.io/managed-by: Helm
annotations:
"helm.sh/hook": test
spec:
containers:
- name: wget
image: busybox
command: ['wget']
args: ['dummyserver:']
restartPolicy: Never
MANIFEST:
---
# Source: dummyserver/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
name: dummyserver
labels:
helm.sh/chart: dummyserver-0.1.0
app.kubernetes.io/name: dummyserver
app.kubernetes.io/instance: dummyserver
app.kubernetes.io/version: "0.6.0"
app.kubernetes.io/managed-by: Helm
spec:
type: ClusterIP
ports:
- port: 8001
targetPort: 8001
protocol: TCP
name: http
- port: 8002
targetPort: 8002
protocol: TCP
name: https
- port: 8004
targetPort: 8004
protocol: TCP
name: mgmt
selector:
app.kubernetes.io/name: dummyserver
app.kubernetes.io/instance: dummyserver
---
# Source: dummyserver/templates/deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: dummyserver
labels:
helm.sh/chart: dummyserver-0.1.0
app.kubernetes.io/name: dummyserver
app.kubernetes.io/instance: dummyserver
app.kubernetes.io/version: "0.6.0"
app.kubernetes.io/managed-by: Helm
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: dummyserver
app.kubernetes.io/instance: dummyserver
template:
metadata:
labels:
app.kubernetes.io/name: dummyserver
app.kubernetes.io/instance: dummyserver
spec:
securityContext:
{}
containers:
- name: dummyserver
securityContext:
{}
image: "public.ecr.aws/eurotech-dev/dummy-webserver:0.6.0:0.6.0"
Copy link

Copilot AI Mar 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The image tag appears to be duplicated. Please update it to a single version tag, for example: "public.ecr.aws/eurotech-dev/dummy-webserver:0.6.0".

Suggested change
image: "public.ecr.aws/eurotech-dev/dummy-webserver:0.6.0:0.6.0"
image: "public.ecr.aws/eurotech-dev/dummy-webserver:0.6.0"

Copilot uses AI. Check for mistakes.
imagePullPolicy: IfNotPresent
ports:
- name: http
containerPort: 8001
protocol: TCP
- name: https
containerPort: 8002
protocol: TCP
- name: mgmtport
containerPort: 8004
protocol: TCP
## livenessProbe:
## httpGet:
## path: /liveness
## port: http
## readinessProbe:
## httpGet:
## path: /readyness
## port: http
resources:
{}
---
# Source: dummyserver/templates/ingress.yaml
kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: dummyserver
labels:
helm.sh/chart: dummyserver-0.1.0
app.kubernetes.io/name: dummyserver
app.kubernetes.io/instance: dummyserver
app.kubernetes.io/version: "0.6.0"
app.kubernetes.io/managed-by: Helm
annotations:
alb.ingress.kubernetes.io/listen-ports: "[{\"HTTP\": 80}]"
alb.ingress.kubernetes.io/scheme: "internet-facing"
alb.ingress.kubernetes.io/target-type: "ip"
spec:
ingressClassName: alb
rules:
- http:
paths:
- pathType: Prefix
path: /stats
backend:
service:
name: dummyserver
port:
number: 8004
- pathType: Prefix
path: /history
backend:
service:
name: dummyserver
port:
number: 8004
- pathType: Prefix
path: /clear
backend:
service:
name: dummyserver
port:
number: 8004
- pathType: Prefix
path: /
backend:
service:
name: dummyserver
port:
number: 8001

NOTES:
1. Get the application URL by running these commands:
http://chart-example.local/
23 changes: 23 additions & 0 deletions charts/dummyserver/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
24 changes: 24 additions & 0 deletions charts/dummyserver/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: dummyserver
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "0.6.0"
20 changes: 20 additions & 0 deletions charts/dummyserver/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ .Values.ingress.host }}{{ .path }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "dummyserver.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "dummyserver.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "dummyserver.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "dummyserver.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8001 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8001:$CONTAINER_PORT
{{- end }}
62 changes: 62 additions & 0 deletions charts/dummyserver/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "dummyserver.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "dummyserver.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "dummyserver.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "dummyserver.labels" -}}
helm.sh/chart: {{ include "dummyserver.chart" . }}
{{ include "dummyserver.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "dummyserver.selectorLabels" -}}
app.kubernetes.io/name: {{ include "dummyserver.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "dummyserver.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "dummyserver.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
Loading