Install Tryton on FreeBSD v13

In this tutorial I will install Tryton. Tryton is open source business software of the type popularly known as ERP (Enterprise Resource Plannning). ERP is often considered accounting or finance software, but this is only one function.

The real value of ERP software is achieved when it is used to share information and manage business processes within an organization as a whole, including engineering product development and product lifecycle management (PLM), supply chain, purchasing, and inventory control, manufacturing and material requirements planning (MRP), sales planning and customer relationship management (CRM).

Tryton follows a three-tier architecture model consisting of:

  • The Presentation Tier
    • tryton, the Tryton desktop client for Windows, Mac OS or Linux.
    • sao, the Tryton web client (also known as the Tryton web site).
  • The Application Tier
    • trytond, the Tryton server daemon.
  • The Data Tier
    • SQLite, for development testing, or
    • PostgreSQL, for production use.

Install FreeBSD 13

Install FreeBSD 13 using suitable media and perform typical initial configuration. Create an initial admin user in the install wizard and include them in the wheel group. 

After booting into the new system and logging in as the admin user, copy a public ssh key for the admin user to ~/.ssh/authorized_keys and disable ssh password authentication in /etc/ssh/sshd_config for security.

% su - 
# vi /etc/ssh/sshd_config
...
# Change to no to disable PAM authentication
ChallengeResponseAuthentication no
...
# service sshd restart

Update FreeBSD and package manager database for third-party software (when FreeBSD is first installed pkg is a shim, when run it will first install the current version of pkg).

# freebsd-update fetch
# freebsd-update install
# pkg update

Install sudo for more convenient system administration instead of having to “su” to root.

# pkg install sudo

Configure sudo to allow the admin user (and all other members of the wheel group) to allow use without needing to enter a password for convenience (reasonable on a small system).

# visudo
...
## Uncomment to allow members of group wheel to execute any command
# %wheel ALL=(ALL) ALL

## Same thing without a password
%wheel ALL=(ALL) NOPASSWD: ALL

Install tmux. tmux is a terminal multiplexer, which can also be used to detach processes from their controlling terminals, allowing remote sessions to remain active.

# sudo pkg install tmux

Install Python 3

From version 5.0, Tryton has used Python 3. Since Python is not included in the FreeBSD base system, it must be installed seperately.

Install the python3 package, which currently installs Python 3.8.

% sudo pkg install python3

Install py38-pip, the corresponding version of the Python package manager. pip will be used to install trytond and trytond modules from PyPI (the Python Package Index).

% sudo pkg install py38-pip

Install system dependencies

trytond requires libxml2, an XML C parser and toolkit, and libsxlt, an XSLT C library. Graphviz is a package of open-source tools for drawing graphs required by sao, the Tryton web client, which will be installed later in a seperate post.

% sudo pkg install libxml2
% sudo pkg install libxslt
% sudo pkg install graphviz

bash (the Bourne Again SHell) is required to use Python’s built-in venv module, which will be used to create a virtual environment for executing trytond.

% sudo pkg install bash

Install SQLite

Tryton uses the SQLite database management system for development testing, and PostgreSQL for production operation. SQLite has few dependencies and is less complicated to use than PostgreSQL, and will be installed here for initial bring-up testing. PostgreSQL will be installed later for production use.

Install the Python SQLite package.

% sudo pkg install py38-sqlite3

Install trytond

For production use, best practices would indicate a dedicated user should be created for executing trytond, and the users’ home directory used to install trytond and for storing document attachments. However, for simplicity a normal user and home directory will be used.

Create a directory for installing trytond in.

% sudo mkdir -p ~/work/trytond

Create a virtual environment for executing trytond.

% cd ~/work/trytond
% bash
$ python3 -m venv env
$ source env/bin/activate
(env) [~/work/trytond]$

Install trytond using pip.

(env) [~/work/trytond]$ pip install trytond

Install the trytond-product module which will provide the basic functionality needed to create products (part numbers or sku’s).

(env) [~/work/trytond]$ pip install trytond-product

