Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install Graphite 1.1.5 in virtualenv #2415

Closed
pszafer opened this issue Jan 23, 2019 · 2 comments
Closed

Cannot install Graphite 1.1.5 in virtualenv #2415

pszafer opened this issue Jan 23, 2019 · 2 comments
Labels

Comments

@pszafer
Copy link

pszafer commented Jan 23, 2019

Hello,

I'm trying to install Graphite on Alpine Linux in Virtualenv, tried to follow dockerfile, documentation but always end up with same error...

This is current Ansible code of installation which I try:

---

- name: Install deps
  apk:
    name: "{{ item }}"
    state: latest
    update_cache: yes
  loop:
    - nginx
    - cairo
    - librrd
    - memcached
    - nodejs
    - npm
    - py3-pyldap
    - runit
    - sqlite
    - expect
    - alpine-sdk
    - git
    - libffi-dev
    - pkgconfig
    - py3-cairo
    - py3-pip
    - py3-pyldap
    - py3-virtualenv
    - py-rrd
    - python3-dev
    - rrdtool-dev
    - wget
  when: ansible_distribution == 'Alpine'

- name: Upgrade PIP
  pip:
    name: pip
    state: latest

- name: Is /opt/graphite exists
  stat:
    path: /opt/graphite
  register: virtualenvexists
- name: Manually create the initial virtualenv
  command: python3 -m venv /opt/graphite
  when: not virtualenvexists.stat.exists

- name: Install graphite deps
  pip:
    virtualenv: /opt/graphite
    name: "{{ item }}"
    state: latest
  loop:
    - django==1.11.15
    - django-statsd-mozilla
    - fadvise
    - gunicorn
    - msgpack-python
    - redis
    - rrdtool
    - https://github.com/graphite-project/whisper/tarball/1.1.5
    - https://github.com/graphite-project/carbon/tarball/1.1.5
    - http://github.com/graphite-project/graphite-web/tarball/1.1.5

and then I try to run (tried to make config, without configs etc.)

PYTHONPATH=/opt/graphite/webapp /opt/graphite/bin/django-admin.py collectstatic --noinput --settings=graphite.settings

and it throw error:

Could not import graphite.local_settings, using defaults!
/opt/graphite/lib/python3.6/site-packages/graphite/settings.py:334: UserWarning: SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security
  warn('SECRET_KEY is set to an unsafe default. This should be set in local_settings.py for better security')
Traceback (most recent call last):
  File "/opt/graphite/bin/django-admin.py", line 5, in <module>
    management.execute_from_command_line()
  File "/opt/graphite/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
    utility.execute()
  File "/opt/graphite/lib/python3.6/site-packages/django/core/management/__init__.py", line 338, in execute
    django.setup()
  File "/opt/graphite/lib/python3.6/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/opt/graphite/lib/python3.6/site-packages/django/apps/registry.py", line 85, in populate                                                                                                                                                                                    app_config = AppConfig.create(entry)
  File "/opt/graphite/lib/python3.6/site-packages/django/apps/config.py", line 94, in create
    module = import_module(entry) 
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import                                                             
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked                               
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module                                            
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/opt/graphite/lib/python3.6/site-packages/graphite/functions/__init__.py", line 10, in <module>      
    from graphite.logger import log              
  File "/opt/graphite/lib/python3.6/site-packages/graphite/logger.py", line 106, in <module>                 
    log = GraphiteLogger() # import-shared logger instance
  File "/opt/graphite/lib/python3.6/site-packages/graphite/logger.py", line 39, in __init__                          
    level = logging.DEBUG if settings.DEBUG else logging.INFO,
  File "/opt/graphite/lib/python3.6/site-packages/graphite/logger.py", line 78, in _config_logger
    handler = Rotater(log_file, when=when, backupCount=backupCount)
  File "/usr/lib/python3.6/logging/handlers.py", line 202, in __init__                             
    BaseRotatingHandler.__init__(self, filename, 'a', encoding, delay)
  File "/usr/lib/python3.6/logging/handlers.py", line 57, in __init__                         
    logging.FileHandler.__init__(self, filename, mode, encoding, delay)
  File "/usr/lib/python3.6/logging/__init__.py", line 1031, in __init__                                                                                                                                                                                                        
    StreamHandler.__init__(self, self._open())
  File "/usr/lib/python3.6/logging/__init__.py", line 1060, in _open
    return open(self.baseFilename, self.mode, encoding=self.encoding)
FileNotFoundError: [Errno 2] No such file or directory: '/opt/graphite/lib/python3.6/storage/log/webapp/info.log'

I made symlink to storage in lib/python3.6, but then it is lookiing for webapp in lib/python3.6/site-packages. Where am I making a mistake?
Tried to installed already with pip 19.0.1 and pip 10.

@piotr1212
Copy link
Member

FileNotFoundError: [Errno 2] No such file or directory: '/opt/graphite/lib/python3.6/storage/log/webapp/info.log'

have you tried creating that directory? That should fix it.

That said, your GRAPHITE_ROOT seems a bit strange, just set it to /opt/graphite in local_settings.py

@pszafer
Copy link
Author

pszafer commented Jan 25, 2019

Don't know what was wrong then. I rewrote my role and it is working now.
If you want you can copy it to your docs, maybe it will help somebody to have graphite working in a few minutes.

Repo with ansible role:
https://github.com/pszafer/graphite-web-ansible

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants