Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

APPLICATION_ROOT setting does not work #1123

Closed
malorambo opened this issue Jan 10, 2023 · 7 comments
Closed

APPLICATION_ROOT setting does not work #1123

malorambo opened this issue Jan 10, 2023 · 7 comments

Comments

@malorambo
Copy link

Hello !

Trying to setup the app on a Debian 11 machine, I cannot find out how to get the APPLICATION_ROOT setting working with nginx. I set it up with APPLICATION_ROOT = "accounting", but nginx will redirect me to my.domain.tld/accounting/accounting/, and will return a 404 NOT FOUND for every file in static (looking for them into accounting/static/). I tried to tweak the nginx conf.d/ihatemoney.conf file, or even copy the whole static/ folder to accounting/static/ but it won't solve anything.

Here is the /etc/nginx/conf.d/ihatemoney.conf for information : (almost identical to the default generated file)

server {
    server_name my.domain.tld;  # (set up correctly)
    keepalive_timeout 5;

    location /static/ {
        alias   /home/my-user/ihatemoney/lib/python3.9/site-packages/ihatemoney/static/;
    }
    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_redirect off;
        proxy_connect_timeout 90;
        proxy_send_timeout 180;
        proxy_read_timeout 180;
        proxy_buffer_size 16k;
        proxy_buffers 8 16k;
        proxy_busy_buffers_size 32k;
        proxy_intercept_errors on;
        if (!-f $request_filename) {
            proxy_pass http://ihatemoney_backend;
            break;
        }
    }
}

upstream ihatemoney_backend {
        server unix:/tmp/ihatemoney.gunicorn.sock;
}

Is there any chance I messed up somewhere with nginx ?

@Glandos
Copy link
Member

Glandos commented Jan 28, 2023

You can try with :

proxy_pass http://ihatemoney_backend/;

With a trailing slash. But I see no accounting in you nginx.conf, is this set in the gunicorn configuration?

@haivala
Copy link

haivala commented Mar 17, 2023

I have same problem but I'm using traefik

@haivala
Copy link

haivala commented Mar 17, 2023

I copied the entrypoint.sh to my local comp from the docker container and added APPLICATION_ROOT in it. Then used that file to boot up the docker container by mounting it to the container with docker-compose and pointing the entrypypoint to it.

@zorun
Copy link
Collaborator

zorun commented Jul 13, 2023

What's the conclusion here? Did somebody got APPLICATION_ROOT to work?

We have unit tests for this feature (since #358 I believe), so it it doesn't actually work, we need to improve the test.

@haivala
Copy link

haivala commented Jul 14, 2023

as I explained already. APPLICATION_ROOT needs to be added in https://github.com/spiral-project/ihatemoney/blob/master/conf/entrypoint.sh

@zorun
Copy link
Collaborator

zorun commented Jul 14, 2023

Right, that makes sense, fixed in #1189

@malorambo were you also using Docker / docker-compose?

@zorun
Copy link
Collaborator

zorun commented Jul 30, 2023

Closing, feel free to reopen if there is still a problem.

@zorun zorun closed this as completed Jul 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants