All Projects → miketheman → Fullstack

miketheman / Fullstack

Licence: mit
Full-stack DevOps demo

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Fullstack

Estante
Lista de leituras recomendadas à todas as pessoas que desejam trilhar uma carreira de Desenvolvimento, tenham experiência na área ou não. Também é abordado livros de soft skill na estante e temas complementares e pertinentes a profissão. Ex: design thinking, psicologia comportamental, etc.
Stars: ✭ 81 (+326.32%)
Mutual labels:  fullstack, devops
Serverfarmer
Manage multiple servers with different operating systems, configurations, requirements etc. for many separate customers in an outsourcing model.
Stars: ✭ 122 (+542.11%)
Mutual labels:  chef, devops
Kitchen In Travis
Chef cookbook example to run test-kitchen inside Travis CI.
Stars: ✭ 36 (+89.47%)
Mutual labels:  chef, devops
Dd Agent
Datadog Agent Version 5
Stars: ✭ 1,224 (+6342.11%)
Mutual labels:  devops, datadog
Mcw Cloud Native Applications
MCW Cloud-native applications
Stars: ✭ 184 (+868.42%)
Mutual labels:  chef, devops
Chef Windows Hardening
This chef cookbook provides windows hardening configurations for the DevSec Windows baseline profile.
Stars: ✭ 80 (+321.05%)
Mutual labels:  chef, devops
Chef Datadog
Chef cookbook for Datadog Agent & Integrations
Stars: ✭ 89 (+368.42%)
Mutual labels:  chef, datadog
Haproxy
Development repository for the haproxy cookbook
Stars: ✭ 138 (+626.32%)
Mutual labels:  chef, haproxy
Pytest Testinfra
With Testinfra you can write unit tests in Python to test actual state of your servers configured by management tools like Salt, Ansible, Puppet, Chef and so on.
Stars: ✭ 1,987 (+10357.89%)
Mutual labels:  chef, devops
Chef Ssh Hardening
This chef cookbook provides secure ssh-client and ssh-server configurations.
Stars: ✭ 144 (+657.89%)
Mutual labels:  chef, devops
Chef Os Hardening
This chef cookbook provides numerous security-related configurations, providing all-round base protection.
Stars: ✭ 386 (+1931.58%)
Mutual labels:  chef, devops
Pentest Lab
Pentest Lab on OpenStack with Heat, Chef provisioning and Docker
Stars: ✭ 353 (+1757.89%)
Mutual labels:  chef, devops
Chef
Chef Infra, a powerful automation platform that transforms infrastructure into code automating how infrastructure is configured, deployed and managed across any environment, at any scale
Stars: ✭ 6,766 (+35510.53%)
Mutual labels:  chef, devops
Ecs Refarch Continuous Deployment
ECS Reference Architecture for creating a flexible and scalable deployment pipeline to Amazon ECS using AWS CodePipeline
Stars: ✭ 776 (+3984.21%)
Mutual labels:  devops
Carvel Ytt
YAML templating tool that works on YAML structure instead of text
Stars: ✭ 816 (+4194.74%)
Mutual labels:  devops
Vagrant Lamp
My default LAMP development stack for Vagrant
Stars: ✭ 765 (+3926.32%)
Mutual labels:  chef
Kube Forwarder
Easy to use Kubernetes port forwarding manager
Stars: ✭ 756 (+3878.95%)
Mutual labels:  devops
Jsql Injection
jSQL Injection is a Java application for automatic SQL database injection.
Stars: ✭ 891 (+4589.47%)
Mutual labels:  devops
Cfn nag
Linting tool for CloudFormation templates
Stars: ✭ 808 (+4152.63%)
Mutual labels:  devops
Tg2
Python web framework with full-stack layer implemented on top of a microframework core with support for MongoDB, Pluggable Applications and autogenerated Admin
Stars: ✭ 756 (+3878.95%)
Mutual labels:  fullstack

fullstack

Full-stack DevOps demo

The purpose of this is to demonstrate some great automation tools in orchestra.

Things used

(in alphabetic order)

Some of the more exotic pieces

  • bluepill is a process manager, similar to SysV init, Upstart, supervisord, runit, etc.
  • Bottle.py is a web micro-framework written in python.
  • Siege creates web requests based on an input file for load testing.
  • Spiceweasel generates Chef's knife commands from a config file

A picture

Diagram

Thanks to diagrammr.

Application

The Bottle.py application is a simplistic word counter, acts like a REST interface, where /insert/<someword> will add the word to the database and increment its counter.

The /get/<someword> will retrieve the word, the unique object ID, and the count of times this word was hit.

A call to /toplist will bring back the top 10 words that have been hit.

Customizations

