Tasty Cookies with nginx

In a previous post I talked about the best way to handle putting an application into maintenance mode. In addition to sending the appropriate status code (503) for machines, nginx is configured to serve a helpful page to inform users of the maintenance window. Today, I would like to build on this configuration to make it possible for a few users to test the application while it is in maintenance mode for the rest of the world. There are a few different ways this could be handled, but HTTP cookies are a simple and flexible solution.

Recall these directives which instruct nginx to check for our maintenance page and set the status code to 503:

if (-f $document_root/system/maintenance.html) {
  return 503;
}

Let’s modify this with a variable to track state. Now, we can add an additional check for anything we would like to turn $maint off. $http_cookie holds all the cookies for the request:

set $maint off;

if (-f $document_root/system/maintenance.html) {
  set $maint on;
}

if ($http_cookie ~* "topsekrit" ) {
  set $maint off;
}

if ($maint = on) {
  return 503;
}

You can now set a cookie with a value of “topsekrit” and nginx will let you circumvent the maintenance page to test your new code before you release it to the world.

Introducing the new Onehub White Label Collaboration Solution

Made by Onehub. Powered by Onehub. But we’ll keep that between us.

We’ve recently added an exciting new feature to the Enterprise Edition that allows you to remove all the Onehub branding so it looks like a solution that you developed. Absolutely no Onehub logos. Just use the white label settings found in the Account profile section to customize Onehub even further.

Here is a look at the settings you can use to customize your Onehub account.

Custom Domain Mapping

Create custom URLs that include your company name and exclude Onehub.

Hide the Help Menu in the Onehub Bar

Hides the Help link and drop-down menu in the top black bar.

Hide the logo in the Onehub Bar

Replaces the Onehub logo in the top black bar with a text link to the User Home

Hide the logo in the user home

Removes the Onehub logo in the User Home area including Home, Activity, and Settings


Questions about the Onehub white label solution? Feel free to contact [email protected].

Conversations with Customers: MossWarner

MossWarner logo

In this edition of Conversations with Customers I had the pleasure of speaking with Marcy Kalina, Vice President of MossWarner. Marcy will be telling us about how Onehub’s ease of use provided the best Intranet and Extranet solution for her company.


Brandon Caplan (Onehub): Can you tell us a little about what MossWarner does, and what role you play in the company?

Marcy Kalina: MossWarner is a sales and marketing communications agency based in San Juan Capistrano, Trumbull, CT, and Princeton, NJ. We focus on engaging, educating, and equipping sales teams through sales communications and in the areas of:

  • Branding & Messaging
  • Internal Communications
  • Meetings & Events
  • Thought Leadership

I’ve been with MossWarner for 12 years and I am Vice President. On client projects, I act as a Project Director and day to day contact.

Brandon: How did you hear about Onehub?

Marcy: I found Onehub via the web. Jack Fearing, our Art Director and I have been searching off and on over the last 5 years for the right Intranet/Extranet solution.

We started our search again in February of this year and added Onehub to our list after it came up in a Google search for Extranets and file sharing.

Brandon: And how is Moss Warner using Onehub today?

Marcy: We use Onehub for file sharing between our offices. We need to share the large graphics and video files we produce. We also use it as a company Intranet to store administrative documents, our sales & marketing materials, best practices, proposals, etc.

Onehub also serves as a client facing extranet. We create branded hubs when we have project files we want to share with our clients. Some of our clients can’t send or receive files over 5 MB, so Onehub offers a great solution.

Brandon: When you were evaluating various services, what led you to choose Onehub?

Marcy: We did a quick review of the Onehub website which led us to quickly see that Onehub offered us the features that met our needs. Other companies either offer too many features that we will never use and will be too hard to manage. Some do not have enough features and just act as an FTP/file storage area.

We don’t have an IT administrator on staff, so our solution had to be easy to use, maintain and support for all of our associates. It also had to be easy to use for our clients. We signed up for a trial version which quickly confirmed that Onehub would meet our needs. We could see that we would be able launch a professional looking hub very quickly. We knew that the training videos would help us to provide additional information to quickly train our associates.

Brandon: What benefits are you seeing from your use of Onehub?

Marcy: Onehub provides us with one more way to delight our customers and provide value to them. Onehub helps our associates to be more productive and efficient. It makes our lives easier.

Brandon: What is your favorite feature in Onehub, and why?

Marcy: I can’t pick just one…

From an administrative standpoint:

  • Account Management: I like how easy it is to manage the account: storage, hubs, access levels.
  • Activity Monitoring: I can see all actions taking place within the hubs.

