├── Berksfile ├── LICENSE ├── attributes └── default.rb ├── Gemfile ├── .gitignore ├── Thorfile ├── README.md ├── metadata.rb ├── recipes ├── hl.rb └── default.rb ├── chefignore └── Vagrantfile /Berksfile: -------------------------------------------------------------------------------- 1 | site :opscode 2 | 3 | metadata 4 | 5 | cookbook "apt" 6 | 7 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013 YOUR_NAME 2 | 3 | All rights reserved - Do Not Redistribute 4 | -------------------------------------------------------------------------------- /attributes/default.rb: -------------------------------------------------------------------------------- 1 | default['steam']['user'] = 'steam' 2 | default['steam']['dir'] = '/srv/steam' 3 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source :rubygems 2 | 3 | gem 'berkshelf' 4 | gem 'thor-foodcritic' 5 | gem 'vagrant', '~> 1.0.5' 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .vagrant 2 | Berksfile.lock 3 | Gemfile.lock 4 | *~ 5 | *# 6 | .#* 7 | \#*# 8 | .*.sw[a-z] 9 | *.un~ 10 | /cookbooks 11 | -------------------------------------------------------------------------------- /Thorfile: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | require 'bundler' 4 | require 'bundler/setup' 5 | require 'thor/foodcritic' 6 | require 'berkshelf/thor' 7 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # steam-ds cookbook 2 | 3 | This is an attempt at making a cookbook for dedicated servers on steam. 4 | 5 | # Requirements 6 | 7 | # Usage 8 | 9 | # Attributes 10 | 11 | # Recipes 12 | 13 | # Author 14 | 15 | Author:: YOUR_NAME () 16 | -------------------------------------------------------------------------------- /metadata.rb: -------------------------------------------------------------------------------- 1 | name "steam-ds" 2 | maintainer "Nelson Chen" 3 | maintainer_email "crazysim@gmail.com" 4 | license "All rights reserved" 5 | description "Installs/Configures steam" 6 | long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) 7 | version "0.1.0" 8 | depends "tmux" 9 | depends "supervisor" 10 | 11 | -------------------------------------------------------------------------------- /recipes/hl.rb: -------------------------------------------------------------------------------- 1 | # Can't believe you're installing this. 2 | 3 | include_recipe "tmux" 4 | include_recipe "supervisor" 5 | 6 | execute "#{node['steam']['dir']}/steam -command update -game valve -dir valve" do 7 | user node['steam']['user'] 8 | cwd node['steam']['dir'] 9 | end 10 | 11 | supervisor_service "valve" do 12 | action :enable 13 | directory "#{node['steam']['dir']}/valve" 14 | command "#{node['steam']['dir']}/valve/hlds_run" 15 | user node['steam']['user'] 16 | end 17 | 18 | -------------------------------------------------------------------------------- /recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook Name:: steam-ds 3 | # Recipe:: default 4 | # 5 | # Copyright (C) 2013 YOUR_NAME 6 | # 7 | # All rights reserved - Do Not Redistribute 8 | # 9 | 10 | user node['steam']['user'] do 11 | action :create 12 | home node['steam']['dir'] 13 | shell '/bin/bash' 14 | system true 15 | end 16 | 17 | directory node['steam']['dir'] do 18 | owner node['steam']['user'] 19 | group node['steam']['user'] 20 | mode "0755" 21 | action :create 22 | end 23 | 24 | package "ia32-libs" do 25 | action :install 26 | only_if {['foo'].pack('p').size == 8} 27 | end 28 | 29 | remote_file "#{node['steam']['dir']}/hldsupdatetool.bin" do 30 | source "http://storefront.steampowered.com/download/hldsupdatetool.bin" 31 | # This file hasn't changed since 2005 32 | action :create_if_missing 33 | owner node['steam']['user'] 34 | group node['steam']['user'] 35 | mode "755" 36 | end 37 | 38 | execute "echo yes | #{node['steam']['dir']}/hldsupdatetool.bin" do 39 | cwd node['steam']['dir'] 40 | user node['steam']['user'] 41 | creates "#{node['steam']['dir']}/steam" 42 | end 43 | 44 | # Run steam twice 45 | 2.times do 46 | execute "#{node['steam']['dir']}/steam" do 47 | cwd node['steam']['dir'] 48 | user node['steam']['user'] 49 | # Sometimes it updates and it returns 1 on successful update 50 | returns [0,1] 51 | end 52 | end 53 | -------------------------------------------------------------------------------- /chefignore: -------------------------------------------------------------------------------- 1 | # Put files/directories that should be ignored in this file when uploading 2 | # or sharing to the community site. 3 | # Lines that start with '# ' are comments. 4 | 5 | # OS generated files # 6 | ###################### 7 | .DS_Store 8 | Icon? 9 | nohup.out 10 | ehthumbs.db 11 | Thumbs.db 12 | 13 | # SASS # 14 | ######## 15 | .sass-cache 16 | 17 | # EDITORS # 18 | ########### 19 | \#* 20 | .#* 21 | *~ 22 | *.sw[a-z] 23 | *.bak 24 | REVISION 25 | TAGS* 26 | tmtags 27 | *_flymake.* 28 | *_flymake 29 | *.tmproj 30 | .project 31 | .settings 32 | mkmf.log 33 | 34 | ## COMPILED ## 35 | ############## 36 | a.out 37 | *.o 38 | *.pyc 39 | *.so 40 | *.com 41 | *.class 42 | *.dll 43 | *.exe 44 | */rdoc/ 45 | 46 | # Testing # 47 | ########### 48 | .watchr 49 | .rspec 50 | spec/* 51 | spec/fixtures/* 52 | test/* 53 | features/* 54 | Guardfile 55 | Procfile 56 | 57 | # SCM # 58 | ####### 59 | .git 60 | */.git 61 | .gitignore 62 | .gitmodules 63 | .gitconfig 64 | .gitattributes 65 | .svn 66 | */.bzr/* 67 | */.hg/* 68 | */.svn/* 69 | 70 | # Berkshelf # 71 | ############# 72 | Berksfile 73 | Berksfile.lock 74 | cookbooks/* 75 | tmp 76 | 77 | # Cookbooks # 78 | ############# 79 | CONTRIBUTING 80 | CHANGELOG* 81 | 82 | # Strainer # 83 | ############ 84 | Colanderfile 85 | Strainerfile 86 | .colander 87 | .strainer 88 | 89 | # Vagrant # 90 | ########### 91 | .vagrant 92 | Vagrantfile 93 | 94 | # Travis # 95 | ########## 96 | .travis.yml 97 | -------------------------------------------------------------------------------- /Vagrantfile: -------------------------------------------------------------------------------- 1 | require 'berkshelf/vagrant' 2 | 3 | Vagrant::Config.run do |config| 4 | # All Vagrant configuration is done here. The most common configuration 5 | # options are documented and commented below. For a complete reference, 6 | # please see the online documentation at vagrantup.com. 7 | 8 | # The path to the Berksfile to use with Vagrant Berkshelf 9 | # config.berkshelf.berksfile_path = "./Berksfile" 10 | 11 | # An array of symbols representing groups of cookbook described in the Vagrantfile 12 | # to skip installing and copying to Vagrant's shelf. 13 | # config.berkshelf.only = [] 14 | 15 | # An array of symbols representing groups of cookbook described in the Vagrantfile 16 | # to skip installing and copying to Vagrant's shelf. 17 | # config.berkshelf.except = [] 18 | 19 | config.vm.host_name = "steam-ds-berkshelf" 20 | 21 | config.vm.box = "opscode-ubuntu-12.04" 22 | config.vm.box_url = "https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_chef-10.18.2.box" 23 | 24 | # Boot with a GUI so you can see the screen. (Default is headless) 25 | # config.vm.boot_mode = :gui 26 | 27 | # Assign this VM to a host-only network IP, allowing you to access it 28 | # via the IP. Host-only networks can talk to the host machine as well as 29 | # any other machines on the same network, but cannot be accessed (through this 30 | # network interface) by any external networks. 31 | config.vm.network :hostonly, "33.33.33.10" 32 | 33 | # Assign this VM to a bridged network, allowing you to connect directly to a 34 | # network using the host's network device. This makes the VM appear as another 35 | # physical device on your network. 36 | 37 | # config.vm.network :bridged 38 | 39 | # Forward a port from the guest to the host, which allows for outside 40 | # computers to access the VM, whereas host only networking does not. 41 | # config.vm.forward_port 80, 8080 42 | # This does not work at the moment. 43 | # config.vm.forward_port 27015, 27015, { :name => "server1tcp"} 44 | # config.vm.forward_port 27015, 27015, { :name => "server1udp", :protocol => "udp" } 45 | # config.vm.forward_port 27016, 27016, { :name => "server2tcp"} 46 | # config.vm.forward_port 27016, 27016, { :name => "server2udp", :protocol => "udp" } 47 | 48 | # Share an additional folder to the guest VM. The first argument is 49 | # an identifier, the second is the path on the guest to mount the 50 | # folder, and the third is the path on the host to the actual folder. 51 | # config.vm.share_folder "v-data", "/vagrant_data", "../data" 52 | 53 | config.ssh.max_tries = 40 54 | config.ssh.timeout = 120 55 | 56 | config.vm.provision :chef_solo do |chef| 57 | chef.json = { 58 | :mysql => { 59 | :server_root_password => 'rootpass', 60 | :server_debian_password => 'debpass', 61 | :server_repl_password => 'replpass' 62 | } 63 | } 64 | 65 | chef.run_list = [ 66 | "recipe[apt]", 67 | "recipe[steam-ds::default]", 68 | "recipe[steam-ds::hl]" 69 | ] 70 | end 71 | end 72 | --------------------------------------------------------------------------------