Coder Social home page Coder Social logo

tskogberg / solokit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joakimk/solokit

0.0 2.0 0.0 131 KB

A toolkit for provisioning (ubuntu-)servers using chef-solo.

License: MIT License

C 19.08% Ruby 71.84% JavaScript 0.18% Perl 8.73% Nu 0.17%

solokit's Introduction

A toolkit for provisioning (ubuntu-)servers using chef-solo.

Solokit

  • A set of wrappers around SSH and Chef Solo for getting cookbooks and recipes to servers and running them.
  • Code for setting up user accounts (optionally setting passwords, ssh-keys and sudo access).
  • Uses nesting to override configuration and cookbooks.

Cookbooks and configuration

Solokit includes some defaults so that you don't have to repeat the same things for each server. Any "cookbook" or "chef" directories in the root of your project will be copied over the defaults. The same goes for any "cookbook" or "chef" directories for a specific environment.

An environment can be anything from one server to a complete cluster. Within an environment you can run specific configuration for each server, but Solokit defaults to "server.json".

For each layer*, Solokit looks for a directory structure like this:

cookbooks/upstream # Unchanged cookbooks downloaded from opscode or other upstream source.
cookbooks/site     # Changes or entierly new cookbooks for Solokit, your project or env.
chef/solo.rb       # Specifies where chef solo should look for files.
chef/server.json   # Default config, just calls roles/base.rb.
chef/roles/base.rb # Base configuration

*Except for within an environment where all cookbooks are considered site-cookbooks (example path: envs/test/cookbooks).

Usage

Create the basic directory structure:

mkdir project
cd project
mkdir -p envs/test/chef/roles

Add something like this to a Rakefile:

require 'rubygems'
require 'solokit'

namespace :test do
  desc "Update system configuration"
  task :provision do
    Solokit::UserJsonGenerator.generate! "test"
    Solokit::Chef.provision!("test", "test.example.com", Solokit::Configuration.new("test"))
  end
end

Add user configuration to users.yml (optional, but you need to provide a chef/roles/base.json without the users role if you skip this step):

# User data used to setup user accounts using chef.
# The hash is generated with "openssl passwd -1".

# Random pwgen password that is used when you don't specify a password for a user.
default_hash: $1$8jLGWmPB$yFGmUThzbL0DMarc1CIY1/

groups:
  developers: user

users:
  user:
    hash: $1$8jLGWmPB$yFGmUThzbL0DMarc1CIY1/
    keys: user@computer

  ## Shared users
  deploy:
    keys: group/developers 
 
envs:
  test:
    users: group/developers deploy
    sudo: group/developers

Add keys below "public_keys" that have names ending in ".pub".

mkdir -p public_keys
echo "your key" > public_keys/[email protected]

By default this setup assumes that you can login to root on the server using your ssh key but Solokit also supports running chef as a normal user (with some modifications to solo.rb).

solokit's People

Contributors

joakimk avatar tskogberg avatar

Watchers

James Cloos 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.