WordPress and UW Groups

Get­ting Word­Press to see your UW Groups

An item that’s been on a lot of wish­lists of a lot of peo­ple for a long time now is the abil­ity to have Word­Press and the UW Groups Ser­vice com­mu­ni­cate with each other. Most of my own pur­suit of the issue revolved about using the groups REST API to pull in user data in an asyn­chro­nous man­ner from a Word­Press trig­ger, or oth­er­wise using a lot of con­vo­luted logic to some­thing that would be rather simple.

Recently I’ve been shift­ing my thoughts to lever­ag­ing Shib­bo­leth for this task: shib can release gws_groups a user is a mem­ber of auto­mat­i­cally upon login, and we can then use this data in Word­Press to do var­i­ous things. As a way to throw my thoughts together and get some sort of proof-of-concept flow­ing around, I gath­ered together some PHP and pro­duced this very early plu­gin for Word­Press. Right now it can’t do much, but it can, upon user login, get their gws_group mem­ber­ship under the u_nikky stem, store it in their user­meta infor­ma­tion, and show a user’s groups when view­ing their pro­file page.

Where now?

The ques­tion is what do we want to do with this capa­bil­ity? I’ve thought of a few dif­fer­ent options, but I’m curi­ous if oth­ers have opin­ions or ideas that I haven’t thought of yet. So far the main con­tenders seem to be:

Use Groups to Limit Page/Blog Access

Lever­age groups to limit access to your blog or spe­cific pages on your blog. E.g.: you restrict your blog to mem­bers of u_blogs_nikky_access. Any­one not on this list would be denied access.

Use Groups to assign user roles

Lever­age groups by map­ping them to spe­cific Word­Press user roles. E.g.: all mem­bers of u_blogs_nikky_editors are auto­mat­i­cally given the highest-level that their groups enti­tle them to. 

Using the Plugin

I really wouldn’t rec­om­mend it, but if you wanted to try the plu­gin and have a box that’s run­ning (or could run) shib­bo­leth, shoot me an email or leave a com­ment and I’ll doc­u­ment the steps needed to get it running.


ovid21: RIP

It is with great joy that I inform you that we have finally shut off the aging and some­what can­tan­ker­ous ovid21, which lived its life as the host of a great many MySQL servers. Our replace­ment sys­tems are more pow­er­ful, robust, and allow us to scale more eas­ily as loads increase on these systems.

Tina Fey High Five

Con­grat­u­la­tions everyone!


SFTP Errors

Update: This has been resolved and a fix implemented.

The tran­si­tion from the older filesys­tems to the replace­ments has started with faculty/staff web pub­lish­ing direc­to­ries. We’re see­ing reports that cer­tain SFTP clients, includ­ing Filezilla, will spo­rad­i­cally fail when trans­fer­ring files to or from these direc­to­ries. This is due to the client auto­mat­i­cally clos­ing the con­nec­tion after a period of inac­tiv­ity, recon­nect­ing to a new (!) host, and find­ing that the path no longer exists due to how the new filesys­tem mounts are placed. A time­line is some­thing like this:

  1. User con­nects to homer.u.washington.edu or ovid.u.washington.edu. (I’ll use homer for the rest of this example)
  2. homer.u will con­nect user to one of three homers
  3. User browses around and goes to their public_html directory
  4. While the user is find­ing what they want to do, remem­ber­ing their goals, or get­ting dis­tracted, client auto­mat­i­cally dis­con­nects from the server because it’s a good client that doesn’t use up a con­nec­tion slot just because it can.
  5. User begins trans­fer. Client will auto­mat­i­cally attempt to con­nect to homer.u.washington.edu
  6. Client may con­nect to a *dif­fer­ent* homer than pre­vi­ous, because homer.u is a round-robin
  7. Client will com­plain about dif­fer­ent paths.
  8. Trans­fer fails and client confused.

If they are recon­nected to a homer/ovid that uses the same NFS mount, trans­fer will work nor­mally. This means the fail­ure rates are either 33% or 66% from connection-to-connection, depend­ing on what sys­tem they orig­i­nally were con­nected to.

We’re in the process of look­ing into a sta­ble solu­tion, but in the mean­time, be aware that it may be more reli­able to con­nect to a spe­cific host (homer01.u.washington.edu, for instance) so that clients will always recon­nect to the same one in case of a reconnect.

Additional CPU Cores Added to Servers

After analy­sis of recent sys­tem loads, an addi­tional CPU core was added to each of the Shared UW Web Host­ing servers over the week­end. This should result in improved per­for­mance dur­ing peak hours.


Server Timeout Changes

We’re low­er­ing our Apache time­out val­ues to 60 sec­onds on the depts/faculty/staff/courses servers, effec­tive immediately:

http://httpd.apache.org/docs/2.2/mod/core.html#timeout

