helpyio / helpy

Helpy is a modern, open source helpdesk customer support application. Features include knowledgebase, community discussions and support tickets integrated with email.
http://helpy.io/?source=ghh
MIT License
2.37k stars 498 forks source link

logo not loading, always 404 #2052

Closed gboscaro-imtech closed 3 years ago

gboscaro-imtech commented 3 years ago

I set up a small server in digital ocean to run Helpy on Docker. Everything works but the logos do not load, I always get 404 errors on the browser console.

My configuration:

docker-compose

version: '3.6'

services:

    helpy:
        image: helpy/helpy:release-2.8.0
        container_name: helpy
        hostname: helpy
        restart: always
        volumes:
            - rails-assets:/helpy/public:z
        depends_on:
            - postgres
        env_file: .env
        ports:
            - "8080:8080"
        networks:
            - helpdesk

    postgres:
        container_name: postgres
        hostname: postgres
        image: postgres:12
        restart: always
        env_file: .env
        volumes:
            - ./postgres:/var/lib/postgresql/data
        networks:
            - helpdesk

    caddy:
        image: webwurst/caddy:0.9-beta.1
        container_name: caddy
        hostname: caddy
        restart: always
        depends_on:
            - helpy
        volumes:
            - ./config/caddy/Caddyfile:/etc/caddy/Caddyfile
        env_file: .env
        volumes_from:
            - helpy:ro
        expose:
            - 80
        networks:
            - helpdesk        

    nginx:
        image: nginx:1.19.10-alpine
        restart: always
        container_name: nginx
        hostname: nginx
        ports:
            - "80:80"
            - "443:443"
        depends_on:
            - helpy
        volumes:
            - ./config/nginx:/etc/nginx/conf.d
            - ./config/certbot/conf:/etc/letsencrypt
            - ./config/certbot/www:/var/www/certbot
            - ./logs/nginx:/var/log/nginx/
        command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"            
        networks:
            - helpdesk

    certbot:
        image: certbot/certbot
        container_name: certbot
        hostname: certbot
        restart: always
        volumes:
            - ./config/certbot/conf:/etc/letsencrypt
            - ./config/certbot/www:/var/www/certbot
            - ./logs/certbot:/var/log/letsencrypt
        # Auto-renewal ogni 12h
        entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"        
        networks:
            - helpdesk

volumes:
    rails-assets:
        driver: local
networks:
    helpdesk:
        driver: bridge

.env

POSTGRES_HOST=postgres
POSTGRES_PORT=5432
POSTGRES_DB=helpy
POSTGRES_USER=helpy
POSTGRES_PASSWORD=
SECRET_KEY_BASE=
REMOTE_STORAGE=false
DO_NOT_PREPARE=false
VIRTUAL_HOST=
VIRTUAL_NETWORK=nginx-proxy
VIRTUAL_PORT=8080
LETSENCRYPT_HOST=
LETSENCRYPT_EMAIL=

nginx app.conf

server {
    listen 80;
    server_name ......;
    access_log /var/log/nginx/access.log;
    client_max_body_size 100M;

    # Redirect https
    location / {
        return 301 https://$host$request_uri;
    }   

    location /.well-known/acme-challenge/ {
        root /var/www/certbot;
    } 
}

server {
    listen 443 ssl http2;
    server_name .....;
    access_log /var/log/nginx/access.log;
    client_max_body_size 100M;

    location / {
        proxy_pass http://helpy:8080/;
    }

    # RSA certificate from Certbot
    ssl_certificate /etc/letsencrypt/live/...../fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/....../privkey.pem;

    # Let's Encrypt Nginx best-practice configs
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
}

Caddyfile


0.0.0.0:80 {
  tls off
  root /helpy/public

  header /assets {
    gzip
    Expires "Thu, 31 Dec 2037 23:55:55 GMT"
    Cache-Control public
  }

  header /uploads

  proxy / helpy:8080/ {
    except /assets
    except /uploads
    header_upstream Host {host}
    header_upstream X-Real-IP {remote}
    header_upstream X-Forwarded-Proto {scheme}
  }
  log stdout
}

Any help?

Regards

gboscaro-imtech commented 3 years ago

At the moment I solved by setting this env variable on the docker-compose:

RAILS_SERVE_STATIC_FILES=true

This is not the correct way of doing this but nothing else worked.