mataroa-blog / mataroa

Naked blogging platform
https://mataroa.blog
GNU Affero General Public License v3.0
258 stars 22 forks source link

Docker compose steps seem successful but path gives 400 bad request #59

Closed ctkcoding closed 2 months ago

ctkcoding commented 6 months ago

Setting up for the first time and made the .envrc edits listed in the readme. I ran docker-compose up -d and the postgres and mataroa containers are booting and health, but after the mataroa-web container boots I'm unable to reach it on the port that I've set aside for it. I'm seeing my requests to any url/path show in the logs but I can't get anything but a 400. Is there some env var that I could have missed setting up here?

[30/Mar/2024 02:54:59] "GET /blog HTTP/1.1" 400 0
Quit the server with CONTROL-C.
Starting development server at http://0.0.0.0:8000/
Django version 5.0.2, using settings 'mataroa.settings'
March 30, 2024 - 02:54:25
System check identified no issues (0 silenced).
Watching for file changes with StatReloader
0 static files copied to '/code/static', 128 unmodified, 99 post-processed.
  Applying sessions.0001_initial... OK
Performing system checks...
Bad Request: /blog
[30/Mar/2024 02:54:54] "GET / HTTP/1.1" 400 0
Bad Request: /
[30/Mar/2024 02:54:33] "GET / HTTP/1.1" 400 0
sirodoht commented 6 months ago

Hi @ctkcoding! Thank you for opening this issue. Sorry the README has inadequate Docker instructions. I have now updated them, so hopefully they make more sense. Here is the updated readme: https://github.com/mataroa-blog/mataroa/blob/3daa50897373e5e40d997a6b23d7f206d98bd96f/README.md#development

There is probably something missing in your configuration, the subdomain/hosts set up. See instructions on how to fix this here: https://github.com/mataroa-blog/mataroa/blob/3daa50897373e5e40d997a6b23d7f206d98bd96f/README.md#set-up-subdomains

Essentially, because mataroa works primarily with subdomains, one cannot access the basic web app using the standard http://127.0.0.1:8000/http://localhost:8000/http://0.0.0.0:8000 URLs. To make it work, we have to add a few custom entries on our /etc/hosts system file. The instruction link above describes how to do that.

Let me know if that's helpful!

ratsclub commented 2 months ago

I had the same problem with the Docker setup, but it worked just fine running python manage.py runserver outside the container. I'll try to investigate why this happens.

ratsclub commented 2 months ago

From what I could gather, you don't have LOCALDEV set to 1 if you follow step-by-step of the documentation. If you are still interested on this, try hardcoding LOCALDEV = 1 on settings.py and see if it works.

@sirodoht We can either set it to 1 by default on the docker-compose.yml file or set env_file: .envrc.