This may be decreased fur­ther as required. This change will improve
avail­abil­ity and respon­sive­ness dur­ing high-traffic sit­u­a­tions by more
quickly clear­ing out Apache threads which are not serv­ing data or
await­ing a TCP response from a client.

This should have no impact on almost all site oper­a­tions, but may
cause long-running scripts to fail if they run longer than the time­out
value and don’t out­put any con­tent until the end of the operation.

Site admin­is­tra­tors who require long-running oper­a­tions may want to
con­sider run­ning these from one of the ovid sys­tems via cron.

Please email us at help at uw.edu if you have any ques­tions, want some
help get­ting your long-running thread con­verted to a shell script, or
are inter­ested in switch­ing to a faster on-server stor­age sys­tem for
your data­base files.

If you haven’t yet, we strongly rec­om­mend sign­ing up for the Web Pub­lish­ing announce­ment list, which pro­vides updates on changes and mod­i­fi­ca­tions to the server environment:

http://www.washington.edu/itconnect/web/publishing/mailing-lists

 


Do your part today! Recompile your 32-bit binaries to x86_64!

As some of the last ves­tiges of 32-bit uni­form access com­put­ing are swept away in the face of the brave not-so-new future of 64-bit com­put­ing, this is a friendly reminder that you may need to recom­pile any bina­ries that are still link­ing to out-of-date or dis­ap­pear­ing 32-bit libraries.


Using UW Time Servers on Linux Systems

I like keep­ing accu­rate time, and if you run any sort of Shib­bo­leth app or other ser­vice that also likes keep­ing accu­rate time, you should be a big fan of NTP. UW Infor­ma­tion Tech­nol­ogy main­tains a clus­ter of NTP servers, and as a mat­ter or pride (and as less hops to your NTP server is always bet­ter), it’s a great idea to use them.

I only run Linux sys­tems, so these prob­a­bly only gen­er­ally apply to other oper­at­ing systems.

  1. If you don’t have it installed, install the full ntp client with ‘sudo apt-get install ntp‘ or ‘sudo yum install ntp‘
  2. Edit your NTP file with ‘sudo vim /etc/ntpd.conf‘
  3. You can either remove all of the default servers, or just add the UW clus­ter. I choose to add the UW clus­ter to the top so that it’s the pri­mary. In that case, add ‘server time.u.washington.edu‘
  4. Restart ntp with ‘sudo ser­vice ntp restart‘
  5. Ver­ify with ‘ntpq –pn‘ you should see a remote sys­tem like ‘140.142.1.8′

And that’s a wrap.


OvidQuest: Moving MySQL Servers

It should come as no sur­prise to any­one at this point in the game, but we are indeed going to shut off ovid21.u.washington.edu at the end of the month. Octo­ber 31st, 2012 to be exact. This is the real deal. The out-of-warranty aging ovid21 is just about to take a very well-deserved rest from reli­ably serv­ing up over a thou­sand MySQL servers and count­less mil­lions (bil­lions) MySQL queries.

A cou­ple inter­est­ing graphs to share from my tech lead, David Wall. The first shows a com­par­i­son of MySQL servers run­ning on the three new ovids.

You’ll notice a few inter­est­ing things here.

  • ovid01 was our first of the new ovids put into pro­duc­tion, and it’s where the bulk of our migra­tions and new MySQLds are created.
  • The dips in ovid01’s MySQL count is due to sys­tem reboots: not every­one brings their MySQL server back online after we restart a system.
  • ovid03 has big jumps in the num­ber of MySQL servers run­ning on it after we shifted our rec­om­men­da­tion to ovid03 for new MySQLds
  • ovid02 has a very low num­ber: besides using it for a cou­ple of test accounts we’re not explic­itly pro­mot­ing its use at this time.

We finally crossed! MySQLds on ovid01 is more than the num­ber on ovid21! You’ll note a cor­re­spond­ing increase for ovid03 as out­lined in the graph above.

Once ovid21 is finally offline, we can focus on high­light­ing and doc­u­ment­ing all of the new fea­tures and func­tion­al­ity this new ovid clus­ter con­tains: includ­ing enhanced Inn­oDB sup­port, per-user DNS, and local filesys­tem space for even speed­ier disk IO.


Rediscovering the Front-End Web

Intro­duc­tion

I’ve never really fully fleshed out why I’ve shied away from web design, but my lead­ing the­ory has to do with con­trol: one can tightly grasp how frame­works and code inter­act with the servers, and when hand­ing off this work to a browser, you can never fully pre­dict how it will react. I’ve never liked the idea of mak­ing browser-specific expe­ri­ences and test­ing with dif­fer­ent devices. With the back-end devel­op­ment, I can eas­ily make sure every­thing is work­ing as it should and can leave the design­ing to some­one much more capa­ble than I am–and per­haps with more patience too. And, of course, I have a mind set of “well, all you need is a but­ton and para­graphs. If I know how to use it, that’s good enough for anyone.”

