Skip to content

Instantly share code, notes, and snippets.

@miry
Last active August 29, 2015 13:56
Show Gist options
  • Save miry/8972078 to your computer and use it in GitHub Desktop.
Save miry/8972078 to your computer and use it in GitHub Desktop.
{
"name": "application",
"description": "Sets up rails project",
"default_attributes": {
"rails-stack": {
"deployer": "deployer",
"authorized_keys": [
"PUBLIC_KEY_FOR_APP_DEPLOYER_USER1",
"PUBLIC_KEY_FOR_APP_DEPLOYER_USER2"
],
"data_path": "/data",
"applications": [
{
"name": "example",
"background_workers": 1,
"domain": "example.com",
"rails_env": "staging"
}
],
"monit": {
"drives": {
"rootfs": {
"path": "/",
"space_limit": "85%"
},
"varfs": {
"path": "/var"
}
}
}
}
},
"json_class": "Chef::Role",
"run_list": [
"rails-stack::unicorn_applications",
"rails-stack::delayed_job_applications",
"rails-stack::logrotate_applications"
],
"chef_type": "role",
"override_attributes": { }
}
{
"name": "db",
"description": "Sets up PostgreSQL database",
"default_attributes": {
"rails-stack": {
"monitor_services": {
"postgresql": true
}
},
"postgresql": {
"enable_pgdg_yum": "true",
"version": "9.3",
"dir": "/etc/postgresql/9.3/main",
"password": { "postgres": "welcome" },
"pidfile": "/var/run/postgresql-9.3.pid",
"contrib": {
"extensions": ["hstore"],
"packages": ["postgresql93-contrib"]
},
"client": {
"packages": ["postgresql93-devel"]
},
"server": {
"packages": ["postgresql93-server"],
"service_name": "postgresql-9.3"
},
"config" : {
"listen_addresses": "localhost",
"log_rotation_age": "1d",
"log_rotation_size": "10MB",
"log_filename": "postgresql-%Y-%m-%d_%H%M%S.log"
}
}
},
"json_class": "Chef::Role",
"run_list": ["locale", "rails-stack::pgdg"],
"chef_type": "role",
"override_attributes": {
}
}
{
"name": "db",
"description": "Sets up PostgreSQL database",
"default_attributes": {
"rails-stack": {
"monitor_services": {
"postgresql": true
}
},
"postgresql": {
"enable_pgdg_apt": "true",
"version": "9.3",
"dir": "/etc/postgresql/9.3/main",
"password": { "postgres": "welcome" },
"pidfile": "/var/run/postgresql/9.3-main.pid",
"contrib": {
"extensions": ["hstore"],
"packages": ["postgresql-contrib-9.3"]
},
"config" : {
"listen_addresses": "localhost",
"log_rotation_age": "1d",
"log_rotation_size": "10MB",
"log_filename": "postgresql-%Y-%m-%d_%H%M%S.log"
}
}
},
"json_class": "Chef::Role",
// Locale required to install postgresql server
"run_list": ["locale", "rails-stack::pgdg"],
"chef_type": "role",
"override_attributes": {
}
}
{
"name": "machine",
"description": "Sets up basic users and required tools",
"default_attributes": {
"monit": {
"notify_email": "root@localhost",
"mail_format": {
"from": "monit@example.com"
}
},
"resolver": { "nameservers": [ "8.8.8.8" ] },
"rails-stack": {
"data_path": "/data",
"apps_path": "/data/apps",
"deployer": "deployer"
},
"rbenv": {
"install_prefix": "/data"
}
},
"json_class": "Chef::Role",
"run_list": [
"rails-stack::user",
"rails-stack::lib_directory",
"rails-stack::sudoers",
"rails-stack::packages",
"rails-stack::ruby"
],
"chef_type": "role",
"override_attributes": { }
}
{
"name": "utils",
"description": "Sets up required utils",
"default_attributes": {
"rails-stack": {
"monitor_services": {
"memcached": true
}
}
},
"json_class": "Chef::Role",
"run_list": ["memcached"],
"chef_type": "role",
"override_attributes": { }
}
{
"name": "web",
"description": "Sets up nginx",
"default_attributes": {
"nginx": {
"default_site_enabled": false,
"worker_processes": 3,
"user": "deployer",
"group": "deployer"
},
"rails-stack": {
"deployer": "deployer",
"data_path": "/data",
"monitor_services": {
"nginx": true
},
"applications": [
{
"name": "example",
"background_workers": 1,
"domain": "example.com"
}
]
}
},
"json_class": "Chef::Role",
"run_list": ["nginx", "rails-stack::nginx_applications"],
"chef_type": "role",
"override_attributes": { }
}
{
"monit": {
"notify_email": "alerts@example.com",
"mail_format": {
"from": "monit@example.com"
}
},
"run_list": [
"recipe[chef-solo-search]",
"recipe[rails-stack]",
"recipe[newrelic]"
],
"postgresql": {
"enable_pgdg_yum": "true",
"version": "9.3",
"dir": "/etc/postgresql/9.3/main",
"password": { "postgres": "welcome" },
"pidfile": "/var/run/postgresql-9.3.pid",
"contrib": {
"extensions": ["hstore"],
"packages": ["postgresql93-contrib"]
},
"client": {
"packages": ["postgresql93-devel"]
},
"server": {
"packages": ["postgresql93-server"],
"service_name": "postgresql-9.3"
},
"config" : {
"listen_addresses": "localhost",
"log_rotation_age": "1d",
"log_rotation_size": "10MB",
"log_filename": "postgresql-%Y-%m-%d_%H%M%S.log"
}
},
"ruby": { "version": "2.1.0" },
"nginx": {
"default_site_enabled": false,
"user": "deployer",
"group": "deployer",
"client_max_body_size": "250M"
},
"rails-stack": {
"deployer": "deployer",
"authorized_keys": [
"!!!! PUBLIC KEY"
],
"data_path": "/data",
"monitor_services": ["nginx", "memcached", "postgresql"],
"applications": [
{
"name": "!!! example",
"background_workers": 1,
"domain": "example.com",
"rails_env": "production"
}
]
},
"ssl": {
"certs_dir": "/etc/ssl/certs",
"keys_dir": "/etc/ssl/private",
"group": "deployer",
"domain": "example_com"
},
"papertrail": {
"port": 58124,
"enable_tls": true
},
"newrelic":{
"server_monitoring": {
"license": "!!! newrelic api key"
},
"application_monitoring": {
"license": "!!! newrelic api key"
}
}
}
{
"nginx": {
"worker_processes": 2
},
"ruby": {
"version": "2.1.0"
},
"run_list": [
// This recipe required for cookbooks that depends on data-bags serach functionality.
"recipe[chef-solo-search]",
//Setup basic required users, tools and packages for all type of machines
"role[machine]",
"role[application]",
"role[nginx]",
"role[pg_ubuntu]",
"role[memcached]"
],
// Example of rails application config, overriding default values
"rails-stack": {
"deployer": "deployer",
"authorized_keys": [
"!!! your public ssh key here"
],
"data_path": "/data",
"applications": [
{
"name": "foo",
"background_workers": 1,
"domain": "foo.io",
"rails_env": "production"
}
],
"monit": {
"drives": {
"rootfs": {
"path": "/"
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment