Skip to content
This repository has been archived by the owner on Apr 3, 2019. It is now read-only.

Commit

Permalink
Merge pull request #358 from mozilla/rfk/update-dev-heka
Browse files Browse the repository at this point in the history
Update heka configuration for awsbox
  • Loading branch information
rfk committed Nov 27, 2013
2 parents 5bcd8c5 + ad7a2cd commit c334009
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 14 deletions.
7 changes: 2 additions & 5 deletions scripts/awsbox/hekad.toml
@@ -1,23 +1,20 @@
[hekad]
base_dir = "/home/app/hekad"

[UdpInput]
address = "127.0.0.1:4880"

[StatsdInput]
address = ":8125"

[StatAccumInput]

[fxa-auth-server-log]
type = "LogfileInput"
logfile = "/home/app/code/server.log"
logfile = "/home/app/code/var/log/key_server.js.log"
logger = "fxa-auth-server-log"

[nginx-access-log]
type = "LogfileInput"
logfile = "/home/proxy/var/log/nginx/access.log"
decoders = ["nginx-log-decoder"]
decoder = "nginx-log-decoder"

[nginx-log-decoder]
type = "PayloadRegexDecoder"
Expand Down
37 changes: 34 additions & 3 deletions scripts/awsbox/post_create.sh
@@ -1,6 +1,7 @@
#!/usr/bin/env bash
MYPWD=`pwd`


echo "Setting up mysql"

sudo /sbin/chkconfig mysqld on
Expand All @@ -9,25 +10,52 @@ echo "CREATE USER 'fxa'@'localhost';" | mysql -u root
echo "CREATE DATABASE fxa;" | mysql -u root
echo "GRANT ALL ON fxa.* TO 'fxa'@'localhost';" | mysql -u root


echo "Setting up memcached"

sudo /sbin/chkconfig memcached on
sudo /sbin/service memcached start


echo "Setting up nginx"

sudo /sbin/chkconfig nginx on
sudo /sbin/service nginx start


echo "Setting up heka"

HEKAFILE=heka-0_4_0-picl-idp-amd64.tar.gz
wget https://people.mozilla.com/~rmiller/heka/$HEKAFILE
HEKAURL=https://github.com/mozilla-services/heka/releases/download/v0.4.1/heka-0_4_1-linux-amd64.tar.gz
HEKAFILE=`basename $HEKAURL`
wget $HEKAURL
pushd /home/app
sudo tar zxvf $MYPWD/$HEKAFILE
sudo chown -R app:app heka-0_4_0-linux-amd64
sudo chown -R app:app heka-0_4_1-linux-amd64
popd


echo "Setting up circus"

sudo yum install --assumeyes python-devel python-pip
sudo pip install circus
sudo tee --append /home/app/circus.ini << EOF
[watcher:hekad]
working_dir=/home/app/hekad
cmd=/home/app/heka-0_4_1-linux-amd64/bin/hekad -config=/home/app/code/scripts/awsbox/hekad.toml
numprocesses = 1
stdout_stream.class = FileStream
stdout_stream.filename = /home/app/hekad/circus.stdout.log
stdout_stream.refresh_time = 0.5
stdout_stream.max_bytes = 1073741824
stdout_stream.backup_count = 3
stderr_stream.class = FileStream
stderr_stream.filename = /home/app/hekad/circus.stderr.log
stderr_stream.refresh_time = 0.5
stderr_stream.max_bytes = 1073741824
stderr_stream.backup_count = 3
EOF


echo "Installing identity team public keys"

git clone https://github.com/mozilla/identity-pubkeys
Expand All @@ -37,6 +65,7 @@ cat *.pub >> /home/ec2-user/.ssh/authorized_keys
cd ..
rm -rf identity-pubkeys


echo "Setting up postfix as the mailserver"

sudo alternatives --set mta /usr/sbin/sendmail.postfix
Expand Down Expand Up @@ -69,9 +98,11 @@ sudo /usr/sbin/postmap /etc/postfix/sasl_passwd
sudo service postfix start
sudo chkconfig postfix on


echo "Cleaning up old logfiles"

sudo rm -rf /var/log/nginx/access.log-*
sudo rm -rf /var/log/nginx/error.log-*


echo "post-create complete!"
13 changes: 7 additions & 6 deletions scripts/awsbox/post_deploy.sh
@@ -1,12 +1,13 @@
#!/usr/bin/env bash

echo "Restarting hekad"
echo "Restarting hekad via circus"

pid=`pgrep -f hekad`
if [[ $pid ]] ; then
kill -s INT $pid
fi
mkdir -p /home/app/hekad
nohup /home/app/heka-0_4_0-linux-amd64/bin/hekad -config=$HEKAD_CONFIG > /home/app/hekad/hekad.log 2>&1 &
if pgrep -f circusd
then
circusctl restart hekad
else
nohup /usr/bin/circusd --daemon /home/app/circus.ini > /home/app/circusd.log 2>&1 &
fi

echo "DONE"

0 comments on commit c334009

Please sign in to comment.