Skip to content

Commit

Permalink
chrats/fake-aws-sqs: Use ElasticMQ
Browse files Browse the repository at this point in the history
  • Loading branch information
akshaymankar committed Nov 30, 2023
1 parent eaec342 commit 28f4c0d
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 36 deletions.
56 changes: 56 additions & 0 deletions charts/fake-aws-sqs/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "fullname" . }}
labels:
app: {{ template "fullname" . }}
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
release: "{{ .Release.Name }}"
heritage: "{{ .Release.Service }}"
data:
elasticmq.conf: |
include classpath("application.conf")
# What is the outside visible address of this ElasticMQ node
# Used to create the queue URL (may be different from bind address!)
node-address {
protocol = http
host = localhost
port = {{ .Values.service.httpPort }}
context-path = ""
}
rest-sqs {
enabled = true
bind-port = {{ .Values.service.httpPort }}
bind-hostname = "0.0.0.0"
# Possible values: relaxed, strict
sqs-limits = strict
}
rest-stats {
enabled = true
bind-port = 9325
bind-hostname = "0.0.0.0"
}
# Should the node-address be generated from the bind port/hostname
# Set this to true e.g. when assigning port automatically by using port 0.
generate-node-address = false
queues {
{{- range $i, $queueName := .Values.queueNames }}
"$queueName" {
{{- if hasSuffix ".fifo" $queueName }}
fifo = true
{{- end }}
}
{{- end }}
}
# Region and accountId which will be included in resource ids
aws {
region = eu-west-1
accountId = 000000000000
}
36 changes: 2 additions & 34 deletions charts/fake-aws-sqs/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ spec:
metadata:
labels:
app: {{ template "fullname" . }}
annotations:
checksum/configmap: {{ include (print .Template.BasePath "/configmap.yaml") . | sha256sum }}
spec:
containers:
- name: fake-aws-sqs
Expand All @@ -29,40 +31,6 @@ spec:
mountPath: /data
resources:
{{ toYaml .Values.resources | indent 12 }}
- name: initiate-fake-aws-sqs
image: mesosphere/aws-cli:1.14.5
command: [/bin/sh]
args:
- -c
- |
exec_until_ready() {
until $1; do echo 'service not ready yet'; sleep 1; done
}
queue_exists() {
# NOTE: we use the '"' to match the queue name more exactly (otherwise there is some overlap)
OUTPUT=$(aws --endpoint-url=http://localhost:{{ $.Values.service.httpPort }} sqs list-queues | grep $1'"' | wc -l)
echo $OUTPUT
}
echo 'Creating AWS resources'
aws configure set aws_access_key_id dummy
aws configure set aws_secret_access_key dummy
aws configure set region eu-west-1
while true
do
# Recreate resources if needed
{{ range $i, $queueName := .Values.queueNames }}
QUEUE=$(queue_exists "{{ $queueName }}")
if [ "$QUEUE" == "1" ]
then echo "Queue {{ $queueName }} exists, no need to re-create"
else exec_until_ready "aws --endpoint-url=http://localhost:{{ $.Values.service.httpPort }} sqs create-queue --queue-name {{ $queueName }}"
fi
{{ end }}
echo 'Sleeping 10'
sleep 10
done
volumes:
- emptyDir: {}
name: "storage"
4 changes: 2 additions & 2 deletions charts/fake-aws-sqs/values.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
image:
repository: airdock/fake-sqs
tag: 0.3.1
repository: softwaremill/elasticmq-native
tag: 1.5.2

# TODO: in a wire-server chart, these queue names should match the ones defined in galley/brig/gundeck (i.e. only be defined once)
queueNames:
Expand Down

0 comments on commit 28f4c0d

Please sign in to comment.