Permalink
Browse files

Add teamspeak3 cookbook

  • Loading branch information...
1 parent f2b2e3b commit e97237036bb67a534899e507f4bd96fcbbc3df16 @jtimberman jtimberman committed Jul 13, 2010
View
@@ -0,0 +1,39 @@
+DESCRIPTION
+===========
+
+Installs the Teamspeak 3 beta release.
+
+ATTRIBUTES
+==========
+
+Attributes are in the `ts3` keyspace.
+
+* version - Specifies the version to download and set up version-specific directories. This is an override attribute so the default attributes get set correctly with it.
+* arch - Specifies the architecture to download based on the node.kernel.machine. Valid values are amd64 or x86.
+* url - Download URL to use. Note that the teamspeak releases are in a version specific subdirectory that isn't detected automatically, and must be modified manually when updating the version to use.
+
+USAGE
+=====
+
+Include the teamspeak3 recipe on a node's run list to have it download and install Teamspeak 3. The software is under active development and upgrades are not handled automatically. The related attributes (see above) need to be modified for new versions, and those will be downloaded and installed. The database will be preserved for upgrades.
+
+The Teamspeak server process will be started as a runit service. When the service is started for the first time, the runit log output (by default /etc/sv/teamspeak3/log/main/current) will have the relevant password information to manage the Teamspeak server.
+
+LICENSE AND AUTHOR
+==================
+
+Author:: Joshua Timberman <joshua@housepub.org>
+
+Copyright 2009-2010, Joshua Timberman
+
+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.
@@ -0,0 +1,22 @@
+#
+# Author:: Joshua Timberman <joshua@housepub.org>
+# Cookbook Name:: teamspeak3
+# Attributes:: teamspeak3
+#
+# Copyright 2008-2009, Joshua Timberman
+#
+# 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.
+
+node.override[:ts3][:version] = "3.0.0-beta25"
+node.default[:ts3][:arch] = kernel[:machine] =~ /x86_64/ ? "amd64" : "x86"
+node.default[:ts3][:url] = "http://ftp.4players.de/pub/hosted/ts3/releases/beta-25/teamspeak3-server_linux-#{ts3[:arch]}-#{ts3[:version]}.tar.gz"
@@ -0,0 +1,32 @@
+{
+ "providing": {
+ },
+ "attributes": {
+ },
+ "replacing": {
+ },
+ "dependencies": {
+ "runit": [
+
+ ]
+ },
+ "groupings": {
+ },
+ "recommendations": {
+ },
+ "platforms": {
+ },
+ "license": "Apache 2.0",
+ "version": "0.1.0",
+ "maintainer": "Opscode",
+ "suggestions": {
+ },
+ "recipes": {
+ },
+ "maintainer_email": "joshua@opscode.com",
+ "name": "teamspeak3",
+ "conflicting": {
+ },
+ "description": "Installs and starts teamspeak3 as a runit service.",
+ "long_description": "DESCRIPTION\n===========\n\nInstalls the Teamspeak 3 beta release.\n\nATTRIBUTES\n==========\n\nAttributes are in the `ts3` keyspace.\n\n* version - Specifies the version to download and set up version-specific directories. This is an override attribute so the default attributes get set correctly with it.\n* arch - Specifies the architecture to download based on the node.kernel.machine. Valid values are amd64 or x86.\n* url - Download URL to use. Note that the teamspeak releases are in a version specific subdirectory that isn't detected automatically, and must be modified manually when updating the version to use.\n\nUSAGE\n=====\n\nInclude the teamspeak3 recipe on a node's run list to have it download and install Teamspeak 3. The software is under active development and upgrades are not handled automatically. The related attributes (see above) need to be modified for new versions, and those will be downloaded and installed. The database will be preserved for upgrades.\n\nThe Teamspeak server process will be started as a runit service. When the service is started for the first time, the runit log output (by default /etc/sv/teamspeak3/log/main/current) will have the relevant password information to manage the Teamspeak server.\n\nLICENSE AND AUTHOR\n==================\n\nAuthor:: Joshua Timberman <joshua@housepub.org>\n\nCopyright 2009-2010, Joshua Timberman\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n"
+ }
@@ -0,0 +1,8 @@
+maintainer "Opscode"
+maintainer_email "joshua@opscode.com"
+license "Apache 2.0"
+description "Installs and starts teamspeak3 as a runit service."
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
+version "0.1"
+
+depends "runit"
@@ -0,0 +1,58 @@
+#
+# Author:: Joshua Timberman <joshua@housepub.org>
+# Cookbook Name:: teamspeak3
+# Recipe:: default
+#
+# Copyright 2008-2009, Joshua Timberman
+#
+# 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.
+
+base = "teamspeak3-server_linux-#{node[:ts3][:arch]}"
+basever = "#{base}-#{node[:ts3][:version]}"
+
+service "teamspeak3" do
+ action :nothing
+end
+
+remote_file "/tmp/#{basever}.tar.gz" do
+ source node[:ts3][:url]
+ mode 0644
+ not_if { ::FileTest.exists?("/tmp/#{basever}.tar.gz") }
+end
+
+execute "install_ts3" do
+ cwd "/srv"
+ command "tar zxf /tmp/#{basever}.tar.gz"
+ subscribes :run, resources(:remote_file => "/tmp/#{basever}.tar.gz"), :immediately
+ notifies :restart, resources(:service => "teamspeak3")
+ not_if { ::FileTest.exists?("/srv/#{base}/ts3server_linux_#{node[:ts3][:arch]}") }
+end
+
+user "teamspeak-server"
+group "teamspeak-server"
+
+directory "/srv/#{base}" do
+ owner "teamspeak-server"
+ group "teamspeak-server"
+end
+
+link "/srv/teamspeak3" do
+ to "/srv/#{base}"
+end
+
+runit_service "teamspeak3"
+
+log "Set up teamspeak3 server. To get the server admin password and token, check the runit log." do
+ action :nothing
+ subscribes :write, resources(:execute => "install_ts3")
+end
@@ -0,0 +1,2 @@
+#!/bin/bash
+exec svlogd -tt ./main
@@ -0,0 +1,5 @@
+#!/bin/bash
+cd /srv/teamspeak3
+export LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH"
+exec 2>&1
+exec chpst -u teamspeak-server ./ts3server_linux_<%= node[:ts3][:arch] %>

0 comments on commit e972370

Please sign in to comment.