openpredictionmarkets / socialpredict

Easy to Deploy Prediction Market Platform
https://github.com/openpredictionmarkets/socialpredict
MIT License
55 stars 10 forks source link

NGinx 404 Error on Staging #375

Open pwdel opened 4 hours ago

pwdel commented 4 hours ago

https://brierfoxforecast.com/

404 Not Found nginx/1.27.2

After redeploy.

pwdel commented 4 hours ago
root@hostname:~/path-to-deployment# docker ps -a
CONTAINER ID   IMAGE                    COMMAND                  CREATED         STATUS         PORTS                                                                      NAMES
<container_id>   nginx:latest             "/docker-entrypoint.…"   <time>          Up <time>      0.0.0.0:80->80/tcp, :::80->80/tcp, 0.0.0.0:443->443/tcp, :::443->443/tcp   nginx-container
<container_id>   frontend-image           "/docker-entrypoint.…"   <time>          Up <time>      80/tcp, 0.0.0.0:5173->5173/tcp, :::5173->5173/tcp                          frontend-container
<container_id>   backend-image            "./supervisor.sh ref…"   <time>          Up <time>      0.0.0.0:8086->8080/tcp, :::8086->8080/tcp                                  backend-container
<container_id>   postgres                 "docker-entrypoint.s…"   <time>          Up <time>      0.0.0.0:5433->5432/tcp, :::5433->5432/tcp                                  postgres-container
<container_id>   certbot/certbot:latest   "/bin/sh -c 'trap ex…"   <time>          Up <time>      80/tcp, 443/tcp                                                            certbot-container
root@hostname:~/path-to-deployment# docker compose logs nginx-container
no configuration file provided: not found
root@hostname:~/path-to-deployment# docker compose logs frontend-container
no configuration file provided: not found
root@hostname:~/path-to-deployment# docker compose logs backend-container
no configuration file provided: not found
root@hostname:~/path-to-deployment# docker network inspect bridge
[
    {
        "Name": "bridge",
        "Id": "<network_id>",
        "Created": "<timestamp>",
        "Scope": "local",
        "Driver": "bridge",
        "EnableIPv6": false,
        "IPAM": {
            "Driver": "default",
            "Options": null,
            "Config": [
                {
                    "Subnet": "172.17.0.0/16",
                    "Gateway": "172.17.0.1"
                }
            ]
        },
        "Internal": false,
        "Attachable": false,
        "Ingress": false,
        "ConfigFrom": {
            "Network": ""
        },
        "ConfigOnly": false,
        "Containers": {},
        "Options": {
            "com.docker.network.bridge.default_bridge": "true",
            "com.docker.network.bridge.enable_icc": "true",
            "com.docker.network.bridge.enable_ip_masquerade": "true",
            "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
            "com.docker.network.bridge.name": "docker0",
            "com.docker.network.driver.mtu": "1500"
        },
        "Labels": {}
    }
]
root@hostname:~/path-to-deployment# docker logs nginx-container
/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
/docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf
10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf
/docker-entrypoint.sh: Sourcing /docker-entrypoint.d/15-local-resolvers.envsh
/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh
20-envsubst-on-templates.sh: Running envsubst on /etc/nginx/templates/app.conf.template to /etc/nginx/conf.d/app.conf
/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh
/docker-entrypoint.sh: Configuration complete; ready for start up
<date> [notice] 1#1: using the "epoll" event method
<date> [notice] 1#1: nginx/1.27.2
<date> [notice] 1#1: built by gcc 12.2.0 (Debian 12.2.0-14)
<date> [notice] 1#1: OS: Linux 5.15.0-94-generic
<date> [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:1048576
<date> [notice] 1#1: start worker processes
<date> [notice] 1#1: start worker process 35
<ip_address> - - [<date>] "GET /markets HTTP/1.1" 404 555 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36" "-"
<ip_address> - - [<date>] "GET /favicon.ico HTTP/1.1" 200 318 "https://yourdomain.com/markets" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36" "-"
<ip_address> - - [<date>] "GET /markets HTTP/1.1" 404 555 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36" "-"
<ip_address> - - [<date>] "GET / HTTP/1.1" 301 169 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/92.0.4515.159 Safari/537.36" "-"
<ip_address> - - [<date>] "GET / HTTP/1.1" 200 1677 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/92.0.4515.159 Safari/537.36" "-"
<date> [warn] 35#35: *6 an upstream response is buffered to a temporary file /var/cache/nginx/proxy_temp/1/00/0000000001 while reading upstream, client: <ip_address>, server: yourdomain.com, request: "GET /assets/index-Dwkl2sxq.js HTTP/1.1", upstream: "http://<internal_ip>:80/assets/index-Dwkl2sxq.js", host: "yourdomain.com", referrer: "https://yourdomain.com/"
<ip_address> - - [<date>] "GET /assets/index-Dwkl2sxq.js HTTP/1.1" 200 798372 "https://yourdomain.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/92.0.4515.159 Safari/537.36" "-"
<ip_address> - - [<date>] "GET /assets/index-myH-cTZe.css HTTP/1.1" 200 23165 "https://yourdomain.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/92.0.4515.159 Safari/537.36" "-"
<ip_address> - - [<date>] "GET /assets/BrierFoxLogo-rq0RhiI8.png HTTP/1.1" 200 43329 "https://yourdomain.com/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/92.0.4515.159 Safari/537.36" "-"
root@hostname:~/path-to-deployment# docker exec -it nginx-container cat /etc/nginx/nginx.conf

user  nginx;
worker_processes  auto;

error_log  /var/log/nginx/error.log notice;
pid        /var/run/nginx.pid;

events {
    worker_connections  1024;
}

http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  65;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}
pwdel commented 4 hours ago

I suspect the nginx config is not being written properly anymore.

I seem to recall proxy pass being written in there. But then again, I was not really familiar with how the new setup uses react static build files and now nginx' config file should reflect this.