<commit_before>#
# Cookbook Name:: applications
# Recipe:: default
#
# Copyright 2009, Engine Yard, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

gem_package "mongrel"

directory "/var/www" do
  owner node[:user]
  group node[:user]
  mode 0755
end

node[:apps].each do |app|
  app_root        = "/var/www/#{app}/current/public"
  cap_directories = [
    "/var/www/#{app}",
    "/var/www/#{app}/shared",
    "/var/www/#{app}/shared/log",
    "/var/www/#{app}/shared/config",
    "/var/www/#{app}/shared/system",
    "/var/www/#{app}/releases"
  ]
  
  cap_directories.each do |dir|
    directory dir do
      owner node[:user]
      group node[:user]
      mode 0755
      recursive true
    end
  end

  template "/etc/nginx/sites-enabled/#{app}" do
    source "nginx-conf.erb"
    mode 0744
    variables :app      => app,
              :app_root => app_root
  end

  template "/etc/god/conf.d/mongrel.god" do
    source   "mongrel.god.erb"
    owner    "root"
    group    "root"
    mode     0644
    variables :app_root => app_root
    notifies :restart, resources(:service => "god")
  end

  logrotate app do
    files "/var/www/#{app}/current/log/*"
    rotate_count 25
    size "100M"
    compress true
    delaycompress true
    missing_ok true
    rotate_if_empty false
    restart_command "touch /var/www/#{app}/current/tmp/restart.txt"
    extra_commands "create 640 #{app} #{app}"
  end
end
<commit_msg>app root needs to be different for mongrel<commit_after>#
# Cookbook Name:: applications
# Recipe:: default
#
# Copyright 2009, Engine Yard, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
#     http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

gem_package "mongrel"

directory "/var/www" do
  owner node[:user]
  group node[:user]
  mode 0755
end

node[:apps].each do |app|
  app_root        = "/var/www/#{app}/current/public"
  cap_directories = [
    "/var/www/#{app}",
    "/var/www/#{app}/shared",
    "/var/www/#{app}/shared/log",
    "/var/www/#{app}/shared/config",
    "/var/www/#{app}/shared/system",
    "/var/www/#{app}/releases"
  ]
  
  cap_directories.each do |dir|
    directory dir do
      owner node[:user]
      group node[:user]
      mode 0755
      recursive true
    end
  end

  template "/etc/nginx/sites-enabled/#{app}" do
    source "nginx-conf.erb"
    mode 0744
    variables :app      => app,
              :app_root => app_root
  end

  template "/etc/god/conf.d/mongrel.god" do
    source    "mongrel.god.erb"
    owner     "root"
    group     "root"
    mode      0644
    variables :app_root => "/var/www/#{app}/current"
    notifies  :restart, resources(:service => "god")
  end

  logrotate app do
    files "/var/www/#{app}/current/log/*"
    rotate_count 25
    size "100M"
    compress true
    delaycompress true
    missing_ok true
    rotate_if_empty false
    restart_command "touch /var/www/#{app}/current/tmp/restart.txt"
    extra_commands "create 640 #{app} #{app}"
  end
end

{'fraction_non_alphanumeric': 0.12375096079938509, 'fraction_numerical': 0.016397642838841917, 'mean_word_length': 2.8538993089832183, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 23, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4542369', 'n_tokens_mistral': 1305, 'n_tokens_neox': 1242, 'n_words': 383}