roribio / alpine-sqs

Dockerized ElasticMQ server + web UI over Alpine Linux for local development
GNU Affero General Public License v3.0
259 stars 56 forks source link

Custom configs doesn't work #15

Closed moleksyuk closed 6 years ago

moleksyuk commented 6 years ago

Hi @roribio,

Yesterday you closed #11 but unfortunately it doesn't work for me.

Steps to reproduce:

  1. git clone https://github.com/roribio/alpine-sqs.git
  2. Edit file alpine-sqs/opt/elasticmq.conf to such content:
    
    include classpath("application.conf")

node-address { protocol = http host = "*" port = 9324 context-path = "" }

rest-sqs { enabled = true bind-port = 9324 bind-hostname = "0.0.0.0" // Possible values: relaxed, strict sqs-limits = strict }

queues { default { defaultVisibilityTimeout = 10 seconds delay = 5 seconds receiveMessageWait = 0 seconds }, test { defaultVisibilityTimeout = 10 seconds delay = 5 seconds receiveMessageWait = 0 seconds } }


3. Edit file **alpine-sqs/opt/elasticmq.conf** to such content:
```json
{
    "port": 9325,
    "rememberMessages": 100,

    "endpoints": [
        {
           "key": "notValidKey",
           "secretKey": "notValidSecret",
           "region": "eu-central-1",
           "url": "http://localhost:9324/queue/default",
           "visibility": 0
        },
        {
           "key": "notValidKey",
           "secretKey": "notValidSecret",
           "region": "eu-central-1",
           "url": "http://localhost:9324/queue/test",
           "visibility": 0
        }
    ]
}
  1. Run docker: docker run -p 9324:9324 -p 9325:9325 -v /Users/moleksyuk/tmp/alpine-sqs/opt:/opt/custom roribio16/alpine-sqs:latest

In logs I see it says only one queue is available:

~/tmp/alpine-sqs/opt   master ●  docker run -p 9324:9324 -p 9325:9325 -v /Users/moleksyuk/tmp/alpine-sqs/opt:/opt/custom roribio16/alpine-sqs:latest
2018-06-21 15:24:25,324 CRIT Set uid to user 0
2018-06-21 15:24:25,324 INFO Included extra file "/etc/supervisor/conf.d/elasticmq.conf" during parsing
2018-06-21 15:24:25,324 INFO Included extra file "/etc/supervisor/conf.d/insight.conf" during parsing
2018-06-21 15:24:25,324 INFO Included extra file "/etc/supervisor/conf.d/sqs-init.conf" during parsing
2018-06-21 15:24:25,330 INFO RPC interface 'supervisor' initialized
2018-06-21 15:24:25,331 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2018-06-21 15:24:25,331 INFO supervisord started with pid 1
2018-06-21 15:24:26,337 INFO spawned: 'sqs-init' with pid 9
2018-06-21 15:24:26,340 INFO spawned: 'elasticmq' with pid 10
2018-06-21 15:24:26,343 INFO spawned: 'insight' with pid 11

> sqs-insight@0.2.1 start /opt/sqs-insight
> node index.js

15:24:27.187 [main] INFO  org.elasticmq.server.Main$ - Starting ElasticMQ server (0.13.8) ...
Loading config file from "/opt/sqs-insight/lib/../config/config_local.json"
Config contains 1 queues.
Adding consumer for default
2018-06-21 15:24:27,364 INFO success: sqs-init entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2018-06-21 15:24:27,364 INFO success: elasticmq entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2018-06-21 15:24:27,365 INFO success: insight entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2018-06-21 15:24:27,365 INFO exited: sqs-init (exit status 0; expected)
listening on port 9325
15:24:28.235 [elasticmq-akka.actor.default-dispatcher-3] INFO  akka.event.slf4j.Slf4jLogger - Slf4jLogger started
Error on queue "default": SQS receive message failed: connect ECONNREFUSED 127.0.0.1:9324
Error on queue "default": SQS receive message failed: connect ECONNREFUSED 127.0.0.1:9324
15:24:29.685 [elasticmq-akka.actor.default-dispatcher-2] INFO  o.e.rest.sqs.TheSQSRestServerBuilder - Started SQS rest server, bind address 0.0.0.0:9324, visible server address * (depends on incoming request path)
15:24:29.755 [elasticmq-akka.actor.default-dispatcher-2] INFO  o.elasticmq.actor.QueueManagerActor - Creating queue QueueData(test,MillisVisibilityTimeout(10000),PT5S,PT0S,2018-06-21T15:24:29.685Z,2018-06-21T15:24:29.685Z,None,None)
15:24:29.761 [elasticmq-akka.actor.default-dispatcher-2] INFO  o.elasticmq.actor.QueueManagerActor - Creating queue QueueData(default,MillisVisibilityTimeout(10000),PT5S,PT0S,2018-06-21T15:24:29.761Z,2018-06-21T15:24:29.761Z,None,None)
15:24:29.763 [main] INFO  org.elasticmq.server.Main$ - === ElasticMQ server (0.13.8) started in 3241 ms ===

And SQS-Insight also shows only default queue.

screen shot 2018-06-21 at 18 45 22

Is it bug or my config is wrong?

roribio commented 6 years ago

Hi,

Thank you for submitting this issue. I appreciate it the detailed report.

I'll take a look shortly.

Thanks, Ronald

tomerf-sndbox commented 6 years ago

@roribio Hi,

According to the elasticmq supervisord settings: -Dconfig.file=/opt/config/elasticmq.conf

Phylu commented 6 years ago

I can confirm this issue. The problem is, that the config file for sqs-insight is loaded from a different location than the /opt/config folder. This is stated in the logs Loading config file from "/opt/sqs-insight/lib/../config/config_local.json"

I created a pull request that fixes this issue (however it is just a quickfix solution and might be handled much smoother by copying the file to the correct location in the first place)

roribio commented 6 years ago

Thank you for your contribution @Phylu, I appreciate it 💥 💯 !

I'll try to find some time to improve how configs are loaded soon.