Ruby on Rails: configuration Rails rake ruby setup sub directories tdd test
by bseanvt
leave a comment
bash environment Linux: bash configuration development environment named pipe pipes tmux
by bseanvt
2 comments
How to Copy and Paste to/from the Global Register with Tmux on Mac OS X
Using the system clipboard with tmux on OS X is broken. I really like tmux but having copy and paste is kind of important for me. Here is my attempt to get it back with a simple bash script until I find something better. The approach is to take a named pipe and feed it the contents of “tmux showb”. A bash script will manage the pipe and because this script is initialized from a normal session it will write to the system clipboard just fine.
In my .bash_profile…
pipe4tmux=/tmp/pipe4tmux alias tcp="tmux showb > $pipe4tmux" if [[ ! -p $pipe4tmux ]]; then ~/pipe4tmux.sh & fi
And in pipe4tmux.sh…
#!/bin/bash pipe4tmux=/tmp/pipe4tmux echo "Starting named pipe $pipe4tmux" trap "rm -f $pipe4tmux" EXIT if [[ ! -p $pipe4tmux ]]; then mkfifo $pipe4tmux fi while true do pbcopy < $pipe4tmux done echo "Quitting pipe4tmux $pip4tmux"
Posts: configuration dreamhost freeze gems MySQL port Rails unpack
by bseanvt
leave a comment
Deploying to Dreamhost
Remember to include the host declaration in the database.yml file when you deploy to Dreamhost. Dreamhost does not use “localhost” which is typically the default setting when using the mysql adapter and developing locally or even on a small site.
At least for me, when I ported a Rails app to Dreamhost, this was the only “Gotcha”, because my log files were not reporting any errors and were instead serving the 500 something went wrong file.
A sample config/database.yml file
production: adapter: mysql username: youruser password: yourpasswd database: ror_production_db host: mysql.yourdomain.com
To port, I unpack my gems, if I haven’t already
rake gems:unpack
Then I freeze and package rails w/ my app just in case versions aren’t exact
rake rails:freeze:gems
Then I upload to Dreamhost!
Using sendmail to send mail on ubuntu box
I normally install postfix for my MTA. However, I’ve never really used sendmail so I’d decide to give it a whirl for a new application I’m working on. I don’t use it for anything but handling the mail that the application needs to send out, like new user welcome emails, password resets, etc.
apt-get install sendmail
Sendmail, unlike postfix, won’t work out of the box. Postfix will prompt you for the necessary config setup when running the install. Sendmail won’t, and therefore it’s not ‘out of the box’. You’ll have to make some modifications on your own. Nothing major but this is what I’ve found in order to get it to work, reliably and quickly. The first thing I did was add the fully qualified domain name to my /etc/hosts file
#vim /etc/hosts 127.0.0.1 www.mydomain.com
After this I added the fully qualified domain name to my apache default configuration file
#/etc/apache2/sites-available/default ServerName www.mydomain.com #vhost info etc...
Reload and restart…
/etc/init.d/apache2 force-reload /etc/init.d/sendmail restart
You can test sendmail like so
sendmail email@example.com hello from me .
This should deliver a message to you (the “.” on a new line, followed by a new line, closes the message).
Ruby on Rails: configuration development email postfix ssl
by bseanvt
leave a comment
Postfix, ActionMailer and OpenSSL Fix on Ubuntu
If you run into problems using ActionMailer > 2.2, Postfix and OpenSSL while sending mail from your application, try changing the following:
vim /etc/postfix/main.cf
Change
smtpd_use_tls=yes
to
smtpd_use_tls=no
OpenSSL support with Postfix does not work out of the box. You can either generate valid certificates or tell Postfix not to use the certificates. More information is available in this discussion forum.
http://forum.slicehost.com/comments.php?DiscussionID=2656
Ruby on Rails: configuration MySQL production Rails yml
by bseanvt
leave a comment
Sample Rails Database Config for MySQL
Sample Ruby on Rails database config file for connecting to mysql.
production: adapter: mysql encoding: utf8 reconnect: false database: db_production pool: 5 username: db_user password: db_password #socket: /tmp/mysql.sock #this may vary


