2 years ago
Even though my app shows that it's working in the deploy logs, the app only receives traffic after a restart or redeploy. If I add a healthcheck, the deploy fails completely because that first deploy can't access the web server seemingly.
My repo is at https://github.com/reesericci/heroku-united (a mirror of Codeberg)
24 Replies
2 years ago
Build logs:```
[Region: us-west1]
=========================
Using Detected Dockerfile
=========================
context: 09a36b00c611f29f13c79576142b62b7
#0 building with "default" instance using docker driver
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile: 1.98kB done
#1 DONE 0.0s
#2 resolve image config for docker-image://docker.io/docker/dockerfile:1
#2 DONE 0.5s
#3 docker-image://docker.io/docker/dockerfile:1@sha256:a57df69d0ea827fb7266491f2813635de6f17269be881f696fbfdf2d83dda33e
#3 CACHED
#4 [internal] load metadata for registry.docker.com/library/ruby:3.3-slim
#4 DONE 0.6s
#5 [internal] load .dockerignore
#5 transferring context: 896B done
#5 DONE 0.0s
#6 [base 1/3] FROM registry.docker.com/library/ruby:3.3-slim@sha256:4d611590cb3dc3211dc2e42c87347970c0ae9f7ad9c3db17a121d5996296f8ff
#6 DONE 0.0s
#7 [internal] load build context
#7 transferring context: 865.90kB 0.0s done
#7 DONE 0.0s
#8 [build 2/6] COPY Gemfile Gemfile.lock ./
#8 CACHED
#9 [build 3/6] RUN bundle install && rm -rf ~/.bundle/ "/usr/local/bundle"/ruby/*/cache "/usr/local/bundle"/ruby/*/bundler/gems/*/.git && bundle exec bootsnap precompile --gemfile
#9 CACHED
#10 [build 5/6] RUN bundle exec bootsnap precompile app/ lib/
#10 CACHED
#11 [stage-2 2/4] COPY --from=build /usr/local/bundle /usr/local/bundle
#11 CACHED
#12 [stage-2 3/4] COPY --from=build /rails /rails
#12 CACHED
#13 [stage-2 1/4] RUN rm -rf /var/lib/apt/lists /var/cache/apt/archives
#13 CACHED
#14 [build 1/6] RUN apt-get install --no-install-recommends -y build-essential git pkg-config
#14 CACHED
#15 [build 4/6] COPY . .
#15 CACHED
#16 [base 2/3] WORKDIR /rails
```
2 years ago
Deploy logs:=> Booting Puma
=> Rails 7.2.0.alpha application starting in production
=> Run bin/rails server --help for more startup options
Puma starting in single mode...
* Puma version: 6.4.2 (ruby 3.3.2-p78) ("The Eagle of Durango")
* Min threads: 3
* Max threads: 3
* Environment: production
* PID: 7
* Listening on http://0.0.0.0:3000
Use Ctrl-C to stop
- Gracefully stopping, waiting for requests to finish
Exiting
it was exiting after the 15min healthcheck elapsed - it was running that whole time
2 years ago
At members.hardfork.ngo/up , a prod instance not running on railway, it just returns a 200 with a green background for HTML browsers. It's just the default healthcheck built into rails
Attachments
2 years ago
Does /up have some kind of middleware on it that is determining to send a 404 to Railway's health check request instead of a 200?
If you removed the health check, can you hit the /up endpoint after it's deployed?
2 years ago
yes - but I have to redeploy the app for traffic to be properly routed
2 years ago
like if I go turn off the healthcheck, restart, the app will deploy because it will be the second start of the app for whatever reason
2 years ago
but if I turn off the healthcheck, on the first deploy it won't work
2 years ago
Can you remove the health check but turn on the edge proxy in the service settings.
2 years ago
sure one sec, should I create an entirely new project as to recreate that first deploy
2 years ago
Alright I'm getting a 502 with no deploy logs now https://united-production-79a2.up.railway.app/
2 years ago
yes, PORT=3000Also, do you need something for me to give you access to the project?
2 years ago
i'm on legacy
2 years ago
CMD ["./bin/rails", "server"]
2 years ago
In the deploy logs for older deploys, it shows the puma output but on this new deploy, it's empty
2 years ago
I should also probably state that if I can fnagle it to work here, that's not my goal - I want to make a repeatable template so it working the first time, every time is important
2 years ago
There is some misconfiguration somewhere, I just don't know enough about puma to help you solve this efficiently.
2 years ago
Alright thank you
2 years ago
I solved this by enabling Thruster in my dockerfile config and editing the bin/dockerfile-entrypoint to bind the PORT variable to HTTP_PORT for thruster. Here's my dockerfile-entrypoint:#!/bin/bash -e
# If running the rails server then create or migrate existing database
if [ "${*}" == "bundle exec thrust ./bin/rails server" ]; then
./bin/rails db:prepare
fi
if [[ -n "${RAILWAY_SERVICE_ID}" ]]; then
echo "Detected railway environment with port ${PORT}"
exec env HTTP_PORT="${PORT}" "${@}"
else
echo "Not running in Railway, exec-ing as normal"
exec "${@}"
fiand my repo above has all the other auxillary files if you need any help
2 years ago
Thank you very much for the update, i'm glad you were able to get this to work!Sorry again that I wasn't able to be of more help.