From a Project Management standpoint:

  • Create a Hub: I like how quick and easy it is to set up a hub.
  • Activity Monitoring: Ability to monitor the actions within my hub. I can tell when a client has downloaded a file.
  • I really like making my clients happy. Our clients tell us they like using our project hubs.

I want to thank Marcy for taking the time out of her busy schedule to talk with us. If you have a story about how Onehub has helped your company, we’d love to hear it. Send us an email at [email protected].

Customizing Zendesk

We use Zendesk for our support site, but even though it’s a third party site we want our users to feel right at home when they are visiting there. In order to accomplish this, we have made use of Zendesk’s impressive customization options, which let us write our own custom CSS and Javascript.

It’s All About the Widgets

As part of Zendesk’s service, users have access to an array of “widgets” that can be leveraged to customize your presence. These widgets have the capacity to be exposed to as many, or as few, end users as you’d like. Zendesk breaks it down into three groups – “Agents,” or members of the support team, “Logged in end-users” and “Anyone.” For our customization, I used the CSS and Javascript widgets.

I broke up my CSS into two widgets – one for all users, and one just for Agents, since Zendesk offers added functionality for Agents that’s not present for everyone else. The bulk of my CSS was applied to the Everyone stylesheet, and then I just tweaked the Admin stylesheet to account for the differing interface elements.

zendesk_widgets

Javascript to the Rescue!

The trickiest aspect to this customization was that I needed more “hooks” (unique identifiers) to attach CSS rules to than I was provided. I applied a handful of scripts that used Prototype’s addClassName method to get some extra classes (my biggest target was the navigation links). We also wanted to update some of the links in the header of the Support site. Unfortunately, Zendesk doesn’t offer any mechanism to adjust those links through their management console, but Javascript again came to the rescue. Using Prototype’s update method we changed the content of a handful of the navigational links, and then with insert we added a few new links (back to the main site, for example). This was all relatively painless, and so far has worked without issue.

Something to Keep in Mind

Widgets (at least the CSS and JS widgets) are loaded in alphabetical order. So if you name you CSS widgets ‘admin’ and ‘everyone,’ the ‘admin’ widget is going to get loaded first, which means that anything you’re trying to reset in the ‘everyone’ stylesheet won’t work. In order to offset this, and still give the widgets meaningful names, I just numbered them – “1 – Everyone”, “2 – Admin,” etc. With the Javascript widgets you’ll want to keep this in mind, too, since occasionally load order is important.

Also, the presented experience varies widely from user to user, with the forms that are being filled out and the different potential use cases for the application, so make sure to test as many of those paths as possible. Submit forms as an anonymous user, then have an Agent interact with that ticket, and make sure that all of the presented experiences are what you would expect. This does mean that you’ll clutter up your help desk a bit, but you can always go back in and remove the extraneous content before you deploy the site.

Customing Zendesk was largely an easy and pleasant experience. Getting all of the pieces in place was simple, and load times weren’t noticeably hampered by our customization. Furthermore, when we had questions, Zendesk’s support crew were quick to respond with informative answers that solved our problems quickly. Feel free to check out our support site and let us know what you think!

Using Godaddy SSL Certificates with NGINX

Have you just installed your new Godaddy certificate into your NGINX web server, and are you finding that some browsers (notably Safari) don’t trust your website when using your Godaddy SSL Certificate?

This is manifest by the error message “Safari can’t identify the identity of the website ‘your.url.here’” and is caused by the “chain of trust” being incomplete between your certificate and any of the root certificates that your browser client has installed.

Here’s a quick cure for an NGINX installation:

Download the gd_bundle.crt and gd_intermediate.crt certificates from Godaddy’s certificate repository, then combine them:

cat yourcert.crt gd_intermediate.crt gd_bundle.crt > yourcert_bundle.crt

This concatenates your certificate and the Godaddy intermediate certificates into one file. Put the file yourcert_bundle.crt in the place that NGINX is looking for your certs (specified in nginx.conf). Reload your NGINX configuration with:

kill -HUP <pid of nginx>

You should be ready to go! If you want more information on the entire chain of trust, you can download the Godaddy root certificate (gd-class2-root.crt) and use the OpenSSL command utility:

openssl s_client -CAfile gd-class2-root.crt -connect www.yourdomain.com:443  -verify 10

This will pull the certificate from yourdomain.com server, and attempt to verify the chain of trust to whatever root you’ve specified (-CAfile gd-class2-root.crt):

