Software development on OmniOS

One of the OpenSource projects I work on, Apache Traffic Server, supports Solaris. I build on OmniOS for this development, and as much as I like it, it's semi-difficult to setup a development area properly. I'm likely missing something (like, a developer bundle or meta package), but these are the packages I find necessary to always install:

$ sudo pkg install gcc51 header object-file

Note that GCC installs in /opt/gcc-<version>, and without object-file autoconf / configure does not behave well. In addition, I use the OmniOS additional package repository as well, for goodies such as Emacs:

$ sudo pkg set-publisher -P -g http://pkg.omniti.com/omniti-ms/ ms.omniti.com

Software installed with this goes into /opt/omni.

Update: For some details on getting network setup on your OmniOS box, see http://blog.nemtallahdaher.com/wordpress/?p=127 . In addition to this, I also had to update the nsswitch.conf file of course (just copy over the DNS version of it).

Hacking: 

QNAP and Torrent

I noticed a noticeable amount of Torrent traffic both from, and to, my QNAP NAS server. It turns out, if you enable the Download Station application, it starts doing all sorts of Torrent discoveries on its own. I have no idea why, so for now, I have simply removed the application entirely. I noticed this by doing a

$ tcpdump port 6889

 

Hacking: 

autorun.sh for my QNAP server

I needed to do basically rc.local on my QNAP NAS server, since it setups various things at bootup time. Changes to these setups would therefore not persist a reboot. Via QNAP support, I got a link to a page showing how to setup an autorun.sh script as part of the bootup process. This was all splendid, except I couldn't find my device in the list. So, I found this command to probe the system which boot drive I'm on, and from thereon it was easy to find which partition to mount. What I ran was basically this:

[admin@Freya /]# /sbin/hal_app --get_boot_pd port_id=0
/dev/sdg
[admin@Freya /]# mount -t ext2 /dev/sdg6 /tmp/config
[admin@Freya /]# cat /tmp/config/autorun.sh
#!/bin/sh
/share/CACHEDEV1_DATA/homes/admin/bin/autorun.sh &

I made it such that it simply just run an autorun.sh from my normal drive, this way, I don't have to go through these hoops, and modify the flash image constantly when I want to modify change something. Right now my script is pretty limited, but for example, it now allows me to add a "search" domain to my /etc/resolv.conf. Yeah, for some reason, the QNAP OS does not let you add search domain for the resolvers, if you use static IPs (with DHCP, it gets it from the DHCP server, of course).

Hacking: 

systemd and disk storage

Well, my battles with systemd continues... I had a box with limited disk space, and it was using over 4GB for just systemd journals. You can see the current journal usage with

$ sudo journalctl --disk-usage
​Journals take up 3.9G on disk.

I've tweaked this now, with a setting in /etc/systemd/journald.conf:

SystemMaxUse=1G

In addition, I ran a couple of commands from the command line:

$ sudo journalctl --verify
$ sudo journalctl --vacuum-size=1G

Jenkins slaves, Java Web Start and proxies

So we (Apache Traffic Server) have our Jenkins CI system behind a proxy, naturally. This works very well. We have a few remote slaves, that uses the "local" Java start processes, and when they fetch the .jnpl file, the destination host and port for it to talk to Jenkins itself is wrong. It (of course) tries to talk to the proxy host, which doesn't work! This was fairly easy to fix, in the Node configuration for the slaves, click the advanced option, and add a host:port value for "Tunnel connection through".

Hacking: 

Optimizing Drupal7 CSS and JS

Even though Drupal (since long ago) supports merging CSS and JS into one file each, after I upgraded from v6 to v7, I still ended up getting more than one of each. It turns out, Drupal has some notion of groups, and it would only merge the CSS / JS elements within each group. I did some web searches, and came up with the following:

function pixture_reloaded_js_alter(&$js) {
  if (arg(0) === 'admin' || strpos($_GET['q'], 'search/google') === 0) {
    return;
  }

  uasort($js, 'drupal_sort_css_js');
  $weight = 0;

  foreach ($js as $name => $javascript) {
    $js[$name]['group'] = -100;
    $js[$name]['weight'] = ++$weight;
    $js[$name]['every_page'] = 1;
    $js[$name]['scope'] = 'footer';
  }
}


function pixture_reloaded_css_alter(&$css) {
  uasort($css, 'drupal_sort_css_js');

  $print = array();
  $weight = 0;
  foreach ($css as $name => $style) {
    $css[$name]['group'] = 0;
    $css[$name]['weight'] = ++$weight;
    $css[$name]['every_page'] = TRUE;

    if ($css[$name]['media'] == 'print') {
      $print[$name] = $css[$name];
      unset($css[$name]);
    }
  }

  $css = array_merge($css, $print);
}

This goes into the Theme's template.php file, in my case I use the Pixture Reloaded theme. I don't know much about Drupal nor PHP, so I don't know what this might break. But this accomplishes three things:

  1. Merge all CSS into one single CSS.
  2. Merge all JS into one single JS.
  3. Move the JS to the "footer" of the page (this is important for improved page rendering, but could potentially break some sites I'd imagine).

Hacking: 

Pages

Subscribe to Ogre.com RSS