Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: upgrade to Alpine OpenJDK + last release of ElasticMQ and sqs-insight #37

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
14 changes: 14 additions & 0 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Docker Image CI

on: [push]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Build the Docker image
run: docker build . --file Dockerfile --tag alpine-sqs:$(date +%s)
42 changes: 8 additions & 34 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,45 +1,19 @@
# Copyright 2017 Ronald E. Oribio R.
#
# This file is part of alpine-sqs which is released under the GPLv3.
# See https://github.com/roribio/alpine-sqs for details.
FROM openjdk:8-jre-alpine

FROM appropriate/curl as Builder
RUN apk add --update nodejs nodejs-npm supervisor curl jq && \
curl -jSslLk https://github.com/kobim/sqs-insight/archive/master.tar.gz | tar -zxf - -C /opt && \
mv /opt/sqs-insight-master /opt/sqs-insight && \
export elasticmq_version=$(curl -jsSlLk -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/softwaremill/elasticmq/tags | jq -r .[0].name) && \
curl -jSslLk https://s3-eu-west-1.amazonaws.com/softwaremill-public/elasticmq-server-${elasticmq_version//v}.jar -o /opt/elasticmq-server.jar && \
rm -rf /var/cache/apk/* /etc/supervisord.conf

ARG jq_version=1.5

WORKDIR /tmp/sqs-alpine

RUN \
apk add --update git \
&& rm -rf /var/cache/apk/* \
&& git clone --verbose --depth=1 https://github.com/kobim/sqs-insight.git \
&& curl -L -o /usr/local/bin/jq https://github.com/stedolan/jq/releases/download/jq-${jq_version}/jq-linux64 \
&& chmod +x /usr/local/bin/jq \
&& export elasticmq_version=$(curl -sL https://api.github.com/repos/adamw/elasticmq/releases/latest | jq -r .tag_name) \
&& elasticmq_version=${elasticmq_version//v} \
&& curl -LO https://s3-eu-west-1.amazonaws.com/softwaremill-public/elasticmq-server-${elasticmq_version}.jar \
&& mv elasticmq-server-${elasticmq_version}.jar elasticmq-server.jar

FROM anapsix/alpine-java:8
LABEL maintainer="Ronald E. Oribio R. https://github.com/roribio"

COPY --from=Builder /tmp/sqs-alpine/ /opt/
COPY etc/ /etc/
COPY opt/ /opt/

RUN \
apk add --update \
nodejs \
nodejs-npm \
supervisor \
&& rm -rf \
/var/cache/apk/* \
/etc/supervisord.conf \
&& ln -s /etc/supervisor/supervisord.conf /etc/supervisord.conf \
RUN ln -s /etc/supervisor/supervisord.conf /etc/supervisord.conf \
&& cd /opt/sqs-insight \
&& npm install

EXPOSE 9324 9325

ENTRYPOINT ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/supervisord.conf"]

5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

> Dockerized ElasticMQ server + web UI over Alpine Linux for local development.

Alpine SQS provides a containerized Java implementation of the Amazon Simple Queue Service (AWS-SQS). It is based on ElasticMQ running Alpine Linux and the Oracle Java 8 Server-JRE. It is compatible with AWS's API, CLI as well as the Amazon Java SDK. This allows for quicker local development without having to incurr in infrastructure costs.
Alpine SQS provides a containerized Java implementation of the Amazon Simple Queue Service (AWS-SQS). It is based on ElasticMQ running Alpine Linux and the OpenJDK Java 8 JRE. It is compatible with AWS's API, CLI as well as the Amazon Java SDK. This allows for quicker local development without having to incurr in infrastructure costs.

The goal of this repository is to maintain an updated Docker environment for ElasticMQ with an integrated web UI for visualizing queues and messages.

Expand Down Expand Up @@ -37,9 +37,8 @@ Using his work as inspiration I decided to improve upon it by implementing the f
### See also
For more information on the different projects this work is based on, please visit:

- [ElasticMQ](https://github.com/adamw/elasticmq) by [@adamw](https://github.com/adamw).
- [ElasticMQ](https://github.com/softwaremill/elasticmq).
- [sqs-insight](https://github.com/kobim/sqs-insight) fork by [kobim](https://github.com/kobim/). Fork of [finanzcheck's now-archived sqs-insight](https://github.com/finanzcheck/sqs-insight).
- [docker-alpine-java](https://github.com/anapsix/docker-alpine-java) by [anapsix](https://github.com/anapsix).

## Install
### Pre-requisites
Expand Down
2 changes: 0 additions & 2 deletions docker-compose.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ services:
alpine-sqs:
build:
context: .
# args:
# - jq_version=${jq_version}
image: alpine-sqs:dev
container_name: alpine-sqs
ports:
Expand Down
2 changes: 1 addition & 1 deletion etc/supervisor/conf.d/elasticmq.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[program:elasticmq]
command=/opt/jdk/bin/java -Dconfig.file=/opt/config/elasticmq.conf -jar /opt/elasticmq-server.jar
command=java -Dconfig.file=/opt/config/elasticmq.conf -jar /opt/elasticmq-server.jar
priority=10
autostart=true
autorestart=true
Expand Down
41 changes: 40 additions & 1 deletion opt/elasticmq.conf
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
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 = "*"
host = localhost
port = 9324
context-path = ""
}
Expand All @@ -15,11 +17,48 @@ rest-sqs {
sqs-limits = strict
}

// 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 {
queue1 {
defaultVisibilityTimeout = 10 seconds
delay = 5 seconds
receiveMessageWait = 0 seconds
deadLettersQueue {
name = "queue1-dead-letters"
maxReceiveCount = 3 // from 1 to 1000
}
fifo = false
contentBasedDeduplication = false
copyTo = "audit-queue-name"
moveTo = "redirect-queue-name"
tags {
tag1 = "tagged1"
tag2 = "tagged2"
}
}
queue1-dead-letters { }
audit-queue-name { }
redirect-queue-name { }
sqs-queue {
defaultVisibilityTimeout = 10 seconds
delay = 5 seconds
receiveMessageWait = 0 seconds
fifo = true
contentBasedDeduplication = false
}
default {
defaultVisibilityTimeout = 10 seconds
delay = 5 seconds
receiveMessageWait = 0 seconds
}
}

// Region and accountId which will be included in resource ids
aws {
region = eu-west-1
accountId = 000000000000
}

2 changes: 1 addition & 1 deletion opt/sqs-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ cp /opt/*.conf /opt/config/
cp /opt/custom/*.conf /opt/config/

# Now copy sqs-insight config to correct location:
cp /opt/config/sqs-insight.conf /opt/sqs-insight/config/config_local.json
cp /opt/config/sqs-insight.conf /opt/sqs-insight/config/config.json

sleep 1
exit 0
Expand Down
12 changes: 5 additions & 7 deletions opt/sqs-insight.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
"port": 9325,
"rememberMessages": 100,

"endpoints": [],

"dynamicEndpoints": [
{
"key": "notValidKey",
"secretKey": "notValidSecret",
"region": "eu-central-1",
"url": "http://localhost:9324",
"visibility": 0
"key": "localSQS",
"secretKey": "localSQS",
"region": "us-west-1",
"url": "http://127.0.0.1:9324"
}

]
}

30 changes: 30 additions & 0 deletions opt/sqs-insight.conf.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"port": 9325,
"rememberMessages": 100,

"endpoints": [
{
"key": "notValidKey",
"secretKey": "notValidSecret",
"region": "eu-central-1",
"url": "http://sqs.amazonaws.com/my-user/my-queue"
},
{
"key": "notValidKey",
"secretKey": "notValidSecret",
"region": "eu-central-1",
"url": "http://sqs.amazonaws.com/my-user/my-queue-2"
}
],

"dynamicEndpoints": [
{
"key": "localSQS",
"secretKey": "localSQS",
"region": "us-west-1",
"url": "http://127.0.0.1:9324"
}

]
}

15 changes: 0 additions & 15 deletions opt/sqs-insight/config/config_local.json

This file was deleted.