Wednesday, December 19, 2012

New Server setup with CentOS 6, Drush and Drupal libs


My compilation of docs and tutorials to help me get a server setup with CentOS 6, Drush and various libs needed for Drupal 7.  Once that is complete and working, a short write-up on getting a Drupal 7 site up and running in less than 2 minutes.
  1. Webmin install and setup: http://jarodms-drupal.blogspot.com/2012/07/webmin-on-ec2.html
  2. Config Firewall for Webmin:   http://www.webmin.com/firewall.html
  3. LAMP Setup: http://library.linode.com/lamp-guides/centos-6
  4. Drush in less than a minute: http://danreb.com/content/how-install-drush-centos-linux-drupal-development
  5. Additional libraries for Drupal:
    1. yum install php-gd
    2. yum install php-dom
    3. yum install php-mbstring
Additional Steps:
  1. Optimize php.ini
  2. Depending on server, may need to open firewall for port 80

Install Drupal 7 instance in less than 2 minutes:
  1. Create MySQL Database
  2. Create MySQL User/pass
  3. Grant MySQL privileges for user
  4. Config virtual host for new Drupal site and restart Apache

<VirtualHost *:80>
     DocumentRoot "/var/www/html/drupal7"
     ServerName fill-in
     ServerAlias fill-in
     ErrorLog /var/www/logs/drupal7-error.log
     CustomLog /var/www/logs/drupal7-access.log combined
     <Directory "/var/www/html/drupal7">

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

</Directory>
</VirtualHost>



Use Drush to download Drupal and install site:
  1. drush dl 
  2. drush site-install standard --account-name=admin --account-pass=admin --db-url=mysql://SiteMySQLUser:SiteMySQLUserPassword@localhost/SiteMySQLDatabase



Friday, December 7, 2012

My Dell Inspiron 1764 - CentOS 6.3 and Broadcom Wireless BCM43224 driver

There is no default driver for Broadcom wireless cards on CentOS 6.3.  Broadcom is apparently getting better at Linux support, so they provide the source you can compile to get the driver.  Here's the awesome and simple writeup that I found.  It really did take just 5-10 minutes of copy/paste/execute.

I won't even try to recreate all the steps in this blog.  Just go to http://elrepo.org/tiki/wl-kmod and follow the instructions.  Worked like a charm!

My setup:
Dell Inspiron 1764 dual-boot into Windows 7 and CentOS 6.3
PCI Device (lspci at terminal) :
Network controller: Broadcom Corporation BCM43224 802.11a/b/g/n (rev 01)

Tuesday, November 20, 2012

Drupal User Admin module stack

Here's a stack of modules that I like which help a non-administrator manage their own users.

Administer Users By Role:  http://drupal.org/project/administerusersbyrole
Role Delegation:  http://drupal.org/project/role_delegation
Login One Time:  http://drupal.org/project/login_one_time
No Current Password:  http://drupal.org/project/nocurrent_pass

Once installed and enabled, I create a role ("site-owner" for example) and assign it the various permissions.
A few more little tricks and now the Site-Owner can create or cancel users, assign various roles, and send them a One Time Login link if needed.

One caveat I need to investigate...the Administrators (e.g., User 1) are still shown on the list of users (admin/people) and certain roles can be added or removed, but the Administrator role can't be removed and the Admin account can't be edited or canceled.  Really the Site Owner can't do anything harmful to the Admin, but I'd prefer that account wasn't shown at all in the list.  I need a module that will only show the users whose role is less than or equal to the current role.

Thursday, October 18, 2012

Drupal 7, Services 3.x , Request and Response

Here is something that I just recently learned regarding request/response from a REST server.
In this case, I am using Drupal 7 with Services 3.x.

It's just one of those things I guess you don't lean until you need to, and I never had yet.  It was difficult to find the info though.

Here is the scenario:

  1. You are calling a web service using JSON as the Content Type.
  2. You are getting back an XML response.
  3. You want to get back a JSON response.

Here's what you need to do.
Goto your services
 
Select "Edit Server"

Make sure the response formatter "json" is selected.  It may already be.


Now in your JSON REQUEST, add the following header:
Accept = "application/json"

