docker-graphite-statsd icon indicating copy to clipboard operation
docker-graphite-statsd copied to clipboard

Graphite is broken

Open jwalton opened this issue 9 years ago • 10 comments

On the latest version, when I try to access port 80, I get:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py", line 101, in get_response
    request.path_info)
  File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 252, in resolve
    sub_match = pattern.resolve(new_path)
  File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 158, in resolve
    return ResolverMatch(self.callback, args, kwargs, self.name)
  File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 164, in _get_callback
    self._callback = get_callable(self._callback_str)
  File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 124, in wrapper
    result = func(*args)
  File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 91, in get_callable
    lookup_view = getattr(import_module(mod_name), func_name)
  File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/opt/graphite/webapp/graphite/browser/views.py", line 20, in <module>
    from graphite.util import getProfile, getProfileByUsername, defaultUser, json
  File "/opt/graphite/webapp/graphite/util.py", line 69, in <module>
    defaultUser = User.objects.get(username='default')
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/manager.py", line 132, in get
    return self.get_query_set().get(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 344, in get
    num = len(clone)
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 82, in __len__
    self._result_cache = list(self.iterator())
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/query.py", line 273, in iterator
    for row in compiler.results_iter():
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 680, in results_iter
    for rows in self.execute_sql(MULTI):
  File "/usr/local/lib/python2.7/dist-packages/django/db/models/sql/compiler.py", line 735, in execute_sql
    cursor.execute(sql, params)
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/sqlite3/base.py", line 234, in execute
    return Database.Cursor.execute(self, query, params)
DatabaseError: no such table: auth_user

jwalton avatar May 07 '15 14:05 jwalton

Oh, hang on, I think this might be my fault... :P

jwalton avatar May 07 '15 15:05 jwalton

The problem happens when you try to use a custom storage directory for Graphite:

docker run -d --name statsd --restart=always \
    -p 8080:80 \
    -v /mnt/graphite-storage:/opt/graphite-storage \
    -e GRAPHITE_STORAGE_DIR=/opt/graphite-storage \
    hopsoft/graphite-statsd

jwalton avatar May 07 '15 15:05 jwalton

Can fix this by running:

docker run --rm \
    -v /mnt/graphite-storage:/opt/graphite-storage \
    -e GRAPHITE_STORAGE_DIR=/opt/graphite-storage \
    hopsoft/graphite-statsd \
    python /opt/graphite/webapp/graphite/manage.py syncdb --noinput

before I run graphite "for reals". You should think about adding this to your startup script, though, as I'm sure I'm not the only one keeping my graphite data outside the container.

jwalton avatar May 07 '15 15:05 jwalton

Yeah... I've had several requests to automagically setup the dir structure for logs & graphite regardless of where you've mounted the volumes. I've been thinking through this quite a bit & will have a solution pushed up soon

hopsoft avatar May 08 '15 04:05 hopsoft

continue this issue, I see /opt/graphite is not empty but exported as volume, if I start a container as -v /data/graphite/:/opt/graphite option, it always fail to start. So what's the point to export /opt/graphite as a volume?

BTW, what is /opt/graphite-storage? I didn't see it in README or Dockerfile as a volume.

chengweiv5 avatar Jun 09 '15 04:06 chengweiv5

OK, I saw GRAPHITE_STORAGE_DIR in conf/graphite/carbon.conf. But still confused why it says /opt/graphite is a volume? Because you can't mount an empty volume to it, that will break graphite service, so as /etc/nginx, /opt/statsd, /etc/logrotate.d and /var/log.

chengweiv5 avatar Jun 09 '15 06:06 chengweiv5

em, after go-through docker document again, I think I understand how I should use these volumes, my bad, sorry.

chengweiv5 avatar Jun 09 '15 06:06 chengweiv5

I went thru this volume initialization problem too.

I created a script that initializes the file structure by starting the container once, then docker cp the files to the volumes. I just then have to start a new container with those volumes mounted and it works.

I shared the script in this gist : https://gist.github.com/YannRobert/3aa307a5e5d510d58e23

YannRobert avatar Jun 11 '15 11:06 YannRobert

Yeah, I ran into this too...

mikelehen avatar Aug 03 '15 19:08 mikelehen

See #43

dbeckham avatar Nov 13 '15 20:11 dbeckham