Code Monkey home page Code Monkey logo

waffles's Introduction

Waffles!

Waffles is a suite of Bash scripts to manage server resources in an idempotent fashion.

Installation and Usage

To install Waffles, just clone the git repo and source the init.sh file:

$ git clone https://github.com/wffls/waffles /opt/waffles
$ source /opt/waffles/init.sh
$ apt.pkg --help

You can integrate Waffles into a Bash script by sourcing the init.sh file within the script:

#!/bin/bash
source /opt/waffles/init.sh

# Install memcached
apt.pkg --package memcached --version latest

# Set the listen option
file.line --file /etc/memcached.conf --line "-l 0.0.0.0" --match "^-l"

# Determine the amount of memory available and use half of that for memcached
memory_bytes=$(elements System.Memory.Total 2>/dev/null)
memory=$(( $memory_bytes / 1024 / 1024 / 2 ))

# Set the memory available to memcached
file.line --file /etc/memcached.conf --line "-m $memory" --match "^-m"

# Manage the memcached service
service.sysv --name memcached

# If any changes happened, restart memcached
if [[ -n $waffles_total_changes ]]; then
  exec.mute /etc/init.d/memcached restart
fi

Development

Waffles tries to be as simple as possible while still providing useful utilities for everyday systems administration. If you find a bug or would like to add a feature, just make a patch and open a Pull Request.

Testing

Adding unit and acceptance tests are encouraged but not required for Pull Requests.

Unit Tests

Unit tests can be found in tests/core.sh. They're mainly used to verify certain functions work correctly.

Acceptance Tests

Acceptance tests are used to verify resources work correctly. Test Kitchen and Docker are used to run the suite of tests. Use the install.sh Waffles script to set up Test Kitchen and all other requirements on an Ubuntu-based system.

Test files can be found in tests/kitchen/test/resources. Each resource test requires 5 functions:

  • setup
  • create
  • update
  • delete
  • teardown

If any of the functions aren't applicable to the resource test you're writing, just issue a return.

You can execute tests by running:

$ cd /opt/waffles/tests/kitchen
$ ./test.sh --platform ubuntu-1404 --resource file.line

--platform will take any regex compatible with the kitchen test command. --resource is the name of any resource you want to test. If you want to run all tests, use all as the value.

More Information

See wffls.github.io for more information.

waffles's People

Contributors

jtopjian avatar multicast avatar gbraekmans avatar jlaynereallyfast avatar primeroz avatar reduxionist avatar chealion avatar

Watchers

Raghav Palekar avatar James Cloos 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.