jlesage / docker-nginx-proxy-manager

Docker container for Nginx Proxy Manager
MIT License
785 stars 178 forks source link

nginx-proxy-manager with crowdsec volumes issue #250

Open adidgit opened 2 years ago

adidgit commented 2 years ago

Hi,

I am trying to integrate nginx-proxy-manager with crowdsec. For the time being I am only interested in croudsec parcing my logs (won't use a bouncher yet)

My docker compose for nginx-proxy-manager

version: '3'
services:
  nginx-proxy-manager:
    image: jlesage/nginx-proxy-manager:latest
    ports:
      - "8181:8181"
      - "8080:8080"
      - "4443:4443"
    volumes:
      - "/srv/DockerAppData/nginx-proxy-manager:/config:rw"
    restart: unless-stopped

My docker compose for crowdsec

version: '3'
services:
  crowdsec:
    image: crowdsecurity/crowdsec:latest
    container_name: crowdsec
    environment:
      - COLLECTIONS= "crowdsecurity/nginx"
    volumes:
      - /srv/DockerAppData/crowdsec/crowdsec-db:/var/lib/crowdsec/data/
      - /srv/DockerAppData/crowdsec/crowdsec-config:/etc/crowdsec/
      - nginx-proxy-manager-logs:/srv/DockerAppData/nginx-proxy-manager/:ro
    restart: unless-stopped

volumes:
  nginx-proxy-manager-logs:

When I check if the volume is mounted in crowdsec container all is fine

bash-5.1# df -h
Filesystem                Size      Used Available Use% Mounted on
overlay                  52.7G     24.2G     25.8G  48% /
tmpfs                    64.0M         0     64.0M   0% /dev
shm                      64.0M         0     64.0M   0% /dev/shm
/dev/md127              916.6G     97.4G    819.3G  11% /etc/crowdsec
/dev/sdb1                52.7G     24.2G     25.8G  48% /etc/resolv.conf
/dev/sdb1                52.7G     24.2G     25.8G  48% /etc/hostname
/dev/sdb1                52.7G     24.2G     25.8G  48% /etc/hosts
/dev/md127              916.6G     97.4G    819.3G  11% /var/lib/crowdsec/data
/dev/sdb1                52.7G     24.2G     25.8G  48% /srv/DockerAppData/nginx-proxy-manager
tmpfs                     3.6G         0      3.6G   0% /proc/asound
tmpfs                     3.6G         0      3.6G   0% /proc/acpi
tmpfs                    64.0M         0     64.0M   0% /proc/kcore
tmpfs                    64.0M         0     64.0M   0% /proc/keys
tmpfs                    64.0M         0     64.0M   0% /proc/timer_list
tmpfs                     3.6G         0      3.6G   0% /sys/firmware

But when aquis.yaml is loaded it complains that can't find logs matching the pattern /srv/DockerAppData/nginx-proxy-manager/log/*.log

Checking further I see that the voulme is mounted in crowdsec container but is empty

bash-5.1# ls -ltr /srv/DockerAppData/nginx-proxy-manager
total 0

Any idea what can be wrong here?

Normanras commented 2 years ago

Hey, just saw this cause I'm trying to set up crowdsec as well. In my container for npm, my logs aren't in that directory... they are in /var/log and then there are some dirs. Next level down, nginx just has error.log and in /var/log there is a folder with apt with a term.log file. I wonder why your log directory tree would be different.

I'm an idiot. I used a docker image from a different creator.

As to your question, how about permissions in the new mount? What PID is in charge of the container?

LePresidente commented 1 year ago

your crowdsec container is mounting a volume instead of the same bind directory as your npm container.

Also think this can be closed as its not really relevant to this project.