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

Can't connect to the app no matter what. Deployed through Docker. #724

Open
Jas-SinghFSU opened this issue Nov 23, 2023 · 4 comments
Open

Comments

@Jas-SinghFSU
Copy link

Jas-SinghFSU commented Nov 23, 2023

No matter what I do, I can't access the server. I get connection timeout errors or "refused to connect" errors. My server's local IP address is 10.0.0.239 and that's the address I want to host it at.

No matter what I do, the log for the container says

Ready on http://localhost:3030

Even though I never specified localhost as the domain, it always tells me that the app is read on localhost:3030. I have tried to access localhost:3030 on my server and still get 'The site can't be reached'. I also have my own subdomain.domain.com but when I put that into the DEFAULT_DOMAIN it doesn't work either.

Here are my configs, what am I doing wrong?

Compose config using portainer

version: "3"

services:
  kutt:
    image: kutt/kutt
    depends_on:
      - postgres
      - redis
    command: ["./wait-for-it.sh", "postgres:5432", "--", "npm", "start"]
    ports:
      - "3030:3000"
    env_file:
      - stack.env
    environment:
      DB_HOST: postgres
      DB_NAME: kuttgres
      DB_USER: <db_user>
      DB_PASSWORD: <db_pass>
      REDIS_HOST: redis

  redis:
    image: redis:6.0-alpine
    volumes:
      - redis_data:/data

  postgres:
    image: postgres:12-alpine
    environment:
      POSTGRES_USER: <db_user>
      POSTGRES_PASSWORD: <db_pass>
      POSTGRES_DB: kuttgres
    volumes:
      - postgres_data:/var/lib/postgresql/data

volumes:
  redis_data:
  postgres_data:

docker.env

# App port to run on
PORT=3030

# The name of the site where Kutt is hosted
SITE_NAME=Kutt

# The domain that this website is on
DEFAULT_DOMAIN=0.0.0.0:3030
# Have also tried the following. My local server ip address is 10.0.0.239 (where I want to host it)
#DEFAULT_DOMAIN=10.0.0.239:3030
#DEFAULT_DOMAIN=0.0.0.0
#DEFAULT_DOMAIN=10.0.0.239
#DEFAULT_DOMAIN=0.0.0.0:3030
# And all of the above with http:// in the beginning as well

# Generated link length
LINK_LENGTH=6

# Postgres database credential details
DB_HOST=postgres
DB_PORT=5432
DB_NAME=kuttgres
DB_USER=<db_user>
DB_PASSWORD=<db_pass>
DB_SSL=false

# Redis host and port
REDIS_HOST=redis
REDIS_PORT=6379
REDIS_PASSWORD=
REDIS_DB=

# Disable registration
DISALLOW_REGISTRATION=false

# Disable anonymous link creation
DISALLOW_ANONYMOUS_LINKS=false

# The daily limit for each user
USER_LIMIT_PER_DAY=50

# Create a cooldown for non-logged in users in minutes
# Set 0 to disable
NON_USER_COOLDOWN=0

# Max number of visits for each link to have detailed stats
DEFAULT_MAX_STATS_PER_LINK=5000

# Use HTTPS for links with custom domain
CUSTOM_DOMAIN_USE_HTTPS=false

# A passphrase to encrypt JWT. Use a long and secure key.
JWT_SECRET=<my_secure_key>

# Admin emails so they can access admin actions on settings page
# Comma seperated
ADMIN_EMAILS= <my_emails>

# Invisible reCaptcha secret key
# Create one in https://www.google.com/recaptcha/intro/
RECAPTCHA_SITE_KEY=<my_site_key>
RECAPTCHA_SECRET_KEY=<my_site_secret>

# Google Cloud API to prevent from users from submitting malware URLs.
# Get it from https://developers.google.com/safe-browsing/v4/get-started
GOOGLE_SAFE_BROWSING_KEY=

# Your email host details to use to send verification emails.
# More info on http://nodemailer.com/
# Mail from example "Kutt <[email protected]>". Leave empty to use MAIL_USER
MAIL_HOST=<my_credentials>
MAIL_PORT=<my_credentials>
MAIL_SECURE=true
MAIL_USER=<my_credentials>
MAIL_FROM=<my_credentials>
MAIL_PASSWORD=<my_credentials>

# The email address that will receive submitted reports.
REPORT_EMAIL=<my_credentials>

# Support email to show on the app
CONTACT_EMAIL=<my_credentials>
@kengher
Copy link

kengher commented Mar 12, 2024

DEFAULT_DOMAIN should be 'subdomain.domain.com'
Do you have reverse proxy set up?

@MaffooClock
Copy link

If you look at line 72 of server/server.ts:

console.log(`> Ready on http://localhost:${port}`);

So the "localhost" part is just hard-coded to the console message and doesn't actually represent what interface it is listening on.

But I have the same problem, so I started a shell in the running Docker container:

/usr/src/app # netstat -pant
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 172.30.9.212:49266      172.30.11.197:6379      ESTABLISHED 92/node
tcp        0      0 172.30.9.212:56462      172.30.22.203:443       ESTABLISHED 117/ssm-session-wor
tcp        0      0 172.30.9.212:34610      172.30.22.203:443       ESTABLISHED 69/ssm-agent-worker
tcp        0      0 172.30.9.212:50558      172.30.4.76:6379        ESTABLISHED 92/node
tcp        0      0 172.30.9.212:47344      172.30.8.97:5432        ESTABLISHED 92/node
tcp        0    307 172.30.9.212:56464      172.30.22.203:443       ESTABLISHED 117/ssm-session-wor
tcp        0      0 172.30.9.212:34596      172.30.22.203:443       ESTABLISHED 69/ssm-agent-worker
tcp        0      0 :::8080                 :::*                    LISTEN      92/node

As you can see on the last line, node is listening on all interfaces (using the port I specified). So, still not sure why I can't get it to respond 🤔

@MaffooClock
Copy link

Actually, I just noticed this:

/usr/src/app # netstat -pant
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 :::8080                 :::*                    LISTEN      94/node
tcp        0      0 ::ffff:172.30.7.235:8080 ::ffff:192.168.20.83:64268 ESTABLISHED 94/node
tcp        0      0 ::ffff:172.30.7.235:8080 ::ffff:172.30.16.5:45094 ESTABLISHED 94/node
tcp        0      0 ::ffff:172.30.7.235:8080 ::ffff:172.30.3.230:36746 ESTABLISHED 94/node
tcp        0      0 ::ffff:172.30.7.235:8080 ::ffff:172.30.36.238:11826 ESTABLISHED 94/node

Connections are making it to the container; the 192.168.20.83 is my workstation making a direct connection to the container (172.30.7.235). The other three are AWS load balancers trying to make a connection. But they eventually timeout

So that means the node app is just... ignoring the connections?

@Yuvraj102
Copy link

@Jas-SinghFSU were you able to resolve this issue ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants