bookmark_borderHorde 5 Preview: Sesha Inventory App 1.0 and updated Rdo library

Dear folks, I am very pleased to announce:
The Sesha Inventory application is ready for Horde 5 and it is in good shape. Sesha is a simple inventory keeping application which originally developed by Bo Daley and Andrew Coleman on Horde 3. The product was never officially released but it went into production at several sites. Sesha release cycle can now start together with the Horde 5 Alpha release cycle.

Sesha inventory can be configured to hold any number of stock categories with any number and type of attributes.
Like the original version, Sesha for Horde 5 can provide its stock categories as ticket queues for the horde ticketing application whups.
There are a lot of plans and ideas for upcoming versions but for this time the focus was on finishing a releasable product.There are no surprises for existing users of Horde 3 based sesha. Most work happened invisibly under the hood:

  • The Horde_Template library was exchanged by new Horde_View code
  • A migration script for database was added
  • Users can keep their original Horde 3 Sesha tables and data.
  • The sql backend driver was completely reworked into a driver based on the Horde_Rdo ORM library The new Driver Api provides enhanced search capabilities but the current frontend doesn’t make use of it. I do not plan to add any features to the classic view but start working on an Ajax view once the Horde 5 Redesign is completed. This may ship with Sesha 1.1 later on.
  • Object oriented code has replaced complicated hashes in many places

The Horde Rdo library is the new work horse inside Sesha. Rdo means Rampage Data Objects and is a lightweight ORM layer by Horde founder Chuck Hagenbuch. It maps database tables to PHP Objects. This is similar to the ActiveRecord pattern. Each database row can be turned into one Rdo item. For Sesha and another – non-public – software project, some enhancements went into the Rdo library for Horde 5:

  • Rdo now provides a caching factory or root object which speeds up creation of mapper objects
  • Methods for add, removing or checking many-to-many relations have been added
  • A number of edge case bugs have been fixed

I think the Horde 5 release cycle will start with alpha1 releases sometime in May. I know we’re a little late but it’s worth the wait.
That said, I welcome any early testing or updates of the language files. Provided everything works as expected, Sesha will be shipped with Horde 5 for OpenSUSE 12.2

bookmark_borderThe Author

The author is a developer and trainer in perl and PHP with several years of professional experience in both areas. While leaning strongly towards solutions involving the horde framework he also solved problems with perl catalyst, moose, CakePHP, wordpress, facebook api, PHP Symfony and Zend Framework.

Get my GPG key for secure communication.

-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v2.0.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uRPLauwxI/4Fuq
z0+FR9biKYAcnoLDtOaHNQN4kH70etKL0qe+xRrgHDqaNmIoO2fSu/iKiWOfy+AE
KmXKUnyjqcPsgQKibdVuelyxz+UyydsBgX+mfXdIWs9hYEaPANQd6pwweao95uoI
YM1eud+A/CObUaQ64d4KbE87dm6inmqZ2qzPAQFBVNBO1X1mgeltG5rMEALj4kHM
JeOcc1icDxjcMCmgXmdipJGd5MU4mr+xmNBZBSw1yFIuNgAX8w/Nf5ykcWWz/59/
koTXqKzE2dob6aJU9nZH+eP2XaOw+YJdvSe83q6jlsl07ecrIkxMbzqYedeOz2/L
FDgpeqfk8uGhrfpdwPGRLM2wzrVAkSSnqa12Ga1iC2Mv71pT9I86mulnb/0PAR9L
b1kZw0dSHmnrZ05hxmpRXmGfAuvbQsH/pXfrmJqzxDzEWDzMd0i0/Luv//IddkBQ
ozvxJB/ZsHE2FTpRHbN+2OXeWa0/Kq7jEJ4KFpFp/+/slbs1QSyCPiydNHkRy2fk
xBaOfvzqSvNAqyym8XUopgD+ArjVSD3L/TdmyvVIrWlc6kiRWJjr4UlGCHtzPn+C
aE6LSaSUy6rCNp6ISQQYEQIACQUCRwyLmAIbDAAKCRBBEDAy+NzZRWLQAJ470qQy
qm/FwkcLJGKef30Q5bvpkwCfa67x45Uz9JhVm5eDjhFaiQUQkM8=
=5AYj
—–END PGP PUBLIC KEY BLOCK—–

bookmark_borderDistributed applications with Horde 4

Synopsis

Horde’s powerful RPC API has been used numerous times to allow integration of horde-based data into external applications or remote sites. It also provides an easy to set up basis for distributed applications with headless workers. In this article I will give you a brief introduction on how to build a scalable distributed architecture based on Horde 4.

Distributed Architecture

