MUP + mup-aws-beanstalk - ELB Failing Health Check

EBS Log:
Instance deployment completed successfully.
Then:
Instance id(s) 'i-0f7f000000008f9' did not pass health check after command execution. Aborting the operation.

Following the trail of crumbs to the nginx error log:

2024/05/16 03:37:54 [error] 3477#3477: *1191 connect() failed (111: Connection refused) while connecting to upstream, client: 172.31.39.121, server: , request: "GET / HTTP/1.1", upstream: "http://127.0.0.1:8081/", host: "demo.myproduct.com"

I seem to be missing something about how the PORT assignments should be configured. The ELB is heathy, active, and listening on ports 80 & 443 and properly routing all requests to the instance(s) on port 80 that nginx is apparently listening on. The AWS Reachability Analyzer confirms this. nginx then tries connecting to my upstream Meteor app for some reason on port 8081?!

I tried setting the Meteor PORT to 8081, but when I mup reconfig nginx then switched to looking for an Upstream Server on port 8039?! I tried env.PORT: 80 with no luck.

The instance’s Public IPv4 DNS address gets a: ERR_CONNECTION_TIMED_OUT

Why is nginx even in the mix? The AWS ELB is already doing the load balancing and handling the SSL. So how should I be configuring mup & mup-aws-beanstalk to simply have the ELB communicate directly to my Meteor app’s listening port? (or have nginx proxying on the proper ports)?

MY CONFIG ======================================

Meteor v2.16
mup v1.5.10
mup-aws-beanstalk v0.8.0

module.exports = {
    app: {
        type: 'aws-beanstalk',
        name: 'MYPRODUCT-DEMO',
        path: '../',
        minInstances: 1,
        instanceType: 'm6gd.medium',
        auth: {
            id: 'XXXXXXXXXXXXXXXXXXXXXX',
            secret: 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
        },
        sslDomains: ['demo.myproduct.com'],
        forceSSL: true,
        envName: 'demo-myproduct',
        oldVersions: 3,
        docker: {
            image: 'zodern/meteor:root',
            prepareBundle: true,
            stopAppDuringPrepareBundle: true
        },
        buildOptions: {
            serverOnly: true,
            buildLocation: 'H:/myproduct-build'
        },
        env: {
            ROOT_URL: 'https://demo.myproduct.com',
            PORT: 80,
            SESSION_TIMEOUT_SECONDS: 900,
            MONGO_URL: 'mongodb+srv://myproduct_app:XXXXXXXXXXXX@myproduct-demo.abcdefg.mongodb.net/myproduct?retryWrites=true&w=majority',
            MONGO_OPLOG_URL: 'mongodb+srv://oplog_reader:XXXXXXXXXXXX@myproduct-demo.abcdefg.mongodb.net/local',
            MAIL_URL: 'smtp://app@mg.myproduct.com:XXXXXXXXXXXXXXXXXXXXXXXXX@smtp.mailgun.org:587',
            METEOR_SIGTERM_GRACE_PERIOD_SECONDS: 30
        }
    },
    plugins: ['mup-aws-beanstalk']
}

Hi @cormip, I dropped a short reply on your Github issue too.
I don’t use docker but from my experience with Beanstalk, there are configurations that must be done in AWS directly and can’t be passed directly from your Meteor deployment. However there is a lot that can be done from Meteor side with MUP but I don’t see a customBeanstalkConfig in your script.
This reference to port 8081: http://127.0.0.1:8081 might be related to the internal Healthcheck within AWS.
A couple of things I would do:

  1. Extend the port range for Healthcheck to 200-399
  2. Make sure in the security group inbound policy for your machine, you allow 80 from the sg-… of your ELB.
    Unfortunately, I don’t think I could help you with this type of async forum conversation so if you don’t manage to fix it, we could have a look together.
    If you are already a Beanstalk pro, please disregard my comments as they are addressed, I guess, to more entry level users.

SOLVED: I’d missed a somewhat cryptic error entry when reviewing mup beanstalk logs. My “production” REDIS server didn’t have the same user permissions as my development REDIS server, so my app failed to start. Once I fixed the REDIS issue, the app started up, and everything works.

1 Like