Feb 27, 2010

SSH: a Swiss knife for system integrators

by Juan Pablo Aroztegi

Give me a place to stand on, and I will move the Earth.

This is a legend ascribed to the famous Archimedes, genius of antiquity. When he understood the basic principles behind the lever he felt its power and he started seeing them in a different way. His paradigm changed.

In a similar way SSH is a tool that can completely change the way you work, for good. Let me show you why you, as a system integrator, should be interested in its wonders. And I can assure you that if you get familiar with the basic principles behind it you’ll be able to perform tasks you would never possibly imagine.

Case 1: Browsing through a remote computer

There are multiple situations where browsing through a remote computer is interesting:

  • IP address restrictions: a customer has restricted access so that I can only access a remote machine from my network at work. I am at home and I really need to access this server.
  • Content filtering: I am located in a network or a country that restricts my Internet connection. And I really need to access some pages which are key to do my job.
  • Remote LAN access: I have access to a remote computer. But I would like to access the ERP or database of another computer in the same local network.

So this is the magic that makes this possible:

ssh -D 8888 johndoe@remote_computer

This basically converts the remote computer into a proxy server only for you. So that you just need to provide this information to your web browser. Using Firefox as an example, you’d need to go to Preferences → Advanced → Network → Settings, then select Manual proxy configuration and finally enter localhost in the SOCKS Host field and 8888 as the port number. The simplest way to verify it’s working is to visit whatismyip.org so that you can verify your IP address, it should be the remote one.

Firefox Preferences, Advanced sectionFirefox proxy settings

Case 2: Securely connect to a remote database

This is a typical case scenario. The remote machine has only SSH opened and there is no direct access to the database. Let’s suppose it’s PostgreSQL running on port 5432 on the remote computer, but the port is not opened to the outside world, only to local connections. So as have SSH access you can ask it to redirect the remote 5432 port into any port of your local machine, like 5433:

ssh -L 5433:localhost:5432 johndoe@remote_computer

Now you can start psql, pgAdmin or your favorite client and use localhost as the host and 5433 as the port in the connection details.

PgAdmin3 through a SSH tunnel

As for Oracle the concept is the same and just the port numbers change:

ssh -L 1522:localhost:1521 johndoe@remote_computer

Case 3: Expose my local ERP into a remote network

Let’s suppose that I have Openbravo ERP beautifully running in my local machine, it includes some nice new changes we’ve been working on. I would like to show it to Mike and Sandra, but they are located in a remote network. I am in a hotel, there is no way I can ask the IT staff of the hotel to open a port for my users to access the ERP in my computer.  SSH comes to the rescue again: basically you can perform the opposite operation of Case 2, and forward your local Web Server port into any port of a remote machine:

ssh -R :9999:localhost:80 johndoe@remote_computer

So now I can ask Mike and Sandra to enter http://local_ip_of_remote_computer:9999 and bingo, they can access my ERP installation.

Important note: for this feature to work the server’s SSH configuration (sshd_config) must have the GatewayPorts option set to yes.

Case 4: Securely connect to a remote database available only in the LAN

Now let’s suppose I have SSH access to remote_computer, but not to remote_computer-2, which is is in the same LAN as the first one. And I want to access the database in remote_computer-2 using my graphical SQL client. There are multiple ways of solving this situation, by using variants of Case 1 or Case 2.  We’ll do it extending the first case. Firstly,  open the SSH connection and establish the local proxy server:

ssh -D 8888 johndoe@remote_computer

Now we want to tell our PostgreSQL client to use this proxy. But usually they don’t support this feature. So here proxychains comes to the rescue. This is a tool that allows you to make any program use the Internet connection through that proxy. Once it is installed, it requires a minimal configuration in $HOME/.proxychains/proxychains.conf, only required the first time you use it:

DynamicChain
tcp_read_time_out 15000
tcp_connect_time_out 10000

[ProxyList]
socks5 127.0.0.1 8888

From now on you can prepend the proxychains command to your program and it will go to the Internet using the proxy server connection. So for example in our case we would go a terminal and run:

proxychains pgadmin3

or

proxychains psql -d openbravo -U tad -h localhost -p 5433

Conclusions

As you can see SSH opens a new world of possibilities for you. Invest some time playing with it, you won’t regret.