trytond modules can have dependencies, which will also installed when a module is installed. To see all the trytond modules which have been installed, use pip to list installed modules and grep for trydond.

(env) [~/work/trytond]$ pip list | grep trytond
trytond          6.2.3
trytond-company  6.2.0
trytond-country  6.2.0
trytond-currency 6.2.0
trytond-party    6.2.0
trytond-product  6.2.0
(env) [~/work/trytond]$ 

You can search PiPY for Tryton Framework modules. Refine the search with “trytond” in the search field and sort the results by last updated to list core modules at the top.

trytond reads a trytond.conf configuration file to set operating conditions. trytond has built-in defaults which will configure using a local SQLite database and allow client access from the local system. I will use SQLite for initial bring-up testing, but will use a remote client for access.

By default, trytond will only listen to the local system for connections. To allow connecting from a remote system, create ~/work/trytond/trytond.conf with the following content:

[web]
listen=0.0.0.0:8000

By default, trytond will use an SQLite database which is convenient for developers. Also by default, trytond will expect the database to be found in ~/db/.

Create an empty SQLite database file,

% mkdir ~/db
% touch ~/db/test_db.sqlite

and then initialize the database using trytond-admin. tryton-admin will prompt for a password for the initial admin user which it will enter in the database. The password will be used later to login using the Tryton client as user admin.

(env) dale@starlord:~/work/trytond$ env/bin/trytond-admin -c ./trytond.conf -d test_db --all
"admin" email for "test_db": dale@dalescott.net
"admin" password for "test_db": 
"admin" password confirmation: 
(env) dale@starlord:~/work/trytond$  

Start trytond

Start tmux, which will allow trytond to be started and remain running if the ssh connection or login is broken, and all the shell actity while the connection was broken can still be seen after re-connecting.

(env) dale@starlord:~/work/trytond$ tmux

trytond listens on port 8000, ensure the port is open and or forwarded if you are using a virtual machine.

Start trytond.

(env) dale@starlord:~/work/trytond$ env/bin/trytond -c ./trytond.conf -d test_db
25690 34374492160 [2022-01-19 20:16:19,365] WARNING werkzeug  * Running on all addresses.
   WARNING: This is a development server. Do not use it in a production deployment.
25690 34374492160 [2022-01-19 20:16:19,366] INFO werkzeug  * Running on http://10.0.2.15:8000/ (Press CTRL+C to quit)

Connect using Tryton Desktop Client

Download the latest version of the desktop client from the Tryton project website. The latest version of the client must be used in this case because the latest version of trytond is was installed. The first two digits of the tryton version must be the same as the first two digits of the trytond version. In other words, if trytond is version 6.2.x then the tryton client must be version 6.2.x.

On a Windows system, download and install the latest version of the Windows desktop client, and run as typical. On a Linux system, download the source code for the latest version of tryton appropriate for the system, extract to a convenient location and execute …/bin/tryton.

After the Tryton desktop client starts,

click the Manage button to create a new profile to access the newly installed Tryton site. First click the “+” button to create a new profile, enter a name for the profile (the name is arbitrary) and then the host URL. The client will access the database and populate the drop down with available database names. In this case, test_db will be the only database available.

Select Close to return to the Login screen. If you didn’t enter the “admin” user in the profile, enter it now and select Connect. When prompted for the admin user password, enter the password provided to trytond-admin when the database was initialized.

After logging in, a wizard will lead you you through the interactive configuration, including activating the desired modules, define a company and adding users, which will be covered in a separate post.

Tryton Client Options

The Tryton client has several command switches that may be useful if debugging Tryton operation or developing Tryton modules.

tryton -d {-v} {-l [DEBUG | INFO | WARNING | ERROR | CRITICAL]}
-d development mode (disable client-side caching)
-v verbose
-l log level

Getting Started with RISC-V

RISC-V is an exciting new open source processor design which will be of particular interest to developers of custom IP. This short overview will help you understand RISC-V,  its eco system, and the opportunities it presents.

RISC-V Foundation

