The Satyavolu Family Website

Development

Installing MySQL gem on Mac OS X Leopard

Installing the MySQL gem on Leopard was much more painful than I thought. I had the 64-bit version of MySQL already installed. So I had to uninstall MySQL on Leopard, which was a challenge all on its own. Here is what I did (after stopping MySQL, and backing up my databases first, of course):

sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*
vi /etc/hostconfig # remove the line MYSQLCOM=-YES-

Then I had to install the 32-bit version of MySQL for Mac OS X. After that is installed, I had to use the following to get the gem to compile:

sudo env ARCHFLAGS="-arch i386" gem install mysql -- \
--with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib \
--with-mysql-include=/usr/local/mysql/include

iPhone UI for Rails applications

iPhone - I got the key.

I knew something like this should and would exist – nice work.. Will try and incorporate into the next Rails thing we do!

Slash Dot Dash � Blog Archive � iPhone on Rails – Creating an iPhone optimised version of your Rails site using iUI and Rails 2.


Configuring Gmail as SMTP Relay on Elastix

Elastix uses Postfix, and getting Postfix configured to use Gmail as a SMTP Relay has been incredibly painful to do. This should not be as difficult as it turned out to be, but here is what I had to do to get things working.

Edit the /etc/postfix/main.cf file

nano /etc/postfix/main.cf

Change these lines to your external domain and the name of your elastix server:

################################
#Ingresado por yb-webadmin
mydomain = myrealdomain.gotdns.org
myhostname = elastix.myrealdomain.gotdns.org

Change the following line

#relayhost = [an.ip.add.ress]

to

relayhost = [smtp.gmail.com]:587

Create a new file /etc/postfix/sasl_passwd and put the following line in it

[smtp.gmail.com]:587       loginname@gmail.com:password

Then run the following command

postmap hash:/etc/postfix/sasl_passwd

Create a directory /etc/postfix/certs. Generate a self-signed certificate as follows

cd /etc/postfix/certs
openssl req -new -x509 -keyout cakey.pem -out cacert.pem -days 365
openssl genrsa -out gm.key 1024
openssl req -new -key gm.key -out gm.csr
openssl ca -cert cacert.pem -keyfile cakey.pem -out ./gm.pem -infiles gm.csr

If you get an error that says something like

Could not open directory ../../CA/newcerts

then do the following before you run the commands above

mkdir -p ../../CA/newcerts
touch ../../CA/index.txt
echo "01" >> ../../CA/serial

and after you are done, you can remove the above directory using

rm -rf ../../CA

Add the following lines to /etc/postfix/main.cf

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
 
smtp_use_tls = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_tls_note_starttls_offer = yes
tls_random_source = dev:/dev/urandom
smtp_tls_scert_verifydepth = 5
smtp_tls_key_file=/etc/postfix/certs/gm.key
smtp_tls_cert_file=/etc/postfix/certs/gm.pem
smtpd_tls_ask_ccert = yes
smtpd_tls_req_ccert =no
smtp_tls_enforce_peername = no

And finally run

postfix reload

Check your setup by sending a test email

mail myself@myemail.com

And check the logs for anything going wrong

tail -f /var/log/maillog

Social Networking in a box

communities already existI have been looking for a while for a bunch of social networking functionality to use out of the box – it is ridiculous that you have to build all the same basic things over and over again. I think I found exactly what I was looking for – Community Engine can be used as is, but is designed as a plugin as opposed to as an application. Very nice. One of these days, I might actually try it out. Now this is the kind of stuff that makes it harder to go with Django – community is more vibrant on the Rails side.

Community Engine – Documentation.