Some final words for Windows users: don’t worry, this is not valid for UNIX based systems only. If you run Windows in your computer you can use PuTTY to achieve exactly the same results.

UPDATE (2010/04/26): adding the GatewayPorts requirement and the corrected ssh command based on Asier’s comments.


Tagged: Security, SSH



Feb 23, 2010

Openbravo ERP Roadmap

by Richard Morley
The updated Openbravo ERP roadmap has been published. You can find it at http://wiki.openbravo.com/wiki/ERP/Roadmap

This road map focuses on the planned content for Openbravo ERP 3.0, planned for production release in early 2011. This road map assumes the current production release of Openbravo ERP 2.50 (released April 2009) as its base line.

The Openbravo ERP 3.0 roadmap focuses on features that will both maintain the product and impress users:

1. Maintain: Openbravo ERP 3.0 must maintain its technological and functional position as a leader in the open source ERP environment. Openbravo ERP 3.0 will adopt technologies that support this, while the functional core of Openbravo ERP 3.0 will be maintained, prioritizing issues that support the next objective.
2. Impress: Openbravo ERP 3.0 must impress the Openbravo community through its ease of use and clear functional flows. This includes updating the user interface, extending and enhancing specific core workflows, and reducing the functional footprint to exclude workflows that are not considered core.

The objective of the roadmap document is to align each part of the Openbravo organization and community towards achieving these objectives.

Please note that this is a tentative development roadmap for Openbravo ERP and it does not constitute a commitment to deliver. The proposed dates may change due to the workload of the development team and the content of each release could vary depending on market changes. If this occurs the roadmap will be updated to reflect these changes.



Feb 22, 2010

Making an snapshot of your Openbravo instance

by Iván Perdomo

I have created a small ant script that automates the process of making a ‘snapshot’ of your instance. By snapshot I mean a database dump and the whole Openbravo folder. This archive file (zip format) does not exclude any file, so .class files, Mercurial metadata, etc is also included in the file, so is a ‘real snapshot’

When is this script useful?

This tool is useful when:

  • You are a newbie developing with Openbravo framework, you have an instance up and running, and you want to start testing something. Making an snapshot of your current state, gives you a easy way to step back if something goes wrong.
  • You just want to archive the current state of your instance.
  • You want to make a copy of your current instance. You can make a snapshot and restore in another folder. A couple of tweaks in the Openbravo.properties and voila! you have a copy of your instance.
  • You want to move your running instance to a another environment (e.g for testing).
  • Etc.

How to use it?

Note: The following commands are for GNU/Linux users. If you use other operating system, the script still works but the unzip process is different, e.g. I have tested on Windows using the built in extracting tool for zip files.

You can grab a copy of the snapshot.xml and place it inside your Openbravo sources folder, eg.

~/src/openbravo/pi $ wget http://bitbucket.org/iperdomo/labs/raw/8db9dcb650d3/openbravo/snapshot.xml

Making a snapshot

Once you have the snapshot.xml in the sources folder just run it (the default target is snapshot).

~/src/openbravo/pi $ ant -f snapshot.xml

Depending on your machine’s resources the script takes about 7 minutes. Is slower on Windows machines (and more slow if you have an antivirus checking every file that you touch). Here you have an example of the output.

snapshot:
     [echo] Creating instance snapshot...
     [echo] Making temp folder...
     [echo] basedir /home/iperdomo/src/openbravo/pi
     [echo] Creating a database backup...
     [exec] pg_dump: reading schemas
     [exec] pg_dump: reading user-defined functions
     [exec] pg_dump: reading user-defined types
     [exec] pg_dump: reading procedural languages
     [exec] pg_dump: reading user-defined aggregate functions
     [exec] pg_dump: reading user-defined operators
     [exec] pg_dump: reading type casts
     [exec] pg_dump: finding inheritance relationships
     [exec] pg_dump: reading column info for interesting tables

... some more pg_dump logging ...

     [exec] pg_dump: dumping contents of table s_resourceunavailable
     [exec] pg_dump: dumping contents of table s_timeexpense
     [exec] pg_dump: dumping contents of table s_timeexpenseline
     [exec] pg_dump: dumping contents of table s_timetype
     [echo] Making a zip...
      [zip] Building zip: /home/iperdomo/src/openbravo/openbravo-2010-02-19_13-18-45.zip