Assumptions:

  •  You want your application to be scalable over several hosts. We call the controlling instance the master and the reacting instances the workers.
  •  You don’t want to keep a lot of state on the worker. Adding or removing a worker instance should not require complicated setup. Most cloud layers like OpenStack assume worker instances to be virtually stateless. The master is the single source of truth and should be able to rebuild any broken or lost worker setup from stored information.
  • You are working in a hostile environment, e.g. the internet. Firewall only allows select ports and data has to travel over lines you cannot trust. You want to resort to https transport with real certificates.

The master:

I won’t go into too many  details on the master setup this time. Create a basic app from the skeleton as the horde wiki describes. Separate a communication driver for worker Api calls from the driving logic in your app and don’t couple them too tightly. Usually you want small commits of changes to both the master’s idea and the worker’s reality and you want to check back if everything worked out. This doesn’t scale well on large-scale changes though.

Sometimes you want to make complex changes to the “truth” or “theory” in the master’s db before you commit them to the worker world out there.

Accessing the worker from the master:

The core piece of your communication with the worker are just a few lines of code

   protected function callWorker(WorkerInstance $worker, $callMethod, array $parameters = array()) {
       try {
            $http = new Horde_Http_Client(array('request.username' => $worker->rpcuser, 'request.password' => $worker->rpcuserpass, 'request.timeout' => 20 ));
            $response = Horde_Rpc::request(
                    'xmlrpc',
                    'https://' . $worker->worker_hostname . '/' . $worker->worker_subdir .'/rpc.php',
                    $callMethod,
                    $http,
                    array($parameters)
            );
        }
        catch (Exception $e) {
            throw new Appname_Exception($e);
        }
        return $response;
    }

This is a dumbed down version for demonstration purposes. You might want to model WorkerInstance based on Horde_Rdo, the horde ORM layer. It is desirable to evaluate lazy relations and lazy attributes. This has important performance implications but more on this in another post. We’re also selling consulting 😉

Worker setup:

We want a stateless worker instance. Obviously, this is theory. Truth is: You need a unique IP and you probably want a unique hostname. Nowadays cloud layers can provide that level of configuration. How about a horde instance without db?

horde/config/registry.local.php

You want the worker to talk under a specific api name. Add a block to your registry.local.php

 'myvpnworkerworker' => array (
        'name' => _("someworkerfooname"), /* we can even drop the _() as nobody will localize this */
        'provides' => 'myvpnworkerapp',
    )

horde/config/conf.php

This is stripped down to just the important lines
$conf['auth']['params']['htpasswd_file'] = '/not/in/webroot/passwords.secret';
 $conf['auth']['params']['encryption'] = 'plain'; /* In real world, you want to use some encryption instead */
 $conf['auth']['driver'] = 'http'; /* We want authentication by http layer after all */

We want the server to be stateless and not to rely on external data. We don’t want a local mysqld running and we don’t want a remote ldap either. We will store the credentials in a .htpasswd style file. For demonstration purposes, we use plain authentication.

The file would look like this:

passwd.passwd would look like this: 

rpcuser:totallysecretrpcuserpass
adminuser:adminpass
localdebuguser:secretlocaldebugpass

We also want to get rid of any components which cannot work without an sql backend

$conf['log']['priority'] = 'DEBUG';
$conf['log']['ident'] = 'HORDE';
$conf['log']['name'] = LOG_USER;
$conf['log']['type'] = 'syslog';
$conf['log']['enabled'] = true;
$conf['log_accesskeys'] = false;

As the worker will probably only show the admin UI to localhost or VPN, you want to log any debug relevant data locally into a file
$conf['prefs']['driver'] = 'Session';
$conf['alarms']['driver'] = false;

We don’t want user prefs or alarms on the worker. You might consider setting up some basic email delivery and sending alarms by mail. I won’t cover this here.

$conf['datatree']['driver'] = 'null';
$conf['group']['driver'] = 'Mock';

Datatree support is sql-only. Datatree is mostly legacy support and it isn't particularly fast either. There is no guarantee future horde revisions will support datatree. You don't want it. Period. You don't want groups either. The primary user of your instance is the RPC user.
$conf['perms']['driver'] = 'Null'

Only the master speaks to your worker and this must be ensured on the ssl/https layer. No need for a perms backend

$conf['cache']['driver'] = 'File';

If we use caching at all, we want to use a primitive one.

$conf['lock']['driver'] = 'Null';
$conf['token']['driver'] = 'Null';

Horde_Locks is a cool library. Ben Klang wrote it in 2008 when I was working in a non-public project that needed it and I mailed some stuff to him. But it’s sql-only. We don’t want it here.
Horde_Tokens are essential for a lot of verification tasks but the worker is not the single source of truth.

$conf['vfs']['type'] = 'File';

You probably don’t want a vfs at all. Vfs means state.

$conf['sessionhandler']['type'] = 'Builtin';

