graphite-project / docker-graphite-statsd

Official Docker image for Graphite
MIT License
479 stars 174 forks source link

nginx config volume causes conflicts with version upgrade #92

Closed languitar closed 4 years ago

languitar commented 5 years ago

Is there any reason for managing /etc/nginx explicitly as a volume? After switching from an old non-alpine release to a current one I had to search a long time why the container didn't start just to find out that the outdated config file left over in the docker volume with the user change for nginx caused the issue. From my perspective, the nginx configuration file is an internal detail of the container and just something random that ensures that the proper ports are exposed. I really don't see why users will remain on old version of that file when upgrading their containers, even if the new version contains important bug fixes.

deniszh commented 5 years ago

Well, it was a separate volume before and has some use-cases. I would keep it like this, hence it will require separate attention during major upgrades.

xiaodiannao commented 5 years ago

@languitar I also have problems with nginx after updating from an older version to this newer version. How did you solve your problem?

I'm getting the following error:

statsd_1       | nginx: [emerg] getpwnam("www-data") failed in /etc/nginx/nginx.conf:1
statsd_1       | "Invalid unit 'min' in section [Carbon] in /opt/graphite/conf/storage-schemas.conf"
statsd_1       | Starting carbon-cache (instance a)
statsd_1       | 07/11/2019 10:57:50 :: [console] Starting factory CarbonClientFactory(127.0.0.1:2004:None)
statsd_1       | 07/11/2019 10:57:50 :: [clients] CarbonClientFactory(127.0.0.1:2004:None)::startedConnecting (127.0.0.1:2004)
statsd_1       | 07/11/2019 10:57:50 :: [console] <twisted.internet.tcp.Connector instance at 0x7f2583b50f90 disconnected IPv4Address(type='TCP', host='127.0.0.1', port=2004)> will retry in 5 seconds
statsd_1       | 07/11/2019 10:57:50 :: [clients] CarbonClientFactory(127.0.0.1:2004:None)::clientConnectionFailed (127.0.0.1:2004) Connection was refused by other side: 111: Connection refused.
statsd_1       | 07/11/2019 10:57:50 :: [clients] Destination is down: 127.0.0.1:2004:None (9/5)
statsd_1       | 07/11/2019 10:57:50 :: [console] Stopping factory CarbonClientFactory(127.0.0.1:2004:None)

best regards

deniszh commented 5 years ago

@xiaodiannao : replace Nginx config with proper one - https://github.com/graphite-project/docker-graphite-statsd/tree/master/conf/etc/nginx

deniszh commented 5 years ago

Also your /opt/graphite/conf/storage-schemas.conf config is wrong. Looks like you used 'min' as date suffix, which is not supported, please replace it with 'm' - please see documentation https://graphite.readthedocs.io/en/latest/config-carbon.html#storage-schemas-conf

xiaodiannao commented 5 years ago

Hi @deniszh thanks for your reply! I'm using this prebuilt image from Dockerhub graphiteapp/graphite-statsd and I'm not using my own /opt/graphite/conf/storage-schemas.conf thats the weird thing... The same with the Nginx config (I'm not supplying my own config file)

deniszh commented 5 years ago

@xiaodiannao : latest image is working out of the box, without any issues, I just tested that. Please check if you really have latest image (try docker pull graphiteapp/graphite-statsd:latest)

deniszh commented 5 years ago

You can also check that, run container and run shell inside to check

docker pull graphiteapp/graphite-statsd:latest
docker run \
 -p 80:80\
 -p 2003-2004:2003-2004\
 -p 2023-2024:2023-2024\
 -p 8125:8125/udp\
 -p 8126:8126\
 graphiteapp/graphite-statsd
docker exec -it eead09fd89b2 /bin/sh
/ # cat /opt/graphite/conf/storage-schemas.conf
# Schema definitions for Whisper files. Entries are scanned in order,
# and first match wins. This file is scanned for changes every 60 seconds.
#
# Definition Syntax:
#
#    [name]
#    pattern = regex
#    retentions = timePerPoint:timeToStore, timePerPoint:timeToStore, ...
#
# Remember: To support accurate aggregation from higher to lower resolution
#           archives, the precision of a longer retention archive must be
#           cleanly divisible by precision of next lower retention archive.
#
#           Valid:    60s:7d,300s:30d (300/60 = 5)
#           Invalid:  180s:7d,300s:30d (300/180 = 3.333)
#

# Carbon's internal metrics. This entry should match what is specified in
# CARBON_METRIC_PREFIX and CARBON_METRIC_INTERVAL settings
[carbon]
pattern = ^carbon\.
retentions = 10s:6h,1m:90d

[default_1min_for_1day]
pattern = .*
retentions = 10s:6h,1m:6d,10m:1800d
xiaodiannao commented 5 years ago

You're right on the money there @deniszh the cat really shows it uses min instead of m but my docker compose contains this:

statsd:
    image: graphiteapp/graphite-statsd:latest
    ports:
      - "8080:80"
      - "2003:2003"
      - "8125:8125"
      - "8126:8126"

this really is a mystery to me..

EDIT:

Even if I explicitly add the configuration folder using volumes the configuration file in the container is different:

statsd:
    image: graphiteapp/graphite-statsd:latest
    volumes:
      - ./conf/opt/graphite/conf:/opt/graphite/conf
    ports:
      - "8080:80"
      - "2003:2003"
      - "8125:8125"
      - "8126:8126"

this is the config file (even though I add the one from this repository via volumes:

cat /opt/graphite/conf/storage-schemas.conf
# Schema definitions for Whisper files. Entries are scanned in order,
# and first match wins. This file is scanned for changes every 60 seconds.
#
#  [name]
#  pattern = regex
#  retentions = timePerPoint:timeToStore, timePerPoint:timeToStore, ...

# Carbon's internal metrics. This entry should match what is specified in
# CARBON_METRIC_PREFIX and CARBON_METRIC_INTERVAL settings

[carbon]
pattern = ^carbon\.
retentions = 10s:6h,1min:90d

[default_1min_for_1day]
pattern = .*
retentions = 10s:6h,1min:6d,10min:1800d

EDIT2: Ah I think it was a caching issue, after purging all my images it now works fine! Thanks again and best regards

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.