Tag Archives: ERPNext

Install ERPNext on FreeBSD

Frankly, the simplest way I have found to install ERPNext on FreeBSD is to use the ERPNext Virtual Image with VirtualBox and phpVirtualBoxVirtualBox is supported on FreeBSD, and phpVirtualBox is a popular web application that duplicates the native VirtualBox manager for headless servers (and saved me from learning the intricacies of the Virtual Box cli). A big shout-out to Ian More for creating phpVirtualBox, and to the phpVirtualBox community – including decke@FreeBSD.org for updating the FreeBSD phpvirtualbox port and package

Several years ago I attempted to install ERPNext on bare metal FreeBSD using the ERPNext Easy Install script, but eventually had to switch to CentOS. This time I decided to try VirtualBox. I initially considered the BSD hypervisor bhyve, but bhyve does not directly support an Open Virtualization Format (OVF) disk image (although it is reportedly possible to use qemu-img to convert the OVF image to a raw image, which is supported by VirtualBox).

The server is de-branded HP Media Centre PC, with an E6600 Core 2 CPU and 3 GB of DDR2 PC2-5300. I was concerned about performance with only 3 GB of RAM but usability has been satisfactory, albeit to date under relatively light load. htop shows an increase in RAM and swap use with VirtualBox, but RAM use is still below 1 GB and swap use is under 100 MB.  

Please comment if you found this information useful. It’s kind of a poll. Thanks.

Install VirtualBox

# pkg install virtualbox-ose

The vboxdrv kernel module needs to be loaded at boot, done by editing /boot/loader.conf

# vi /boot/loader.conf
...
vboxdrv_load="YES"

Reboot the system to have the kernel module loaded.

The user that VirtualBox runs as must be a member of the vboxusers group. For simplicity, I’ll run VirtualBox using my own username, although best practise would be to create a dedicated user.

# pw groupmod vboxusers -m dale

Edit /etc/rc.conf to run vboxwebsrv (the Virtual Box web interface daemon) using the provided startup script installed in /usr/local/etc/rc.d/

% sudo vi /etc/rc.conf

vboxwebsrv_enable="YES"
vboxwebsrv_user="dale"

and finally start the vboxwebsrv service.

% sudo service vboxwebsrv start
% sudo service vboxwebsrv status

This however does not actually start a virtual machine. I will be using phpVirtualBox to manage virtual machines interactively. However, a vboxheadless rc.d script is also provided to start a virtual machine automatically during boot. 

Install phpVirtualBox

Install phpVirtualBox.

# pkg install phpvirtualbox

Edit the phpVirtualBox config.php file appropriately.

# vi /usr/local/www/phpvirtualbox/config.php

var $username = 'dale';
var $password = 'dale_login_password';

Finally configure the webserver to serve phpVirtualBox. I use Apache 2.4 and added a virtual host definition to /usr/local/etc/apache24/extra/httpd-vhosts.conf to serve phpvirtualbox as a phpvirtualbox.dalescott.net.

<VirtualHost phpvirtualbox.dalescott.net>
  DocumentRoot "/usr/local/www/phpvirtualbox"
  <Directory "/usr/local/www/phpvirtualbox">
    allow from all
    Options None
    Require all granted
  </Directory>
</VirtualHost>

“Install” ERPNext

Download an ERPNext Virtual Machine image (*.ova file) to /usr/local/etc/vbox (a suitably arbitrary location).

 % wget http://build.erpnext.com/ERPNext-Production.ova

Using phpVirtualBox, create a new vm by importing the downloaded ERPNext-Production.ova Virtual Image file (File/Import). It includes port forwarding rules to forward client port 80 (used by the vm to serve ERPNext) to host port 8080. There is also a rule to forward ssh from client port 22 to host port 3022.

Start the vm and then login to ERPNext from a browser (e.g. www.dalescott.net:8080) using the default credentials. The new site wizard will run and lead you through ERPNext configuration. Use a secure password when defining the initial (admin) user, and the wizard will delete the initial Administrator user (with default password) when complete. 

Once logged into ERPNext, you will likely want to setup email processing so that users will receive notifications outside of ERPNext. This will be valuable to understanding and appreciating ERPNext’s significant social aspect. You will also want to change the password for the configured system user to something secure (or even disable password authentication entirely in favour of key-based authentication).

More about phpVirtualBox

phpVirtualBox may be a project in transition. Although researching the internet showed phpVirtualBox to be the most popular web UI for VirtualBox, it still appears to depend primarily on the project founder for development support.

The phpVirtualBox project was first hosted on Sourceforge. Although the code repository was later moved to GitHub, Sourceforge still hosts the distribution archives and documentation wiki.

