Hi,
I am trying to launch a Ruby worker on App Platform. However, I’m facing an issue of which I’m unable to figure out why.
I have a simple Ruby application that connects to a RabbitMQ channel (Hosted on a RabbitMQ as a Service provider, not DigitalOcean) and executes jobs based on those messages. Probably this is not very relevant because even when I comment out this part of the code and just run a very simple:
loop do
puts "sleep"
sleep 6
end
What I’m facing
bundle exec ruby app.rb which launches the application and it runs fine on the DigitalOcean machine.What I’ve tried
bundle exec ruby app.rb as Run Command (With and without a Dockerfile)FROM ruby:2.6.3
RUN apt-get update -qq && apt-get install -y build-essential
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN apt-get update && apt-get install yarn -y
RUN mkdir /app
WORKDIR /app
RUN gem install bundler
COPY Gemfile /app/Gemfile
COPY Gemfile.lock /app/Gemfile.lock
RUN bundle install
COPY . /app
CMD ["bundle", "exec", "ruby", "app.rb"]
Does anyone here have a clue what I’m doing wrong or what’s going wrong?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi there,
The issue you’re describing seems odd indeed, especially since the application appears to deploy successfully according to the platform, yet does not actually log any output or apparently run as expected.
Here are a few steps you might take to troubleshoot or potentially resolve the issue:
Ensure that your app’s specification in the App Platform is correctly defined. The run command should be accurately set to initiate your app. If you’re using a Dockerfile, make sure your CMD or ENTRYPOINT directives are set correctly, as you’ve shown.
Ensure all necessary environment variables, especially those related to connecting to external services like RabbitMQ, are correctly set up in the App Platform environment.
Ensure that all dependencies are correctly installed during the build process. Sometimes, certain gems or packages may not install correctly due to platform-specific issues.
Even though you mention logs are not outputting, sometimes explicitly logging to a file might help troubleshoot if the standard output is not being captured. Add explicit logging to a file in your script to see if it can capture what’s happening post-deployment.
log_file = File.open("app.log", "a")
STDOUT.reopen(log_file)
STDERR.reopen(log_file)
And then try running a simple script in your app.rb to validate:
loop do
puts "Alive..."
sleep 6
end
Add a build script to your app spec and log the output. This can also be a place where things might be going wrong.
Since you have shell access and the app runs fine when manually started, there might be a disconnect between the environment when you manually run it and when the App Platform does. Ensure the environment is identical in both scenarios.
Since your Docker image works fine locally, validate all network connections from the app in the App Platform to any external services (like RabbitMQ) are correctly configured and not being blocked.
Best,
Bobby
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.