verify depth is 10
CONNECTED(00000003)
depth=2 /C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority
verify return:1
depth=1 /C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./OU=http://certificates.godaddy.com/repository/CN=Go Daddy Secure Certification Authority/serialNumber=07992287
verify return:1
depth=0 /O=*.yourdomain.com/OU=Domain Control    Validated/CN=*.yourdomain.com
verify return:1
—-
Certificate chain
 0 s:/O=*.yourdomain.com/OU=Domain Control Validated/CN=*.yourdomain.com
   i:/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./OU=http://certificates.godaddy.com/repository/CN=Go Daddy Secure Certification Authority/serialNumber=07992287
 1 s:/O=*.yourdomain.com/OU=Domain Control Validated/CN=*.yourdomain.com
   i:/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./OU=http://certificates.godaddy.com/repository/CN=Go Daddy Secure Certification Authority/serialNumber=07992287
 2 s:/C=US/ST=Arizona/L=Scottsdale/O=GoDaddy.com, Inc./OU=http://certificates.godaddy.com/repository/CN=Go Daddy Secure Certification Authority/serialNumber=07992287
   i:/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority
—-
Server certificate
<Continued Output>

This shows that the certificate obtained from the site was verified all the way to a root certificate (specified by -CAfile).

Adding Columns to large MySQL Tables Quickly

Suppose that you have a MySQL Database, and in that database you have a non-trivial table with more than a million records. If you’re using that table with your Rails application, you might at some point like to add some additional columns.

It’s tempting to just write the migration like:

class AddThreeColumnsToQuarks < ActiveRecord::Migration
  def self.up
    add_column :quarks, :arbitrary_field1, :integer
    add_column :quarks, :arbitrary_field2, :string
    add_column :quarks, :arbitrary_field3, :integer
  end

  def self.down
    remove_column :quarks, :arbitrary_field1
    remove_column :quarks, :arbitrary_field2
    remove_column :quarks, :arbitrary_field3
  end
end

Should you do that, you will find that although it works, MySQL will take a fantastic amount of time to add the column when you have a lot of rows. What ActiveRecord is doing is adding each column individually with an alter statement:

ALTER TABLE `quarks` ADD `arbitrary_field1` int(11)
ALTER TABLE `quarks` ADD `arbitrary_field2` varchar(255)
ALTER TABLE `quarks` ADD `arbitrary_field3` int(11)

Each one of those ALTER statements makes a new temporary table, copies records from your existing table into the new table, and then replaces the old table with the new table. Five thousand records in the database? Adding three columns will copy the DB three times. Fifteen thousand rows are copied.

One can make this better by combining the ALTERs into one statement (as long as the ALTER contains a single type of operation, such as ADD COLUMN). The copy of the data in the table still takes a while. A few million rows? You might be waiting tens of minutes.

A FASTER way of adding columns is to create your own new table, then SELECT all of the rows from the existing table into it. You can create the structure from the existing table, then modify the structure however you’d like, then SELECT in the data. MAKE SURE that you SELECT the information into the new table in the same order as the fields are defined. Here’s an example:

class AddThreeColumnsToQuarks < ActiveRecord::Migration
  def self.up
    sql = ActiveRecord::Base.connection()
    sql.execute "SET autocommit=0"
    sql.begin_db_transaction
    sql.execute("CREATE TABLE quarks_new LIKE quarks")
    add_column :quarks_new, :arbitrary_field1, :integer
    add_column :quarks_new, :arbitrary_field2, :string
    add_column :quarks_new, :arbitrary_field3, :integer
    sql.execute("INSERT INTO quarks_new SELECT *, NULL, NULL, NULL FROM quarks")
    rename_table :quarks, :quarks_old
    rename_table :quarks_new, :quarks
    sql.commit_db_transaction
    # don't forget to remove quarks_old someday
  end

  def self.down
    drop_table :quarks
    rename_table :quarks_old, :quarks
  end
end

You can change the NULLs into whatever default values you’d like the new columns in the existing rows to have.

How much faster can this be? On one table in one of our databases, a single add_column was approximately 17 minutes. When we used this technique, we reduced the time to add a column to approximately 45 seconds. YMMV —however you’ll notice a big improvement.

What about the indices? The CREATE TABLE .. LIKE preserves column attributes and indices. For more information, see the MySQL on line manual.

Construction Management Companies Reduce Costs with Onehub

