Created
December 8, 2011 17:25
-
-
Save funollet/1447708 to your computer and use it in GitHub Desktop.
deploy graylog2
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
def graylog2server(release='0.9.5p1'): | |
# Needs debian-backports on /etc/apt/sources.list | |
__apt_do('install -t squeeze-backports', 'mongodb') | |
__apt_do('install', 'openjdk-6-jre') | |
# Download. | |
name = 'graylog2-server-%s' % release | |
url = 'https://github.com/downloads/Graylog2/graylog2-server/%s.tar.gz' \ | |
% name | |
__wget(url) | |
# Install on /src. | |
with cd('/srv/'): | |
__untar(name) | |
run('ln -s %s graylog2-server' % name) | |
# Configure Graylog2. | |
run('mkdir /etc/graylog2.d/') | |
with cd('/srv/graylog2-server/'): | |
run('cp graylog2.conf.example /etc/graylog2.conf') | |
sed('/etc/graylog2.conf', '=.*', '= false', '^mongodb_useauth') | |
sed('/etc/graylog2.conf', '=.*', '= 127.0.0.1', '^mongodb_host') | |
#TODO: run with supervisor. | |
with cd('/srv/graylog2-server/bin/'): | |
run('./graylog2ctl start') | |
# java -Djava.net.preferIPv4Stack=true -jar /opt/graylog2-server/graylog2-server.jar | |
def graylog2web(release='0.9.5p1'): | |
__apt_do('install', 'ruby1.8 rubygems rake make libopenssl-ruby' \ | |
+ ' ruby-dev build-essential git-core') | |
has_gem_bundle = run('gem list bundle') | |
if not 'bundle' in has_gem_bundle: | |
run('gem install bundler') | |
# Download. | |
name = 'graylog2-web-interface-%s' % release | |
url = 'https://github.com/downloads/Graylog2/graylog2-web-interface/%s.tar.gz' % name | |
__wget(url) | |
# Install on /srv. | |
with cd('/srv/'): | |
__untar(name) | |
run('ln -s %s graylog2-web-interface' % name) | |
with cd('/srv/graylog2-web-interface'): | |
run('bundle install') | |
with cd('config/'): | |
# Configure webapp. | |
run('mv mongoid.yml mongoid.example.yml') | |
print('''Configure config/*.yml and run: | |
# bundle exec rake db:mongoid:create_indexes RAILS_ENV=production | |
''') | |
#TODO: serve with Mongrel. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment