forem / forem

For empowering community 🌱
https://forem.com
GNU Affero General Public License v3.0
21.95k stars 4.03k forks source link

Docker setup: Unable to run 'seed' or 'sidekiq' containers due to "Received 403 from http://web:3000" #9604

Closed timorthi closed 4 years ago

timorthi commented 4 years ago

Describe the bug

I'm unable to set up the project using docker-compose on macOS. Once the dev_web container is running the Rails server, the dev_seed and dev_sidekiq containers print out the following error:

Received 403 from http://web:3000

The 403 keeps dockerize in its "wait" loop because it's expected behavior. Out of curiosity I ran a cURL command from the dev_seed container (docker-compose exec seed curl -I <web_container_ip>:3000), and got a 200 OK. I used this link to retrieve the web container's IP.

Curious if anyone has run into this before? I'm not sure what I'm missing here.

To Reproduce

Clone the repo and run bin/container-setup. I was following the setup instructions here.

Expected behavior

When dev_web is "ready", aka responding to requests at localhost:3000:

Screenshots Screen Shot 2020-08-02 at 5 35 02 PM

Desktop (please complete the following information):

github-actions[bot] commented 4 years ago

Thanks for the issue! We'll take your request into consideration and follow up if we decide to tackle this issue.

To our amazing contributors: issues labeled type: bug are always up for grabs, but for feature requests, please wait until we add a ready for dev before starting to work on it.

To claim an issue to work on, please leave a comment. If you've claimed the issue and need help, please ping @forem/oss and we will follow up within 3 business days.

For full info on how to contribute, please check out our contributors guide.

jdoss commented 4 years ago

What was the full response from your curl command?

timorthi commented 4 years ago

@jdoss Here are the headers:

HTTP/1.1 200 OK
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Download-Options: noopen
X-Permitted-Cross-Domain-Policies: none
Referrer-Policy: strict-origin-when-cross-origin
Cache-Control: public, no-cache
Surrogate-Control: max-age=600, stale-while-revalidate=30, stale-if-error=86400
Surrogate-Key: main_app_home_page
Content-Type: text/html; charset=utf-8
Vary: Accept-Encoding
ETag: W/"0d7056e39b7be2c49d064ac14576354b"
Content-Security-Policy: connect-src 'self' https: http://localhost:3035 ws://localhost:3035
X-Request-Id: c7afe184-c611-4dc3-8667-feaf9216e9eb
X-Runtime: 19.674852

The response body was a HTML render of the home page. I didn't see anything out of the ordinary on the dev_web container's stdout.

jdoss commented 4 years ago

What happens if you enter into the sidekiq container while it is in the loop and run the curl from there?

docker exec -it sidekiq /bin/bash
curl http://web:3000

and report back.

timorthi commented 4 years ago

Here is the HTML body:

<body>

<header>
  <h1>Blocked host: web</h1>
</header>
<div id="container">
  <h2>To allow requests to web, add the following to your environment configuration:</h2>
  <pre>config.hosts &lt;&lt; "web"</pre>
</div>

</body>
jdoss commented 4 years ago

Burn down everything docker-compose down and then pull https://github.com/forem/forem/pull/9624 and run container-setup again.

timorthi commented 4 years ago

@jdoss It worked, thank you! Had to docker volume prune to reset the Postgres user, but otherwise the seed container did its thing and sidekiq is up and running 💯

jdoss commented 4 years ago

Wonderful! I'll close this issue and get that PR merged tomorrow.