For some reason, Drupal was returning the response in XML format by default, I don't know why, but adding this header to the request immediately gave me back a JSON response.


Monday, July 2, 2012

Webmin on EC2

Installing the RPM package of Webmin on EC2 was a 5 step process for me:

*** Verify the latest RPM version at http://www.webmin.com/download.html
  1. wget http://prdownloads.sourceforge.net/webadmin/webmin-1.610-1.noarch.rpm
  2. sudo rpm -U webmin-1.610-1.noarch.rpm
  3. sudo /usr/libexec/webmin/changepass.pl /etc/webmin root foo
    1. Change the webmin root password to foo. 
  4. sudo /etc/init.d/webmin restart
  5. Configure IPTables to allow port 10000: http://www.webmin.com/firewall.html
Webmin will be accessible at http://youserverip:10000

* Works fine on CentOS in Linode and Rackspace.
* Would be nice to install cert for this though.

Monday, April 16, 2012

What's New in Drupal 7

What's New in Drupal 7 | drupal.org

A good page to read...just in case someone asks you.  ;)

'via Blog this'

Friday, March 30, 2012

Getting Drupal updates into TEST


.

  1. I create a branch from TEST and call it something like updates. (git checkout -b updates)
    1. Now I'm working in the branch updates
  2. Create a backup of the database - important and discussed later.
  3. Pull the necessary modules or Drupal updates and test it out.
  4. Everything look ok?  Then merge the branch to TEST.  
    1. git checkout test
    2. git merge updates
    3. handle any conflicts
Why would you do this rather than pull your Drupal updates right into TEST? Murphy's Law.  If you pull the Drupal updates into TEST first, then somebody is bound to have an issue or item that needs worked on that needs to go into TEST before you had a chance to completely test and verify your Drupal upgrade.  

The approach above helps you get around this.  You're in the middle of testing Drupal updates and someone approaches you with a bug or change that needs to go into TEST first. How do you roll back to the TEST branch? 
  1. checkout TEST (git checkout test)
  2. Restore the database using the backup you created earlier.
  3. You are now at the TEST version you need for the new change, without those Drupal updates that you haven't completely tested.
  4. Create your new bug/change branch and continue on the issue that was asked of you.


Monday, February 27, 2012

Drupal - Bootstrap for old PHP script

In a hurry and I have an old PHP application that pulls data from proprietary tables.  I have connected some of the data to a node, but now I need to display the data in a separate window when applicable.

So, using the old and large PHP script, just to get it functioning, I had to bootstrap Drupal.
Place this at the beginning of OldLarge.php


$drupal_dir = getenv("DOCUMENT_ROOT");
$current_directory = getcwd();
chdir($drupal_dir);


require_once './includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

...
Do my Drupal stuff here....db_query() and whatever so that I can get results back from weird tables.
...

Then at the end of  OldLarge.php , add the final code....


chdir($current_directory);


Eventually...some day (which ends up being never) I will convert the OldLarge.php script to something more Drupalized.

Wednesday, February 8, 2012

CiviCRM "Javascript must be enabled in your browser in order to use the dashboard features"

"Javascript must be enabled in your browser in order to use the dashboard features"

I started getting this error from some of my testers when they were using IE9.  Sure enough, I couldn't access the CiviCRM dashboard or CiviCRM menu (it acted like it was disabled).

Yep, well JavaScript is enabled.

Stats on the site:
CiviCRM version 3.4.8
Latest Drupal (6.24)
Drupal module jquery_update installed (giving Drupal the jQuery version 1.3.2)

Hmmmmmm.....It works FINE with Chrome (16.0.912.77 m), Opera (11.61), Safari (5.1.2), and Firefox (10).

Oh YEAH!  That's right!!!   Internet Explorer doesn't handle a lot of JavaScript files very well.  CSS files are limited to 32(?) I think.  Not sure what the JS limit is.

So on the TEST site I enabled "Optimize JavaScript files" and all works well in IE8/IE9.

Things to look at:
http://drupal.org/project/javascript_aggregator
Great article by Vlad http://shvetsgroup.com/blog/optimizing-javascript-and-css-files-drupal

Wednesday, January 4, 2012

User Agents

A large list of user agents
http://techpatterns.com/forums/about304.html

Any other lists you know of?