1. Introduction
Since Hexya is a modular ERP at compile time, it is only distributed as source code. The following instructions will guide you through the process of downloading the source code, setting up your configuration and compile Hexya.
2. Prerequisites
2.1. Install Go
First of all, you need to install the Go SDK. Follow the instructions on the Go website to install on your platform: https://golang.org/dl/ .
Hexya requires Go version 1.11 at least, as it uses Go modules
Then define your Go workspace directory.
This defaults to $HOME/go
.
You can change it by setting the $GOPATH
env variable if you want.
Finally add $GOPATH/bin
to your $PATH
.
Note
|
Because Hexya uses the new Go modules feature, the Go Workspace is only a technical directory. Do NOT explicitly download or work inside the Go Workspace. |
2.2. Install lessc
Hexya needs the less compiler lessc
to be installed.
If you have npm
, you can use:
$ npm install -g less
On Debian/Ubuntu you can alternately run:
$ sudo apt-get install node-less
3. Download
3.1. Download Hexya
Download Hexya source code with git using the following command:
git clone https://github.com/hexya-erp/hexya.git
Warning
|
As Hexya uses Go Modules, the Hexya repository MUST NOT be downloaded inside the Go Workspace defined by $GOPATH .
|
Then you can install Hexya with the following commands:
cd path/to/hexya
go install
This will download automatically all the dependencies
4. Create a project
You need to create a project directory to run a Hexya server. Your project will hold your configuration file and startup and resources files that will be generated by Hexya.
4.1. Download Demo Project
If you want to evaluate Hexya, you can download the hexya-demo
project.
git clone https://github.com/hexya-erp/hexya-demo.git
Warning
|
Here again download the source outside $GOPATH .
|
4.2. Creating a custom project
To create a custom project, use the hexya project init
command inside an empty directory.
Like all Go programs, you must define the import path though it does not need to resolve to a remote repository.
hexya project init github.com/myusername/myhexyaproject
This will create the following two files inside your project directory:
go.mod
hexya.toml
4.3. Generate Hexya
This step will generate some source code that depends on the modules you selected in the previous step. It takes as argument the project directory.
cd <projectDir>
hexya generate .
Type hexya help generate
for the list of available options:
$ hexya help generate
Generate the source code of the pool package which includes the definition of all the models.
This command also :
- creates the resource directory by symlinking all modules resources into the project directory.
- creates or updates the main.go of the project.
This command must be rerun after each source code modification, including module import.
Usage:
hexya generate PROJECT_DIR [flags]
Flags:
--empty Generate an empty pool package. When set projectDir is ignored.
-h, --help help for generate
Global Flags:
-c, --config string Alternate configuration file to read. Defaults to $HOME/.hexya/
--data-dir string Path to the directory where Hexya should store its data
--db-driver string Database driver to use (default "postgres")
--db-host string The database host to connect to. Values that start with / are for unix domain sockets directory (default "/var/run/postgresql")
--db-name string Database name (default "hexya")
--db-password string Database password. Leave empty when connecting through socket
--db-port string Database port. Value is ignored if db-host is not set (default "5432")
--db-ssl-ca string Path to certificate authority certificate(s) file
--db-ssl-cert string Path to client certificate file
--db-ssl-key string Path to client private key file
--db-ssl-mode string SSL mode to connect to the database. Must be one of 'disable' (default), 'require', 'verify-ca' or 'verify-full' (default "disable")
--db-user string Database user. Defaults to current user
--debug Enable server debug mode for development
--demo Load demo data for evaluating or tests
--log-file string File to which the log will be written
-L, --log-level string Log level. Should be one of 'debug', 'info', 'warn', 'error' or 'panic' (default "info")
-o, --log-stdout Enable stdout logging. Use for development or debugging.
-m, --modules strings List of module paths to load. Defaults to ['github.com/hexya-addons/web'] (default [github.com/hexya-addons/web])
--resource-dir string Path to the directory where Hexya should read its resources. Defaults to 'res' subdirectory of current directory (default "./res")
Important
|
Under Windows, hexya generate must be run as admin.
|
5. Synchronise database
5.1. Setup Postgresql
For now Hexya only supports Postgresql. Here is the quick setup for evaluating Hexya. Please refer to Postgresql documentation for finer configuration.
5.1.1. Create a postgres user
On Linux, use your distribution’s package, then create a postgres user named like your login:
$ sudo su - postgres -c "createuser -s $USER"
Because the role login is the same as your unix login unix sockets can be use without a password.
5.1.2. Create a hexya database
$ createdb hexya
5.2. Synchronise database schema with models
This step will synchronise the database with the models defined.
cd <projectDir>
hexya updatedb -o
Type hexya help updatedb
for the list of available options:
$ hexya help updatedb
Synchronize the database schema with the models definitions.
Usage:
hexya updatedb [flags]
Flags:
-h, --help help for updatedb
Global Flags:
-c, --config string Alternate configuration file to read. Defaults to $HOME/.hexya/
--data-dir string Path to the directory where Hexya should store its data
--db-driver string Database driver to use (default "postgres")
--db-host string The database host to connect to. Values that start with / are for unix domain sockets directory (default "/var/run/postgresql")
--db-name string Database name (default "hexya")
--db-password string Database password. Leave empty when connecting through socket
--db-port string Database port. Value is ignored if db-host is not set (default "5432")
--db-ssl-ca string Path to certificate authority certificate(s) file
--db-ssl-cert string Path to client certificate file
--db-ssl-key string Path to client private key file
--db-ssl-mode string SSL mode to connect to the database. Must be one of 'disable' (default), 'require', 'verify-ca' or 'verify-full' (default "disable")
--db-user string Database user. Defaults to current user
--debug Enable server debug mode for development
--demo Load demo data for evaluating or tests
--log-file string File to which the log will be written
-L, --log-level string Log level. Should be one of 'debug', 'info', 'warn', 'error' or 'panic' (default "info")
-o, --log-stdout Enable stdout logging. Use for development or debugging.
-m, --modules strings List of module paths to load. Defaults to ['github.com/hexya-addons/web'] (default [github.com/hexya-addons/web])
--resource-dir string Path to the directory where Hexya should read its resources. Defaults to 'res' subdirectory of current directory (default "./res")
6. Running Hexya
Hexya is launched by the hexya server
command from inside the project directory.
cd <projectDir>
hexya server -o
Type hexya help server
to get the list of available options:
$ hexya help server
Start the Hexya server of the project in 'projectDir'.
If projectDir is omitted, defaults to the current directory.
Usage:
hexya server [projectDir] [flags]
Flags:
-C, --certificate string Certificate file for HTTPS. If neither certificate nor domain is set, the server will run on plain HTTP. When certificate is set, private-key must also be set.
-d, --domain string Domain name of the server. When set, interface and port are set to 0.0.0.0:443 and it will automatically get an HTTPS certificate from Letsencrypt
-h, --help help for server
-i, --interface string Interface on which the server should listen. Empty string is all interfaces
-l, --languages strings Comma separated list of language codes to load (ex: fr,de,es).
-p, --port string Port on which the server should listen. (default "8080")
-K, --private-key string Private key file for HTTPS.
Global Flags:
-c, --config string Alternate configuration file to read. Defaults to $HOME/.hexya/
--data-dir string Path to the directory where Hexya should store its data
--db-driver string Database driver to use (default "postgres")
--db-host string The database host to connect to. Values that start with / are for unix domain sockets directory (default "/var/run/postgresql")
--db-name string Database name (default "hexya")
--db-password string Database password. Leave empty when connecting through socket
--db-port string Database port. Value is ignored if db-host is not set (default "5432")
--db-ssl-ca string Path to certificate authority certificate(s) file
--db-ssl-cert string Path to client certificate file
--db-ssl-key string Path to client private key file
--db-ssl-mode string SSL mode to connect to the database. Must be one of 'disable' (default), 'require', 'verify-ca' or 'verify-full' (default "disable")
--db-user string Database user. Defaults to current user
--debug Enable server debug mode for development
--demo Load demo data for evaluating or tests
--log-file string File to which the log will be written
-L, --log-level string Log level. Should be one of 'debug', 'info', 'warn', 'error' or 'panic' (default "info")
-o, --log-stdout Enable stdout logging. Use for development or debugging.
-m, --modules strings List of module paths to load. Defaults to ['github.com/hexya-addons/web'] (default [github.com/hexya-addons/web])
--resource-dir string Path to the directory where Hexya should read its resources. Defaults to 'res' subdirectory of current directory (default "./res")
You can now access the Hexya server at http://localhost:8080
Default credentials are :
-
Login:
admin
-
Password:
admin