BUILD SUCCESSFUL
Total time: 7 minutes 33 seconds

The script will call pg_dump with all the necessary parameters read from Openbravo.properties, and creates a .backup in the temp folder inside the sources. Then it archives the whole content in a zip file in the parent folder. The name of the zip is the name of the context plus a timestamp.

Restoring a snapshot

To restore an snapshot is as simple as removing the current folder and extracting the contents of the zip file. Then run the restore target from the script.

~/src/openbravo $ rm -rf pi

~/src/openbravo $ unzip /home/iperdomo/src/openbravo/openbravo-2010-02-19_13-18-45.zip -d pi

Example output of unzip

Archive:  /home/iperdomo/src/openbravo/openbravo-2010-02-19_13-18-45.zip
   creating: pi/.hg/
   creating: pi/.hg/store/
   creating: pi/.hg/store/data/
   creating: pi/.hg/store/data/.settings/
   creating: pi/.hg/store/data/_web_content/
   creating: pi/.hg/store/data/_web_content/_m_e_t_a-_i_n_f/
   creating: pi/.hg/store/data/_web_content/_w_e_b-_i_n_f/
   creating: pi/.hg/store/data/config/
   creating: pi/.hg/store/data/config/eclipse/
   creating: pi/.hg/store/data/database/model/sequences/

... some more log ...

  inflating: pi/web/skins/Default/Popup/_ParticularItems/Workflow/iconTask.png
  inflating: pi/web/skins/Default/Popup/_ParticularItems/Workflow/iconWorkflow.png
  inflating: pi/web/skins/Default/RTLFlippedImages.txt

After extracting the contents of the zip file, change the directory to the Openbravo sources and execute the restore target, e.g.

~/src/openbravo $ cd pi

~/src/openbravo/pi $ ant -f snapshot.xml restore

This will drop the database and use pg_restore to restore the .backup file stored in the temp folder. Here you have some example of the log output.

Buildfile: snapshot.xml

check.backup:
     [echo] Checking if openbravo.backup file exists in /home/iperdomo/src/openbravo/pi/temp folder...

restore:
     [echo] Deleting the database ...
      [sql] Executing commands
      [sql] 1 of 1 SQL statements executed successfully
     [echo] Creating the database...
      [sql] Executing commands
      [sql] 1 of 1 SQL statements executed successfully
     [echo] Restoring the backup file...
     [exec] pg_restore: connecting to database for restore
     [exec] pg_restore: creating SCHEMA public
     [exec] pg_restore: creating COMMENT SCHEMA public
     [exec] pg_restore: creating PROCEDURAL LANGUAGE plpgsql
     [exec] pg_restore: creating FUNCTION a_amortization_process(character varying)

... some other pg_restore log ...

     [exec] pg_restore: setting owner and privileges for FK CONSTRAINT s_timeexpenseline_s_timeexpens
     [exec] pg_restore: setting owner and privileges for FK CONSTRAINT s_timeexpenseline_s_timetype
     [exec] pg_restore: setting owner and privileges for FK CONSTRAINT s_timetype_ad_client
     [exec] pg_restore: setting owner and privileges for FK CONSTRAINT s_timetype_ad_org

BUILD SUCCESSFUL
Total time: 36 seconds

That’s it, you have restored your snapshot.

How to use the script to copy an instance?

You follow the same procedure, to create the snapshot. Then you unzip the archive and another folder.

~/src/openbravo $ unzip openbravo-2010-02-19_13-18-45.zip -d pi2

After the extraction of the archive contents, you modify the Openbravo.properties and change the following properties:

# New name of the context
context.name=openbravo-copy

# Should point to the new path
source.path=/home/iperdomo/src/openbravo/pi2

# New name of the database
bbdd.sid=pi_reference

After changing the Openbravo.properties file, execute the restore process as usual.

Notes

Using the script with non default settings

The script assumes that you are working in a development environment with the ‘standard’ configuration of PostgreSQL. If your database is not in localhost or not using the default port 5432, you can override those properties when making the backup and restoring it.

~/src/openbravo/pi $ ant -f snapshot.xml -Dhost=otherHost -Dport=otherport