Anything but sql. You probably don’t want sessions.

This should be the key parts to make your stock horde installation not want a database at all.

The RPC Worker app.

The key to your RPC worker app is Api.php

This is the entry point for any Horde RPC calls.

Basically it works this way:

  • The upper layer of array() is internal to the horde rpc request layer
  • In our client example we wrapped our params into an additional array() to facilitate optional parameters. This means any method in Api.php accepts an array as the single parameter. You could also use a fixed list of parameters with optionals in the rear positions.
  • While the horde registry calls applications apis as ‘domain/function’, the rpc api calls them as domain.function. Examples are horde.listApis and myvpnapp.fetchData

Any function  you can call from the outside is a method in Fooworkername_Api in Fooworkername/lib/Api.php.

Concurrency and queueing:

Horde is written in PHP. PHP is generally lacking in thread safety and doesn’t support real forking from within an apache module. You can however fork and detach processes using shell_exec. Horde ships some classes which help you use PHP in a shell environment but sometimes you want to resort to shell scripts or perl or anything else because it already exists or is more suitable to the job. shell_exec allows you use all of these. Usually you want your api calls to return fast. This doesn’t scale well. Make sure your individual call usually finishes in predictable worst case scenarios in 1/3 of the client’s response timeout. In our example we chose 20 seconds for timeout. Mind network latency and external script worst case runtime.

The solution here is decoupling:

  • Don’t make any UI element depend on live data from the worker
  • make a service/daemon or cron job collect worker state at short intervals and serialize these data points in time stamped files or directories
  • Create an api entry point to collect most recent state/results
  • Collect results of all workers from a commandline script, daemon, cron job or service in reasonable sequences.
  • Don’t expect most tasks immediately but add them to a queue. Horde_Queue may help you with that task.

Choose wisely where to call existing external apps and where to resort to PHP and the Horde Framework to solve common data collection, processing, formatting and returning tasks.

Remember to have fun.

The author is severly biased towards all things horde and has used horde classes and applications to solve various work-for-hire problems. The Horde Framework is one of the oldest and mature php projects and drives mission critical collaboration and data retrieval software all over the globe.

bookmark_borderUsing socat or netcat to debug unix sockets like telnet for tcp

Sometimes you want to debug a service with a clear text protocol, but it uses unix sockets instead of INET sockets.

Surprisingly, there is little info on this around the net.

An easy solution would be socat:

socat UNIX-CONNECT:/var/run/blabla/nameofthe.sock STDIN

EDIT: Linux consultant Stefan Seyfried pointed out, that from openSUSE 12.1 onwards you can also use netcat. The new opensuse version ships netcat-openbsd.

The syntax is:

nc -U /var/run/blabla/namedersocket.sock

bookmark_borderOpenSUSE 12.1 drops Sun/Oracle Java

Today, openSUSE Program Manager Andreas Jaeger announced that openSUSE will stop shipping Sun Java in the upcoming 12.1 release.
Distribution users will now only be offered the GPLed openJDK. In a recent announcement, Oracle declared openJDK to be the new official reference implementation for Java SE7. Along with that move, Oracle dropped the “Distributor’s License for Java (DLJ)” which was required for redistributing Sun Java. Users depending on Sun/Oracle Java are now required to download it directly from the oracle website. Since the acquisition of sun by oracle, the companny has been known for questionable moves which alienate parts of the opensource community. Among these was the OpenOffice dispute which led to the departure of many developers to form LibreOffice. The former sun-owned mysql database has also seen a fork called MariaDB. According to Jaeger, openSUSE will continue to provide the existing packages in the Java:sun:Factory project but will not update them anymore and won’t ship them with the new distribution. Users are urged to switch to either openJDK or the versions available directly from Oracle.

bookmark_borderJan Schneider: Automatic twitter messages with Horde_Service_Twitter and two lines of code

Jan Schneider just posted a damn cool use case for the Horde_Service_Twitter library. Using this library, just a few lines of php code are enough to send messages to your twitter stream like this:

#!/usr/bin/env php
<!--?php
/* Keys - these are obtained when registering for the service */
$keys = array(
'consumer_key'        => '',
'consumer_secret'     => '',
'access_token'        => '',
'access_token_secret' => ''
);

/* Enable autoloading. */
require 'Horde/Autoloader/Default.php';

/* Create the Twitter client */
$twitter = Horde_Service_Twitter::create(array('oauth' => $keys));

/* Send tweet */
try {
$twitter->statuses->update($argv[1]);
} catch (Horde_Service_Twitter_Exception $e) {
$error = Horde_Serialize::unserialize($e->getMessage(), Horde_Serialize::JSON);
echo "$error->error\n";
exit(1);
}

