Skip to content

Instantly share code, notes, and snippets.

source 'https://rubygems.org'
gem 'knife-solo'
gem 'berkshelf'
@kirillshevch
kirillshevch / Gemfile
Last active September 30, 2017 19:37
source 'https://rubygems.org'
gem 'knife-solo', '~> 0.6.0'
gem 'knife-solo_data_bag', '~> 2.0.0'
gem 'berkshelf', '~> 6.3.1'
gem 'chef', '~> 12.18.31'
source 'https://supermarket.chef.io'
cookbook 'runit', '~> 3.0.5'
cookbook 'users', '~> 4.0.3'
cookbook 'sudo', '~> 3.3.1'
cookbook 'openssh', '~> 2.1.1'
cookbook 'ufw', '~> 3.1.0'
cookbook 'nodejs', '~> 3.0.0'
cookbook 'ncdu', '~> 1.0.0'
cookbook 'swap_tuning', '~> 0.2.0'
@kirillshevch
kirillshevch / base.json
Last active March 22, 2017 10:30
Chef base role
{
"name": "base",
"description": "Base role",
"json_class": "Chef::Role",
"default_attributes": {
"authorization": {
"sudo": {
"groups": [
"sysadmin"
],
package 'libgmp3-dev' do
action :install
end
package 'jpegoptim' do
action :install
end
package 'imagemagick' do
action :install
@kirillshevch
kirillshevch / gist:5878acfef383e7949731f252df82af0f
Created February 27, 2017 16:12
config/deploy/production.rb
role :app, %w{deployer@ip}
role :web, %w{deployer@ip}
role :db, %w{deployer@ip}
set :branch, fetch(:branch, 'master')
set :deploy_to, '/home/deployer/www/translations'
require 'capistrano/setup'
require 'capistrano/deploy'
require 'rvm1/capistrano3'
require 'capistrano/bundler'
require 'capistrano/rails/migrations'
Dir.glob('lib/capistrano/tasks/*.rake').each { |r| import r }
@kirillshevch
kirillshevch / puma.rb
Created February 27, 2017 16:13
config/puma.rb
return if Rails.env.test? || Rails.env.development? rescue nil
app_path = '/home/deployer/www/translations'
directory "#{app_path}/current"
rackup "#{app_path}/current/config.ru"
daemonize true
upstream api {
server unix:///home/deployer/www/translations/shared/tmp/sockets/puma.sock;
}
server {
listen 80;
server_name _;
return $scheme://translations.betwixt.us$request_uri;
}
{
"run_list": [
"role[base]",
"recipe[chef-nginx::production]",
"recipe[chef-monit::production]"
],
"automatic": {
"ipaddress": "82.196.6.97"
}