Rails server keeps getting shut down -- how to run a rails server in the background?

rails
javascript
circle.yml

#1

I’m in the process of switching from 1.0 to 2.0 and having trouble running a background rails server. I need to start one to run our javascript tests. In the old circle.yml we had this:

test:
  post:
    - bin/rails server:
        background: true
    - bin/yarn run test-once

Which I tried to replace with the following steps in the test job in our new config.yml:

- run:
    name: Boot rails server
    command: bin/rails s
    background: true
- run:
    name: Run JS tests
    command: bin/yarn run test-once

But the rails server fails to start and that step always fails with “Step was canceled”. What am I doing wrong?


#2

Hey, I had the same issue, turns out it was because the rails server was throwing an error and when using the background feature the error is swallowed. Try to ssh in your test container and run the command manually to see what is failing. For us it was /bin/rails s not working for some reason, using bundle exec rails s solved our issue.


#3

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.