After spend­ing years knee-deep in code and servers, I’ve decided to refresh myself in the world of web design. I started pok­ing around at dif­fer­ent tech­nolo­gies and made a pretty sim­ple redesign of my staff page, which had pre­vi­ously been kind of a park­ing lot after I moved my blog over here.

Tools Used

Twit­ter Bootstrap

I didn’t want to start from scratch with CSS and design ele­ments, and selected Twit­ter Boot­strap as my scaf­fold­ing. There isn’t really a good rea­son as to why I picked this par­tic­u­lar frame­work other than it was the first that popped into my mind when think­ing about find­ing such a thing, and it seemed to have enough doc­u­men­ta­tion for my purposes.

The doc­u­men­ta­tion is good enough, and I didn’t really have a prob­lem with it besides the fact that I find that lay­outs look much bet­ter (and align) if you use row-fluid for all divs: mix­ing it with­out fluid makes it look weird. This may be because I also turned on respon­sive fea­tures so those two are interacting.

Any­way, I used row-fluid for every­thing and also turned on the respon­sive fea­tures. It’s a good frame­work to quickly get some­thing online that looks fairly decent with­out hav­ing to cre­ate things from scratch.

Another pop­u­lar choice, albeit one which I have not tried, is Skele­ton

Sub­lime Text 2

I’ve been slowly shift­ing away from Vim to Sub­lime Text 2 for all sorts of devel­op­ment tasks includ­ing projects for Ruby, PHP, C, and HTML. Sub­lime works in GNU/Linux, is easy to get set up, and has all sorts of nifty fea­tures. It’s not free, but well worth the cost.

As an added bonus, I installed it on my drop­box and have sym­blic links to that binary in my main /usr/bin direc­tory, so all of my set­tings are synced up no mat­ter what sys­tem I’m run­ning on. You can see some hints of how I did that by tak­ing a gan­der at this script.

Zen Cod­ing

One of the big annoy­ances with HTML is that it’s tag-based, and that means a lot of struc­ture and rep­e­ti­tion. With the Zen Cod­ing plu­gin, you can eas­ily tab-complete things such as. For instance, you can type in this:

div.row-fluid>div.span4*3>h2+p*2

Then hit <tab> and you’ll get:

<div class="row-fluid">
 <div class="span4">
  <h2></h2>
  <p></p>
  <p></p>
  </div>
 <div class="span4">
  <h2></h2>
  <p></p>
  <p></p>
 </div>
 <div class="span4">
  <h2></h2>
  <p></p>
  <p></p>
  </div>
 </div>

Nifty, eh?

The Results

For about an hour’s work, includ­ing writ­ing this post, you can see some­thing that looks pretty decent at my staff website:

http://staff.washington.edu/nikky

The code, along with the sim­ple deploy­ment rsync script, can be found here:

https://github.com/allynfolksjr/staff-website

 


Scheduled ovid01 Reboot — 2012/09/11

[This mes­sage is being sent to mem­bers of the mysql-users-ovid mail­ing
list, as you wished to be noti­fied of MySQL server updates and
reboots. ]

Out­age Infor­ma­tion
—-

There will be a brief out­age to restart ovid01.u.washington.edu on
09/11/2012, as out­lined below:

Sys­tem: ovid01.u.washington.edu

Planned date of out­age: Tues­day, Sep­tem­ber 11th, 2012

Time: 07:00am

Esti­mated out­age time: 5 minutes

Rea­son: Free up sys­tem resources in prepa­ra­tion for begin­ning of Fall quarter.

Details
—-

One of the web devel­op­ment servers and MySQL hosts,
ovid01.u.washington.edu, will be rebooted. This will impact any staff,
fac­ulty, depart­men­tal or course web site that relies on
ovid01.u.washington.edu to pro­vide MySQL ser­vices. Sites based on
Word­Press, Medi­aWiki, Dru­pal, and sim­i­lar sys­tems will be unable to
con­nect to their data­base for the dura­tion of the reboot. All sites
that rely on your data­base will also be down.

Action may be required to bring your Web Site back into an oper­a­tional state
—-

If your MySQL server has a cron job set up to auto­mat­i­cally restart
your server, then no action is nec­es­sary; your MySQL server will come
back online shortly after ovid01 itself is rebooted. More infor­ma­tion
about set­ting up a cron job to han­dle this task can be found here:

http://www.uw.edu/itconnect/web/publishing/mysql-admin.html#cron

If you do not have a cron job set up, or need to start your MySQL
server man­u­ally, then you will want to refer to these instruc­tions on
how to bring your MySQL server back online:

http://www.uw.edu/itconnect/web/publishing/mysql-admin.html#restart

In either sit­u­a­tion, it is highly rec­om­mended to make sure your site
is oper­at­ing prop­erly on the morn­ing of the restart.

Ques­tions?
—-

Please con­tact:

UW Infor­ma­tion Tech­nol­ogy Cus­tomer Ser­vices
help at uw.edu
1–206-221‑5000


Next Page »