The future of phpVirtualBox though is not completely certain, which is unfortunate as phpVirtualBox is the only web interface for VirtualBox. The GitHub repo is the only repo managed by the phpVirtualBox organization, which has has no public members and no written statement of direction. The FreeBSD phpvirtualbox port update from July 2017, billed as an “unofficial 5.1-1 release” was cherry picked from unaccepted community merge requests and included the comment “Sadly upstream is very silent”.

However, given the popularity of phpVirtualBox, and that it’s licensed using the GPL v3, I’m confident it will survive.

Maestro Dev Review

I posted recently that Maestro development was moving from the Tryton framework to ERPNext.

There two perspectives to keep in mind when managing a project. The first is a crisp motivating vision of the goal, the second is the path to goal. The challenge is finding the path that best balances cost, time and quality, taking into account technical and operational risks and constraints. Oh, and did I also say the path needs to changes as new information becomes known, risks become better understood, new skills are learned, team members come and go…

Also, periodically review the individual steps on the path. Are the risks acceptable? Should a step be simplified or re-factored? Are there appropriate contingencies available? Backcasting can also be a useful technique, working backwards from the goal to the current position (Harry Tucker has a great backcasting visual).

Getting back to the Maestro project…

Maestro Platform Iterations

Maestro is now in its fourth platform iteration:

  • Platform 1 – Loosely coupled web apps (WebERP, MantisBT, OpenDocMan)
  • Platform 2 – Full-custom monolithic web app (Yii Framework)
  • Platform 3 – ERP framework (Tryton) with Integrated web apps apps (MantisBT, OpenDocMan)
  • Platform 4 – Single ERP web app (ERPNext)

Platform 1

Platform 1 was a loose integration of three separate web applications. Each application had integration points to the others as appropriate, such as from an Item in WebERP to the control documents for it in OpenDocMan, or from an Issue in Mantis to the Item in WebERP, or related documents in OpenDocMan.

Maestro
|-- WebERP
|-- OpenDocMan (document control)
|-- Mantis (issue management)
\-- Launch portal (simple HTML page)

Development moved to Platform 2 after the initial prototype showed the effort to understand the underlying architectures, data structures, and different coding styles of each application, and to create an overall cohesiveness, would be greater than the effort saved by using separate applications in the first place.

Platform 2

Platform 2 was a full custom web application based on the Yii Framework. A prototype was completed with a rudimentary Parts module (including CSV and PDF export) and Order module, but development moved to Platfrom 3 in March 2014 after departure of a key team member. 

Platform 3

Platform 3 was a throwback to Platform 1 (a collection of loosely coupled applications), but with the Tryton framework (including native desktop client) replacing webERP, and WordPress replacing OpenDocMan. OpenLDAP provided a single point of user management and authentication, a self-contained messaging system was provided with Postfix, Dovecote and SquirrelMail, and WordPress provided a launch portal and document control system.

Maestro development moved away from Tryton in September 2014 after the completed prototype showed the need for both core development as well as a simplified domain-specific web-based user interface, and doing both was  beyond the ability of the project team.

Maestro
|-- Tryton
|-- Desktop Portal (WordPress)
|   |-- Notices (posts)
|   |-- User Manual (pages)
|   \-- Documents (WP Document Revisions)
|-- Issues (Mantis)
|-- Messages (SquirrelMail)
\-- Users (phpLDAPadmin)

Platform 4

In the same way as Platform 3 was a throw-back to Platform 1, Platform 4 is a throw-back to Platform 2 – a single integrated web application. However, instead of a green-field development, Platform 4 is based on ERPNext.

After development moved away from Platform 2, but before starting Platform 3, two web-based ERP systems were evaluated – ERPNext and OpenERP/Odoo. Although both showed promise, Odoo had a significant learning curve for core development that would be needed, and ERPNext was still relatively young and immature. However, over the course of Platform 3 development, ERPNext made such significant progress that it became feasible to use for Platform 4.

Install mdbtools on Centos 7

Maestro depends on mdbtools for extracting part data from a Parts&Vendors database. I have always used mdbtools on FreeBSD (installing the binary package), but recently have needed mdbtools on Centos 7 for use with ERPNext. I read a number of internet posts recommending installing mdbtools from the Fedora EPEL repository but, if mdbtools is still in EPEL, I need to learn more about installing software on Centos/RHEL.

Except for installing a few pre-requisites, install generally followed the mdbtools github README.mdb.

Install pre-requisites

# yum install glib2-devel
# yum install txt2man
# yum install gnome-doc-utils

Install mdbtools

# cd /root/work
# git clone https://github.com/brianb/mdbtools.git mdbtools
# cd mdbtools
# autoreconf -i -f
# ./configure
# make
# make install

Use mdbtools

The mdbtools utilities are installed to /usr/local/bin/

mdb-array
mdb-export
mdb-header
mdb-hexdump
mdb-parsecsv
mdb-prop
mdb-schema
mdb-sql
mdb-tables
mdb-ver

Each utility has its own man page

# man mdb-export

and includes built-in short help

mdb-export --help

Install ERPNext on bare metal Ubuntu

This post is essentially the same post as Install ERPNext on bare metal Centos 7, but with Ubuntu 64b 14.04.1-server. I ran into a snag installing ERPNext on Centos. I now understand there are subtle differences between the Centos 7 system on my DigitalOcean Droplet, and the fresh Centos 7 install I did on a bare metal box from the Everything-DVD iso. For someone unknown reason, ERPNext isn’t serving pages, but the server does seem to be up and running. However, in the interests of moving on, I’m switching to Ubuntu, which is also supported by setup_frappe.sh.

Update: ERPNext installed correctly, I didn’t do much testing, just browsed to login page and around.

I’m starting with a Dell Optiplex 755 and the DVD iso file for 64-bit Ubuntu 14.04.1 LTS .

  • Boot into the MEBx BIOS (Ctrl-P instead of F2) and disable Intel ANT ME BIOS Extension (that doesn’t play nice). ThinkWiki has a good article, and besides knowing the default password to get in (admin), you MUST change the password – and it MUST be a strong password
  • install Ubuntu from ubuntu-14.04.1-server-amd64.iso
    • server name (whizzer.local), timezone, and first user
    • disk partitioning – select Guided – use entire disk and set up LVM
    • no automatic updates – automatic updates could be distracting, and it can probably be figured out later
    • collections: OpenSSH server, Mail server, Samba file server
      • mail server configuration type: Local only (The only delivered mail is the mail for local users. There is no network.).
        • Other options: 1) Internet site (mail is sent and received directly using SMTP), 2) Internet with smarthost (mail is received directly using SMTP or by running a utility such as fetchmail. Outgoing mail is sent using a smarthost.), and 3) Satellite system (All mail is sent to another machine, called a ‘smarthost’ for delivery.). I don’t think this will handle having virtual users (instead of system users with system accounts).
      • Postfix Configuration: System mail name: whizzer.local All mail addresses default to here if a host isn’t specified.
      • Create SSL certificate (name: localhost)
  • Reboot!
  • Fix “no talloc stackframe at ../source3/param/loadparm.c:4864, leaking memory”
    • http://ubuntuforums.org/showthread.php?t=2214042
  • connect using WinSCP and copy public ssh key to /root/.ssh/, also copy authorized_hosts and id_rsa (openssh), and reboot (don’t know how to stop/start ssh on Ubuntu either).
  • follow Easy Way in ERPNExt frappe bench README.md
  • point browser at the server ip address
    • server produced ERPNext login screen, so it seems the basics are working.
  • Access the server from a browser (port 80), and sign into ERPNext as “Adminstrator” using the password output at the end of the setup_frappe.sh execution.
  • Backup the database after completing the setup wizard.

Compared to Centos, wkhtmltopdf installed correctly, and did not have to be manually installed afterwards.

setup_frappe.sh log

dale@hotstuff:~$ wget https://raw.githubusercontent.com/frappe/bench/master/install_scripts/setup_frappe.sh
--2014-11-20 03:49:46--  https://raw.githubusercontent.com/frappe/bench/master/install_scripts/setup_frappe.sh
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 23.235.47.133
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|23.235.47.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11561 (11K) [text/plain]
Saving to: ‘setup_frappe.sh’

100%[===============================================================================================>] 11,561      --.-K/s   in 0s

2014-11-20 03:49:47 (61.5 MB/s) - ‘setup_frappe.sh’ saved [11561/11561]

dale@hotstuff:~$ sudo bash setup_frappe.sh --setup-production
[sudo] password for dale:
Installing for Ubuntu trusty amd64
In case you encounter an error, you can post on https://discuss.frappe.io

Adding debian mariadb repo
Installing packages for Ubuntu. This might take time...
Installing wkhtmltopdf
Adding frappe user
setup_frappe.sh: line 300: hash: pip-2.7: not found
setup_frappe.sh: line 302: hash: pip2.7: not found
Installing frappe-bench
Setting up first site

Frappe/ERPNext is installed successfully and is running on port 80.
Frappe password: xxxxx
MariaDB root password: xxxxx
Administrator password: xxxxx

The passwords are also stored at ~/frappe_passwords.txt
You can remove this file after making a note of the passwords.
dale@hotstuff:~$ 

Backup database

Maybe…

systemctl status mariadb.service
mysqldump -u root -p --databases site1.local > ~/erpnextbkup/erpnext-1.sql

Restore database

Maybe…

mysql -u root -p site1.local < ~/erpnextbkup/erpnext-1.sql