Technical Overview

  • Wikipedia has a good technical overview, including a list of open-source implementations which could be useful for bootstraping a project instead of starting from scratch with the low-level instruction set specification (the “ISA”). https://en.wikipedia.org/wiki/RISC-V

Some RISC-V Users

  • Google’s OpenTitan project seeks to provide an open-source silicon root of trust (RoT) using a RISC-V-based RoT design with integration guidelines for use in data center servers, storage devices and peripherals. https://opentitan.org/
  • Kneron is a California-based company known for its impressive line of AI SoCs. Kneron’s KL530 targets the autonomous vehicle edge computing market specifically. In addition to a RISC-V AI-coprocessor, the chip also includes a neural processing unit, a Cortex M4 core for system control, an image signal processor, and a dedicated security block. https://www.allaboutcircuits.com/news/knerons-risc-v-ai-chip-intends-to-bring-level-1-and-level-2-autonomy-to-any-vehicle
  • Western Digital is moving its consumption of IP cores (1B per year!) to RISC-V, as well as offering commercial RISC-V IP. https://www.westerndigital.com/en-ca/solutions/business/risc-v
  • SiFive provides three families of RISK-V IP, covering high-performance application processors, area-optimized, low-power embedded 64- and 32-bit microcontrollers, as well as vector processors. https://www.sifive.com/blog/risc-v-chiplets-disaggregated-die-and-tiles
  • Apple posted in September for a “RISC-V High Performance Programmer” to work in their Vector and Numerics Group (which is responsible for “designing, enhancing and improving various embedded subsystems running on iOS, macOS, watchOS and tvOS.”). Candidates should be experienced with RISC-V architectures, and ideally have a working knowledge of NEON micro architecture in ARM CPU cores. https://appleinsider.com/articles/21/09/03/apple-investigating-risc-v-processor-architecture-job-listing-shows

Mentions in Popular Media

Examples of Development Boards

Software Development

 

Please let me know in the comments section if you have found this overview useful,

 

Install Tryton using Docker on Ubuntu

In this tutorial I will install get Tryton using Docker, the fastest way to host Tryton for evaluation. The Tryton project provides a Docker container for use on Ubuntu Linux, which I will host a virtual machine on a FreeBSD host.

Create Virtual Machine

Install Ubuntu 20.04 using the Ubuntu distribution DVD ISO and using the startup wizard configure appropriately.

Copy your user ssh key to the new server and disable password login.

Configure vm port forwarding.  Port forwarding with VirtualBox must be done with the vm powered off.

Name: ssh
Protocol: TCP
Host Port: 8000
Guest Port: 8000

Update Server OS

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade

Install Docker

$ sudo apt install docker.io

Install Tryton

$ sudo docker pull tryton/tryton

Start a PostgreSQL instance

The Tryton image will be pulled from library/postgres

$ sudo docker run --name tryton-postgres -e POSTGRES_PASSWORD=mysecretpassword -e POSTGRES_DB=tryton -d postgres

Setup the database

$ sudo docker run --link tryton-postgres:postgres -e DB_PASSWORD=mysecretpassword -it tryton/tryton trytond-admin -d tryton --all

The script will prompt for:

  • “admin” email for “tryton”
  • “admin” password for “tryton”

Store the password in a key vault for safe future reference.

Start Tryton Instance

$ sudo docker run --name tryton -p 8000:8000 --link tryton-postgres:postgres -e DB_PASSWORD=mysecretpassword -d tryton/tryton

Start Tryton cron Instance

$ sudo docker run --name tryton-cron --link tryton-postgres:postgres -e DB_PASSWORD=mysecretpassword -d tryton/tryton trytond-cron -d tryton

Create bash Startup Script

Without further configuration the Docker container will not start automatically when the server starts. While it is possible to configure Tryton to automatically start, I have created a simple bash script for convenience to start Tryton manually.

dale@starlord:~$ cat start-tryton.sh
#!/bin/bash
# run using sudo
docker start tryton-postgres tryton tryton-cron
dale@starlord:~$

References