5.Views : I can't view my app by visiting http://localhost:8000/welcome

Hi all!
I can’t view my app by visiting http://localhost:8000/welcome in the browser yet I don’t have any error message .
Do you have to change CSS code : I see that there comment , do you change something ?
thanks !
Gif Ruby on Rails Prob output_yBMzUn

There has to be a server responding to your request, yeah? The exercise is meant to start it when you open the exercise.

Let’s see what’s running in a system backing that exercise:

$ ps aux
ccuser        1  0.0  0.0   4512   796 ?        Ss   00:07   0:00 /bin/sh -c python -c "import pandas" && node -e "require('mocha')" && /usr/local/bin/ein -service-port 4000 -http-port 4001
ccuser       30  0.0  0.0 147480 13720 ?        Sl   00:07   0:00 /usr/local/bin/ein -service-port 4000 -http-port 4001
ccuser       37 12.1  0.0 161508 61372 ?        Sl   02:13   0:01 /usr/bin/ruby2.3 bin/rails server -p 4001 -b
ccuser       42  0.0  0.0  18236  3108 pts/0    Ss   02:13   0:00 bash
ccuser       47  0.0  0.0  34428  2772 pts/0    R+   02:13   0:00 ps aux

The process with PID 37 is the rails server. This has probably been killed/crashed in your instance.
If you look at the process with PID 1, you can see it was started 2 hours before 37, 42, 47 - those containers are somewhat persistent. It’s not unthinkable that you just get reconnected to the same one when you reload the page.

Most likely, this issue will have magically resolved itself next time you try, because it’s been a few hours, your instance has probably stopped by now, and trying again gets you a new one.

If not, you could stop it yourself. pkill -u ccuser (kill all processes, effectively logging you out), reloading the page will then get you a new instance which would have a rails server running in it.

Alternatively, you could start the server yourself. You can see the command in ps’s output above: ruby bin/rails server -p 4001 -b

(port 4001 is the one exposed on that system, it gets remapped to 8000 somewhere else)


Or perhaps something’s just down between that system and your browser, blocking it off regardless of whether that rails server is running or not.

A good test of that is using curl from the terminal to send the request from within the system itself:

$ curl localhost:4001/welcome
<!DOCTYPE html>
  <link data-turbolinks-track="true" href="/assets/pages.css?body=1" media="all" rel="stylesheet" />
<link data-turbolinks-track="true" href="/assets/application.css?body=1" media="all" rel="stylesheet" />
  <script data-turbolinks-track="true" src="/assets/jquery.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/jquery_ujs.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/turbolinks.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/communication.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/pages.js?body=1"></script>
<script data-turbolinks-track="true" src="/assets/application.js?body=1"></script>
  <meta content="authenticity_token" name="csrf-param" />
<meta content="PYo7CcGZCQ/gbF7P/zLcnF5ggVkwIAmj6lH2lbFEuz0=" name="csrf-token" />

<div class="main">
  <div class="container">
    <h1>Hello my name is __</h1>
    <p>I make Rails apps.</p>

1 Like

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