All cookbooks used are released on the Chef Community site. The only cookbooks here are a personalized mongodb cookbook, due to a currently faulty community cookbook, and the fullstack cookbook, that performs the customized functions this stack needs.

Prep work

Some EC2 security group work:

ec2-create-group fullstack -d "Full Stack Demo"
# Allow pings
ec2-authorize fullstack --protocol icmp --icmp-type-code=-1:-1 --source-or-dest-group fullstack
# Could be shorter: ec2-authorize fullstack -P icmp -t=-1:-1 -o fullstack
ec2-authorize fullstack -P tcp -p 0-65535 -o fullstack
ec2-authorize fullstack -P udp -p 0-65535 -o fullstack

ec2-authorize fullstack -P tcp -p 22    # SSH
ec2-authorize fullstack -P tcp -p 80    # HTTP

# Optional, don't use in a production environment unless needed
ec2-authorize fullstack -P tcp -p 22002 # HAProxy Stats
ec2-authorize fullstack -P tcp -p 8080  # Webapp node

A chef server (open source or hosted) must exist, and knife.rb must be set up correctly with AWS credentials. My personal one is excluded from the repo.

I recommend using a dedicated server/organization since the cleanup actions are destructive.

current_dir = File.dirname(__FILE__)
log_level                :info
log_location             STDOUT
node_name                "<my username>"
client_key               "#{current_dir}/<my username>.pem"
validation_client_name   "<organization-name>-validator"
validation_key           "#{current_dir}/<organization-name>-validator.pem"
chef_server_url          "https://api.opscode.com/organizations/<organization-name>"
cache_type               'BasicFile'
cache_options( :path => "#{ENV['HOME']}/.chef/checksums" )
cookbook_path            ["#{current_dir}/../site-cookbooks"]
# AWS credentials
knife[:ssh_user]              = "ec2-user"
knife[:ssh_identity_file]     = "#{current_dir}/../.aws/<key pair cert>.pem"
knife[:aws_access_key_id]     = "<some key id>"
knife[:aws_secret_access_key] = "<some secret string>"
### END ###

A Users Databag item must be placed in data_bags/users/<username>.json. An example is:

{
  "id": "bofh",
  "ssh_keys": "ssh-rsa AAAAB3Nz...yhCw== bofh",
  "groups": "sysadmin",
  "uid": 2001,
  "shell": "\/bin\/bash",
  "comment": "BOFH",
}

See the users cookbook for more help.

A Credentials databag item for Datadog monitoring is also excluded from the repo, since it contains API keys. Construct your own at data_bags/credentials/datadog.json so:

{
  "id": "datadog",
  "api_key": "YOURAPIKEY",
  "application_key": "APPLICATIONKEYFORCHEF"
}

You can obtain your API key and Application Key from the Integrations => API page, or from the Agent Setup => Chef page, you will find a "Generate Application Key" button.

Launch

spiceweasel fullspice.yml | bash

Some cool tricks

Get the top list of words:

open http://`knife search node 'role:load_balancer' -a ec2.public_hostname |grep ec2.public_hostname | cut -f4 -d" "`/toplist

HAProxy web console:

open http://`knife search node 'role:load_balancer' -a ec2.public_hostname |grep ec2.public_hostname | cut -f4 -d" "`:22002/

Find the mongodb replset primary:

knife search node "fqdn:`knife ssh 'role:mongodb-replset-member' -a ec2.public_hostname 'curl http://localhost:28017/replSetGetStatus?text=1' | grep -B4 PRIMARY | grep name | awk '{print $4}' |cut -f1 -d":" | sed 's/^.\{1\}//' | uniq`" -i

NOTE: This is probably overly complicated, but awesome. Probably better to have chef-client update the node record with the current state.

Kill the primary:

knife ec2 server delete --purge -y <instance-id from previous command>
# or:
knife ec2 server delete --purge -y `knife search node "fqdn:`knife ssh 'role:mongodb-replset-member' -a ec2.public_hostname 'curl http://localhost:28017/replSetGetStatus?text=1' | grep -B4 PRIMARY | grep name | awk '{print $4}' |cut -f1 -d":" | sed 's/^.\{1\}//' | uniq`" -a ec2.instance_id | grep instance_id | cut -f2 -d":"`

Launch a new mongodb replica:

spiceweasel fullspice.yml | grep --color=none rolemongodb-replset-member | uniq | bash

Add a webserver:

spiceweasel fullspice.yml | grep --color=none rolewebserver | uniq | bash

Show counts of servers:

knife status -r | awk '{print $9}' | sort | uniq -c

Do something on all nodes:

knife ssh '*:*' -a ec2.public_hostname 'hostname -f'

Cleanup

Spiceweasel, in reverse:

spiceweasel -d fullspice.yml | bash
knife client bulk delete i-.*

That's all, folks!

Credits

Bitdeli Badge

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].