Now that’s neat, isn’t it.
In another team I worked with, we used a perl library which sent jabber/xmpp streams to our chat accounts when something ran into an uncought exception.

This might be worth porting to PHP/Horde some day.

bookmark_borderHorde 4.0.6 brings user-specific admin privileges

Traditionally, Horde only knows two kinds of users: Users with administration flag and users without. The list of admins is a static entry in the horde config file. It’s all or nothing – either a user gets access to all admin functions or to none. At least until recently.

Last October I wrote about a patch for Horde 3 which allows permission-based access to individual admin privileges. This patch has now been ported to Horde 4 and is incorporated in Horde 4.0.6. You can now assign a user the task of managing groups without allowing him to use the permissions admin and grant himself additional privileges. Or you can delegate emergency password resets to a group of trusted people without confusing them with icons like the PHP Shell. Only those admin functions are shown which the user has access to. Another side effect: Even if a user has all admin permissions, he is still not recognised as an admin and won’t be shown things that admins always have to see regardless of their permissions and settings.

In theory, you can now give yourself all admin permissions and safely delete yourself out of the admin list – as long as you have the “configuration” permission, you can always go back and restore without manually editing the conf.php file.

The Administration permissions are handled in the permissions screen just like any other user permissions. They live under the “horde” component. Currently only the “show” flag is actually recognized but this will be expanded later.

bookmark_borderMigrating Horde 3 to Horde 4 – Top 6 ways to mess up

There have been some migrations of Horde 3 to Horde 4 recently – not all went smooth from the start.

Some top issues of messing things up and how to avoid it:

  1. initial application dimpIn Horde 3 dimp was a separate application which provided an ajax interface to imp. It has since been merged into the imp application. If your Horde installation had dimp before migration to Horde 4, this might create runtime issues for your users when
    • when you locked the initial application to dimp
    • when your users decided that their initial application should be dimp

    To get around this you should

    • make sure you didn’t blindly copy your locked settings from horde 3 to horde 4
    • run a mysql update statement on the horde_prefs table to update column pref_value to “imp” if it was “dimp” before (Consider hiring a professional admin for the migration if you don’t know how that looks like)
  2. Making changes in backends.php or prefs.php
    In Horde 3 admins used to edit prefs.php or backends.php/servers.php to change values. Horde 4 ships backends.php and prefs.php as default values. Admins are supposed to copy these to backends.local.php and prefs.local.php and make their changes there. Changes to the original files will be overridden with the next rpm or pear update of the horde apps.
  3. Not unchecking utc time in kronolith
    The Horde 3 Calendaring app defaulted to store calendar events in local user time. The Horde 4 default is UTC timestamps. If you migrate from horde 3 you either have to uncheck that setting or run a migration script on the data.
    Warning: You might end up with an unrecoverable state if you add new data in UTC mode to a calendar backend which has not been converted to UTC timestamps
  4. Not converting turba and kronolith databases to utf8
    In Horde 3 installations, the calendar app kronolith and the addressbook turba often had their database tables encoded in latin1. The system wide default in Horde 4 is utf8. Not adapting this setting to the tables or the tables to this setting results in corrupted display of international characters and symbols.
    Warning: You might end up with an unrecoverable state if you add new data to addressbooks or calendars where backend encoding does not match the set horde encoding
  5. Relying on menu.php’s javascript onclick handler or target attribute
    In the ajax views of kronolith and imp there is currently no support for the target and onclick handler attributes. I do not know of any plans to re-add this support. If you want to link external sites into the iframe, consider creating a custom portal block. There was a recent blog post on creating this kind of blocks on The Upstairs Room
  6. Using the ldap prefs backend
    The ldap backend for preferences is currently not yet ported to horde 4. If you want to migrate, you first have to extract your prefs from ldap and then convert them to sql. If you need ldap prefs, consider hiring a consultant or sponsoring the development of this feature.
Tres consejos principales para ejercicios de entrenamiento de culturismo nvrzone ranbaxy drogas en venta mejor mezcla de musica ncs gym workout.

bookmark_borderOpenSUSE Build Service rebranded

Today the openSUSE project announced that their packaging solution OpenSUSE Build Service will be re-branded to highlight the crossplatform nature of the product. The new name of the platform will be Open Build Service (OBS). Commercial support will also be available soon.

Ralph Dehner, CEO at B1 Systems GmbH noted:

“In the past B1 Systems has written build environments for the customers by itself. With the open Build Service now exists a “standard” which makes it easy to build packages for different distributions and architectures.

This will be also interesting for many other open source projects.”

Inicio – dieta y entrenamiento de culturismo femenino, culturismo femenino vs fisico – my blog comprar pildoras para la ereccion blog de musculacion blog de musculacion – blog de musculacion, rutinas de entrenamiento, noticias e imagenes de musculacion.