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

502 Bad Gateway #462

Closed
kaka-ruto opened this issue Sep 12, 2023 · 1 comment
Closed

502 Bad Gateway #462

kaka-ruto opened this issue Sep 12, 2023 · 1 comment

Comments

@kaka-ruto
Copy link

kaka-ruto commented Sep 12, 2023

I am getting these error logs from kamal traefik logs

2023-09-12T21:15:05.036223800Z time="2023-09-12T21:15:05Z" level=debug msg="'502 Bad Gateway' caused by: dial tcp 172.17.0.3:3000: connect: connection refused"
2023-09-12T21:15:05.036424360Z time="2023-09-12T21:15:05Z" level=debug msg="New attempt 2 for request: /" middlewareName=hp-web-retry@docker middlewareType=Retry
2023-09-12T21:15:05.407562844Z time="2023-09-12T21:15:05Z" level=debug msg="'502 Bad Gateway' caused by: dial tcp 172.17.0.3:3000: connect: connection refused"

Here is my deploy.yml

# Name of your application. Used to uniquely configure containers.
service: hp

# Name of the container image.
image: nayvy/hp

# Deploy to these servers.
servers:
  web:
    hosts:
      - 195.x.y.206


# Credentials for your image host.
registry:
  # Specify the registry server, if you're not using Docker Hub
  server: ghcr.io
  username: nayvy
  password:
    - KAMAL_REGISTRY_PASSWORD

builder:
  args:
    RUBY_VERSION: 3.2.2
    RAILS_ENV: production
  secrets:
    - KAMAL_REGISTRY_PASSWORD
  cache:
    type: registry
  # multiarch: false
  remote:
    arch: amd64
    host: ssh://root@195.x.y206

# Configure a custom healthcheck (default is /up on Rails 7, change when you upgrade)
healthcheck:
  path: /

# Inject ENV variables into containers (secrets come from .env).
env:
  clear:
    RAILS_LOG_TO_STDOUT: 1
    RAILS_SERVE_STATIC_FILES: 1
  secret:
    - RAILS_MASTER_KEY
    - POSTGRES_USER
    - POSTGRES_PASSWORD
    - POSTGRES_DB
    - POSTGRES_HOST
    - DATABASE_URL

My database is running on a remote server and I'm connecting to it using the DATABASE_URL string

I cannot access the app from my custom domain nor the IP

@kaka-ruto
Copy link
Author

kaka-ruto commented Sep 14, 2023

Turns our the issue was sassc that the administrate gem uses, conflicting with tailwindcss-rails gem, hence I was not able to build the image.

Initially though, the error messages displayed during deploy showed no hints at all, it just said container unhealthy, could not connect to localhost, so I had no way of knowing it was a sassc asset compilation issue until I bisected the code.

But I'm closing the issue since it's fixed. This is the issue and the solution thoughtbot/administrate#2091 (comment)

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

1 participant