Giter Site home page Giter Site logo

memcached-formula's Introduction

memcached

Install and start the memcached service on GNU/Linux and FreeBSD

Available states

Installs and starts memcached service

Memcached configuration file

Installs python-memcached package for RedHat/CentOS and python-memcache package for Debian

Installs libmemcached development files to install pylibmc as python driver

Stops the memcached service and uninstalls the package.

Instructions

  1. Add this repository as a GitFS backend in your Salt master config.

  2. Determine which minions will run memcached and include the memcached state.

    One possible example is to run memcached on each server that is also running your web application. The following contrived example uses a Django web app deployed from an internal Git repository:

    include:
      - memcached
      - memcached.python_memcached
    
    python-django:
      pkg:
        - installed
    
    https://internal-repos/mydjangoapp.git:
      git.latest:
        - target: /var/www/mydjangoapp
        - require:
          - pkg: python-django
          - pkg: python-memcached
    
  3. (Optional) Use Salt Mine to maintain a live list of currently running memcached instances in your web application config.

    The following example assumes all web application servers have a hostname that starts with "web".

    1. Configure your Pillar top file (/srv/pillar/top.sls):

      base:
        'web*':
          - application_server
      
    2. Configure Salt Mine in /srv/pillar/application_server.sls:

      mine_functions:
        network.interfaces: [eth0]
      
    3. Add the IP addresses to your web application config.

      Building on the Django example above, add the following states:

      /var/www/mydjangoapp/config.py:
        file:
          - managed
          - source: salt://mydjangoapp/config.py
          - template: jinja
          - require:
            - git: https://internal-repos/mydjangoapp.git
      

      Edit the /srv/salt/mydjangoapp/config.py template to add the memcached server addresses (only relevant portions of config.py are shown):

      CACHES = {
          'default': {
              'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
              'LOCATION': [
                  {% for server,ip in salt['mine.get']('web*', 'network.interfaces', ['eth0']).items() %}
                  '{{ ip }}:11211`,
                  {% endfor %}
              ]
          }
      }
      

memcached-formula's People

Contributors

0xmh avatar aboe76 avatar grahamhayes avatar gravyboat avatar jeffrey4l avatar meganlkm avatar msciciel avatar myii avatar nikicat avatar nmadhok avatar noelmcloughlin avatar ozgurakan avatar pk-lms-dev avatar porunov avatar roock avatar sposs avatar stp-ip avatar techhat avatar thatch45 avatar whiteinge avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

memcached-formula's Issues

[BUG] failure seen on FreeBSD 13

Your setup

Formula commit hash / release tag

vagrant box roboxes/freebsd11

Versions reports (master & minion)

[vagrant@bazinga ~]$ salt --versions-report
Salt Version:
           Salt: 2019.2.3
 
Dependency Versions:
           cffi: 1.14.0
       cherrypy: Not Installed
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.10.1
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.6.2
   mysql-python: Not Installed
      pycparser: 2.19
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.17 (default, Mar 21 2020, 01:18:34)
   python-gnupg: Not Installed
         PyYAML: 5.2
          PyZMQ: 18.1.1
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.5.3
            ZMQ: 4.3.1
 
System Versions:
           dist:   
         locale: US-ASCII
        machine: amd64
        release: 11.3-RELEASE
         system: FreeBSD
        version: Not Installed

Pillar / config used


Bug details

Describe the bug

[ERROR   ] Rendering exception occurred
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/salt/utils/templates.py", line 169, in render_tmpl
    output = render_str(tmplstr, context, tmplpath)
  File "/usr/local/lib/python2.7/site-packages/salt/utils/templates.py", line 404, in render_jinja_tmpl
    buf=tmplstr)
SaltRenderError: Jinja variable 'None' has no attribute 'server'
[CRITICAL] Rendering SLS 'base:memcached' failed: Jinja variable 'None' has no attribute 'server'
local:
    Data failed to compile:
----------
    Rendering SLS 'base:memcached' failed: Jinja variable 'None' has no attribute 'server'

Steps to reproduce the bug

Expected behaviour

Attempts to fix the bug

Additional context

Suse: Jinja variable 'None' has no attribute 'server'

Formula fails on Suse

salt.exceptions.SaltRenderError: Jinja variable 'None' has no attribute 'server'
[CRITICAL] Rendering SLS 'base:memcached' failed: Jinja variable 'None' has no attribute 'server'
local:
    Data failed to compile:
----------
    Rendering SLS 'base:memcached' failed: Jinja variable 'None' has no attribute 'server'

[FEATURE] Add support for pidfile (option -P)

Is your feature request related to a problem?

When installing memcached with the default configuration, the -P option is removed

This option may be needed.

Current value in debian:

-P /var/run/memcached/memcached.pid

Describe the solution you'd like

install memcached with the formula.

----------
          ID: /etc/memcached.conf
    Function: file.managed
      Result: True
     Comment: File /etc/memcached.conf updated
     Started: 13:58:53.014083
    Duration: 58.345 ms
     Changes:   
              ----------
              diff:
                  --- 
                  +++ 
                  @@ -9,14 +9,9 @@
                   -d
                   
                   # Log memcached's output to /var/log/memcached
                  -logfile /var/log/memcached.log
                  +logfile  /var/log/memcached.log
                   
                   # Be verbose
                  -# -v
                  -
                  -# Be even more verbose (print client commands as well)
                  -# -vv
                  -
                   # Start with a cap of 64 megs of memory. It's reasonable, and the daemon default
                   # Note that the daemon will grow to this size, but does not start out holding this much
                   # memory
                  @@ -35,16 +30,18 @@
                   -l 127.0.0.1
                   
                   # Limit the number of simultaneous incoming connections. The daemon default is 1024
                  -# -c 1024
                  +-c 1024
                   
                   # Lock down all paged memory. Consult with the README and homepage before you do this
                   # -k
                   
                  +
                   # Return error when memory is exhausted (rather than removing items)
                   # -M
                  +
                   
                   # Maximize core file limit
                   # -r
                   
                  -# Use a pidfile
                  --P /var/run/memcached/memcached.pid
                  +
                  +

Describe alternatives you've considered

None

Additional context

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.