Skip to content

Instantly share code, notes, and snippets.

@initcron
Last active April 12, 2017 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save initcron/eff10a8e5bde59b356a485539579d634 to your computer and use it in GitHub Desktop.
Save initcron/eff10a8e5bde59b356a485539579d634 to your computer and use it in GitHub Desktop.
Chef recipe to deploy Facebooc. Uses execute and gurards such as not_if, only_if, creates and action :nothing
package ['libsqlite3-dev', 'sqlite3']
execute 'download_facebooc_from_source' do
command 'wget https://github.com/jserv/facebooc/archive/master.zip'
cwd '/opt'
user 'root'
creates '/opt/master.zip'
notifies :run, 'execute[extract_facebook_app]', :immediately
end
execute 'extract_facebook_app' do
command 'unzip master.zip && touch /opt/.facebooc_compile'
cwd '/opt'
user 'root'
action :nothing
end
execute 'compile_facebooc' do
command 'make all && rm /opt/.facebooc_compile'
cwd '/opt/facebooc-master'
user 'root'
only_if 'test -f /opt/.facebooc_compile'
action :run
end
execute 'run_facebooc' do
command 'bin/facebooc 16000 &'
cwd '/opt/facebooc-master'
user 'root'
not_if 'netstat -an | grep 16000 | grep -i listen'
action :run
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment