Created
December 15, 2011 14:29
-
-
Save flashingpumpkin/1481277 to your computer and use it in GitHub Desktop.
Pretty much what every python web dev should do when starting a new project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Defaults that we'll need | |
include_recipe "apt" | |
package "vim" | |
package "screen" | |
package "git-core" | |
package "mercurial" | |
package "subversion" | |
package "python" | |
package "python-dev" | |
package "htop" | |
package "libjpeg62" | |
package "libjpeg62-dev" | |
package "curl" | |
package "libssl-dev" | |
package "python-memcache" | |
include_recipe "build-essential" | |
include_recipe "openssl" | |
include_recipe "postfix" | |
include_recipe "python" | |
include_recipe "nodejs" | |
include_recipe "coffeescript" | |
include_recipe "sass" | |
include_recipe "logrotate" | |
# The user we're operating as | |
user = node[:user] | |
# Set up user | |
user user do | |
home "/home/#{user}" | |
shell "/bin/bash" | |
action [:create, :manage] | |
supports :manage_home => true | |
end | |
directory "/home/#{user}" do | |
owner user | |
group user | |
end | |
# Make Python remember our sessions | |
cookbook_file "/etc/profile.d/pythonrc.sh" do | |
source "profile.d/pythonrc.sh" | |
cookbook "dotfiles" | |
owner "root" | |
end | |
cookbook_file "/home/#{user}/.pythonrc.py" do | |
source "home/.pythonrc.py" | |
cookbook "dotfiles" | |
owner user | |
end | |
# Set up the virtual environment in the user's home folder | |
python_virtualenv "/home/#{user}" do | |
owner user | |
group user | |
action :create | |
end | |
# Create logging folder | |
directory "/var/log/#{user}" do | |
owner user | |
mode "0744" | |
action :create | |
end | |
# And make sure we're also rotating its contents | |
logrotate_app "#{user}" do | |
cookbook "logrotate" | |
path "/var/log/#{user}/*.log" | |
frequency "daily" | |
rotate 52 | |
create "644 #{user} adm" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment