#!/bin/sh -x rm -rf BUILD RPMS SRPMS tmp || true mkdir -p BUILD RPMS SRPMS tmp rpmbuild -bb --define="_topdir $PWD" --define="_tmppath $PWD/tmp" apache.spec 2>&1 | tee apache-build.txt
2012-08-23
Building RPMs cleanly
I recently found this script recently to build a solr rpm and I love how it simply solves so many problems with RPM packaging with a few defines. Here's my slightly modified version for building an apache package, which leaves the SOURCES directory untouched and keeps a log of the build so you can go back and review it later:
2012-07-11
Log housekeeping with python
This week I was able to finally finish some python code I've been writing for $WORK - a script to rotate webserver logs directly to S3. This task was similar to something I'd done a long, LONG time ago (14 years since the first rev!) in a programming language far, far away. I had a much bigger chip on my shoulder then -
site analytics really isn't done with log parsing anymore, so I skipped the whole test for open filehandles and email notifications. Anywhere, here it is - enjoy!
2012-06-29
EBS snapshots and LVM2
I've been meaning to try this for a while to see how it goes - use LVM2 to take an "instantaneous" snapshot of an EBS volume and then let AWS take it's time. I found LVM wasn't as quick as I'd like. Also, I have performance tested this either, so I don't know how bad the latency will be. Either way, I think it's an easy way to get a consistent backup:
EDIT 2013.02.10: "lock data consistently" - I highly recommend "fsfreeze" which is built into most Linux distributions nowadays.
# prep export MYAZ="us-east-1a" export MYINST="i-XXXXXXXX" # create 1st EBS volume and attach ec2-create-volume --size 2 --availability-zone $MYAZ export VOL0="vol-XXXXXXXX" ec2-attach-volume $VOL0 --instance $MYINST --device /dev/sdf # create LVM partition 1 fdisk /dev/sdf # add to LVM pvcreate /dev/sdf1 # create a volume group vgcreate vol0 /dev/sdf1 # create a logical volume lvcreate -l80%FREE -n test vol0 # format it mke2fs -j -m0 /dev/vol0/test # mount it mkdir -p /mnt/vol0/test mount /dev/vol0/test /mnt/vol0/test # lock data consistently # create LVM snapshot lvcreate -L300M -s -n test2 /dev/vol0/test # unlock data consistently # create EBS snapshot ec2-create-snapshot $VOL0 export VOL0_SNAP="snap-XXXXXXXX" # remove LVM snapshot lvremove vol0/test2 # create 2nd EBS volume from snapshot and attach ec2-create-volume --snapshot $VOL0_SNAP --availability-zone $MYAZ export VOL1="vol-YYYYYYYY" ec2-attach-volume $VOL1 --instance $MYINST --device /dev/sdf # import snapshot as new volume group vgimportclone -n vol1 /dev/sdg1 # activate new volume group vgchange -a y vol1 # mount it mkdir -p /mnt/vol1/test2 mount /dev/vol1/test2 /mnt/vol1/test2
EDIT 2013.02.10: "lock data consistently" - I highly recommend "fsfreeze" which is built into most Linux distributions nowadays.
2011-12-29
QoS for Asterisk/PiaF on CentOS with Cisco hard phones & switches
Now that I'm moved into the new office for $WORK, I had to diagnose some phone issues with our new Asterisk based PBX-in-a-Flash phone system. Thankfully, the new office setup is better in a few ways:
- All jacks in the office are active, with PoE
- All the switches are the same model number, Cisco WS-C3560G-48PS
- All the phones are the same model, Cisco SPA504G
After tweaking some SIP settings in PiaF, I found myself looking into QoS. The old office did not have it configured, but I wanted to give it a second look.
Thankfully, Cisco has a QoS feature for those without an CCIE certification - Auto QoS. To enable QoS for our network here, the process was as follows:
! optional: enable debug to watch command macros execute
debug auto qos
! configure the switch
! configure the switch
conf t
! cdp must be running
cdp run
! first configure all end-user portscdp run
int range gi0/1 - 42
cdp enable
cdp enable
auto qos voip cisco-phone
! next configure the PBX port and uplink to other switch
int range gi0/46, gi0/52
cdp enable
cdp enable
auto qos voip trust
exit
exit
! disable debug
no debug auto qos
And AFAICT that's that. Repeat for all switches and redundant ports for the PBX. For more details, there's a configuration example and additional documentation on Cisco's site.
Subscribe to:
Posts (Atom)