Giter Site home page Giter Site logo

ezeep / memcached-formula Goto Github PK

View Code? Open in Web Editor NEW

This project forked from saltstack-formulas/memcached-formula

0.0 6.0 0.0 211 KB

Home Page: http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html

License: Other

Scheme 100.00%

memcached-formula's Introduction

memcached

Install and start the memcached service

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

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

whiteinge avatar grahamhayes avatar nmadhok avatar techhat avatar thatch45 avatar jeffrey4l avatar stp-ip avatar nikicat avatar ozgurakan avatar msciciel avatar

Watchers

Sylvain Bellemare avatar  avatar James Cloos avatar Nicolas Delaby avatar Dan Hogan avatar  avatar

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.