Why is not this part of Openbravo’s standard distribution?

As you can see the script uses pg_dump and pg_restore for dumping and restoring the database, so only PostgreSQL is supported. If you are willing you can send me a patch to include support for Oracle

That’s all, I hope this script will save you some time




Feb 22, 2010

Base References in Modules

by Asier Lostalé

Openbravo ERP 2.50MP12 is about to be released, one of the new cool features it includes is the capability of defining new Application Dictionary Base References within modules.

Application Dictionary References is the way Openbravo ERP defines data type of columns and how is rendered the UI for them. Before 2.50MP12, modules were not allowed to add base references, they only could use the ones provided by core and create new sub-references for these ones. This means that the UI and behavior for all fields in generated windows was set by the references in core, being impossible to define new ones in modules implementing different UI and behavior. The only way to perform all of this was creating manual windows where you are free to implement whatever you need, but as counterpart you loose the maintainability of having windows defined in Application Dictionary.

This limitation has now been broken. You can create base references in your module, which will allow to integrate within generated windows elements having new UI and behaving in a different way than the ones predefined in core.

UI selector

As a first example of how this new capability can improve Openbravo ERP usability you can take a look at the new UI Selector, which through a module (available as commercial) implements a completely new UI for selectors. Being also the first module that integrates SmartClient within generated windows.


Filed under: Dev, Openbravo Tagged: developers utilities, functionality, modularity



Feb 18, 2010

Modularity Status Update webinar re-scheduled for next Thursday February 25th

by Ismael Ciordia

The webinar was scheduled for today at 16:00 (CET) as you know. But I  have just known that I have to travel this afternoon and it forces me to delay the session.
I appreciate your understanding and truly apologize for the delay. Please make sure to attend the event on next Thursday February 25th from 16:00 to 17:00 (CET).

I look forward to seeing you there.




Feb 16, 2010

OpenbravoERP server customizing experience

by Galder Romo

Implementing OpenbravoERP in mid and big size companies, sometimes means having plenty of new developments and customizations, apart from having a bigger pool of users. Therefore the production server will need more resources.

When in a production environment there is a large server with plenty of resources, OpenbravoERP needs some parametrization in order to operate exploiting all resources properly.

Some improvements based on my experience, having a 20G server:

Related to Ant tasks:
In order to avoid java heap space when many sources have been developed, increase build.maxmemory in build.xml file. By default, from OB 2.50-MP12 ahead, this parameter is set to 1024M for 64bit servers and to 512M for 32bit servers. It will also compile faster.

Related to Tomcat:
In order to assure higher efficiency and lower response times to the users, customize some tomcat parameters. In file /etc/profile.d/tomcat.sh, change -Xmx parameter based in your own criteria. Realize 64bit servers need more resources than 32bit ones. The above is just an example:

export CATALINA_OPTS=”-server -Xms128M -Xmx2560M -XX:MaxPermSize=256M -Djava.library.path=/usr/lib64″

It is important to check the existing Tomcat documentation before you change anything, and change it first on a development environment.

Related to PostgreSQL:
In order to assure better database performance, edit /srv/pgsql/8.3/postgresql.conf and change this parameters shared_buffers, checkpoint_segments, maintenance_work_mem, wal_buffers and effective_cache_size.

Take into account that you will probably have to set a new value for SHMMAX, this can be done adding kernel.shmmax = 8589934592 to /etc/sysctl.conf. Where 8589934592 is the result of doing: 1024M (defined as shared_buffers) * 1024 bits/M * 8192.

Again, it is important to check the existing PostgreSQL documentation before you change anything, and change it first on a development environment.

Finally, it is important to execute vacuums frequently in order to have proper database statistics and performance. This can also be done using the console.

Remember, this is just my own experience.




Feb 15, 2010

Test Drive the new Selector

by Rob Goris
Selecting an object such as a business partner or a product "on the fly" while editing a form is a frequent task. In the current ERP we support this by providing a UI Selector that lets you choose the object using filters in a popup. The solution we have used so far is very powerful but not very usable. Clearing filters is awkward and it does not support suggestions or any other assistance in speeding up the filtering process.

With the new UI Selector we believe these problems will be past tense. Using SmartClient technology we have built a UI Selector that makes use of suggestions (using live filtering) and applies column filtering in the grid.