In tough economic times construction companies are looking to be more efficient than ever. Reducing costs and accelerating timelines are a top priority. Many look to technology to help them improve their operational efficiency. Web-based software is particularly great at helping construction companies throughout the construction management process because it can be accessed anytime and anywhere — whether in the office, home office or on a jobsite.

Centralizing Documents and Making Project Management Easier

Onehub helps many construction companies connect and coordinate the work of general contractors, subcontractors, architects, and construction workers. By helping companies create a centralized repository for access to documents and business information, Onehub allows sharing of blueprints and construction drawings, RFIs, submittals, purchase orders, site photos and more. That is why construction companies like DTR Contractors, Coastal Construction and Vali Cooper & Associates are using Onehub to enable better project management and make sharing files easier.

Do you have questions about how Onehub can help your construction management company be more efficient? Email us at [email protected] to find out more.

Black Valley Construction Hub

Conversations with Customers: Chef'n

It’s time once again for another post in our “Conversations with Customers” blog series. This time I had the honor of speaking with Jessica Ahlering, Marketing Manager for Chef’n. The interview below details how Jessica and the team at Chef’n are using Onehub as a retailer and distributor extranet.

Chef'n Logo

Kurt Ricketts (Onehub): Can you tell us a little about what Chef’n does, and what role you play in the company?

Jessica Ahlering: We are a house wares company; we design kitchen gadgets, utensils, and other things for cooking. We also have a few other brands in the lifestyle and entertainment category, as well as cleaning products. I am the Marketing Manager so I handle all of the PR, trade shows, packaging, websites, etc.

Kurt Ricketts (Onehub): How did you hear about Onehub?

Jessica Ahlering: Oddly enough, I heard about Onehub through our website developer. We were looking for something that was much prettier than standard FTP sites of today, and our website developer uses Onehub with the company he works for and recommended it to us.

Kurt Ricketts (Onehub): And how is Chef’n using Onehub today?

Jessica Ahlering: We use it as an FTP replacement for hosting all of our product photography, which is one of the largest components of our selling approach. Onehub provides the perfect alternative where if we don’t have the product in hand to sell, at least we have an easy way to share and view product photos. We’re also providing hi-res images for our distributors so they can print them out for their catalogs or our retailers can print them out for store signage and other things.

A lot of our photos can be up to 12mb in size, and the Chef’n line alone has over 80 products, and when you include all of the colors that are involved you end up in the hundreds of products, there was really no source available to provide all of that without either slowing down people’s computers or being too complicated to understand. We were also really concerned with making sure it was brand specific. We didn’t want to create an FTP site that we had to manage, maintain, and host, because that was more than we wanted to handle in-house.

We currently have hubs where we host photography and videos. We also have hubs used domestically for our retailers, and others used internationally for our distributors, where I can give them collateral, advertisement and marketing ideas, PR samples, all in a very clean and presentable package.

Kurt Ricketts (Onehub): When you were evaluating various services, what led you to choose Onehub?

Jessica Ahlering: I did a ton of research on FTP sites, and other options and possibilities. We needed a solution that was easy for our retailers and distributors to access, so they see all of our products and easily download the photos to choose what they want. Some services in my search just became too complicated to do this. Also, I love how you can view the photos nicely and easily, which helps to create an environment where it feels like our retailers are purchasing the products in the store.

The second thing which is a huge bonus is the customization and branding. We have added our logo, and we can choose a color scheme that is specific to our brand. Not only are we a design forward company but we are very color conscience and very well known for that in our industry, so being able to provide a really bright and colorful online location was an added benefit. I think it’s just easier, I mean, all of the other FTP sites that

I looked at kind of looked like a Microsoft folder, and some of them were just way too difficult to understand and had no personality. One of our core values is that we are design oriented so speaking to our retailers and distributors through something with no personality wasn’t going to work for us.

Kurt Ricketts (Onehub): What benefits are you seeing from your use of Onehub?

Jessica Ahlering: A lot of the people and industries we interact with don’t have a lot of experience with computers, so Onehub has helped us to provide information to our retailers and distributors in an easy to understand format. FTP was simply too complicated for most users, and it would have been too costly to try and develop and manage something on our own.

Kurt Ricketts (Onehub): What is your favorite feature in Onehub, and why?

Jessica Ahlering: I would have to say the customization potential, I spent a lot of time customizing and tailoring Onehub to fit our specific needs, from the color scheme, to the layout, and adding the right features for each hub’s purpose. The hubs are friendly, welcoming, and interesting. I feel that our site will inspire them to want more.