Report this

What is the reason for this report?

App platform - Process doesn't launch, logs stay in an empty state but the console is available.

Posted on January 9, 2021

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.

The issue

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

  • When I deploy the application it deploys successfully (“Deployed successfully!”) is returned.
  • The “logs” page is completely empty.
  • When I go to the console I can execute bundle exec ruby app.rb which launches the application and it runs fine on the DigitalOcean machine.
  • There are no errors in the Deploy Log, it just doesn’t launch the application.

What I’ve tried

  • Create a Docker image of the application (Works locally in a Docker container) which I pushed to DigitalOcean’s container Registry
  • Configured bundle exec ruby app.rb as Run Command (With and without a Dockerfile)

My 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!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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:

  • Check App Specification:

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.

  • Environment Variables:

Ensure all necessary environment variables, especially those related to connecting to external services like RabbitMQ, are correctly set up in the App Platform environment.

  • Dependency Issues:

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.

  • Log and Debug:

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
  • Build Script:

Add a build script to your app spec and log the output. This can also be a place where things might be going wrong.

  • Shell Access:

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.

  • Docker Image Locally:

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

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.