We have created a test instance where you can play with the new selector.

Go to http://79.125.36.179/openbravo/security/Menu.html

Log in with selector/test

Navigate to Sales Management > Transactions > Sales Order. The business partner and product selector have been enabled for the sales order header and line.

You can use the following keyboard shortcuts:

Ctrl-enter opens the popup /layer
Alt-arrow-down opens the suggestion dropdown

The new selector can be defined without programming. The definition is done in the application dictionary similar to windows and tabs. Selectors can be changed at runtime by a consultant without re-starting the system or re-compiling.

We intend to initially publish this as a commercial module and later open it up to the whole community as part of Openbravo ERP 3.0.

Let us know your findings on the UX Lab.



Feb 15, 2010

rm-updates-sprint-32

by Gorka Gil

Openbravo ERP: 2.50MP11 available

We have released the latest maintenance pack of the 2.50 release, check the release notes for more information.

Infrastructure

We have updated our issues.openbravo.com server to the latest available version of Mantis (1.2.0).  Some of the new features are:

  • Ability to customize the columns shown in the view issues page.
  • Preview the attached images directly in the issues.
  • Plugins support.

This update is the foundation for a lot more improvements that will come soon. Stay tunned !

Documentation

We have changed the Release Management categories in the wiki, with the idea of making it more user centric and  easier to navigate for external users.




Feb 11, 2010

Building a Localization Pack (I)

by David Alsasua
This is the first of several posts that we are going to publish from the Openbravo Localization Team on how to develop localization features. We will be using the recently released Spanish Localization Packs as an example, and we will demonstrate how can you re-use them to support the localization needs of other regions, or extend them in order to add further capabilities for Spain. Additionally, since the Spanish Localization Packs include many sophisticated features, these blog posts can also benefit any developer interested in developing modular capabilities for Openbravo.

In this first post, I will talk about the Tax Report Launcher, that allows the user to retrieve taxing information from the ERP, and put that figures into a file (such as a VAT statement to be presented on-line, for example). This is a public module that everybody can install. We invite localizers to benefit from it, and develop and release reports on top of it, as new extension modules.

If you have a look to the module itself, you will realize that is not that complex thing, but a really good idea. Let me introduce you to the concept of Parameter. A report created in the tax report launcher, defines a set of parameters (following the VAT example, a parameter could be Sales for 16% VAT). This parameter can be associated to one or more tax rates defined in the client. This association is done a 100% through the UI:

* Definition of the parameters in a report to be run over the tax report launcher

* In linked items, all tax rates associated to this parameter are shown.

* Assignation of a parameter to a tax rate

In the case of the Spanish Localization Packs, a Taxes for Spain module has been released, with the configuration needed for the most part of small and medium companies in Spain. When a report is developed, it includes a dataset that assigns corresponding tax parameters of the report, to the existing tax rates in the Taxes for Spain module (in the VAT statement example, the report will create all the parameters, and one of them could be the Domestic Sales where VAT 16% was applied parameter; at the same time, will associate the Sales 16% VAT tax rate to this parameter). This way, user don't need to configure anything manually.

The Launcher also defines a Java public interface. Each report running on this launcher will have a Java class implementing this template. This code will implement all the business logic of the report. The good thing is that the developer will be able to retrieve all the tax rates associated to each of the defined parameters (in the example of the VAT statement, user could query database, asking for the total amount of the posted transactions in the system due to domestic sales operations subject to the VAT 16% tax rate).

Once those amounts are retrieved, and calculations are done, the result can be presented to the user as a file, suitable for on-line submission. Let's put all of this in a simple picture:


Two examples of reports developed using the Tax Report Launcher are AEAT 347 and AEAT 349.

If I succeeded in arousing your curiosity, please have a look to the webinar we recorded regarding this topic for further information!

See you in the next post!



Feb 9, 2010

Modularity Status Update and Road Map – February 18th

by Ismael Ciordia

Open to all Openbravo Community members, in this webinar you will learn main concepts, achievements  in 2009 and the plan going forward for 2010 related to Openbravo Modularity and Ecosystem. And you will have the opportunity to participate in an open discussion  about a couple of ideas that Openbravo team wants to promote in order to improve collaboration.

Take a look at this post for more details about the webinar.