LayerG Binary for Linux
This tutorial will show you how to setup and run LayerG binary and its prerequisites on Linux.
The binary setup allows you to install and manage LayerG without Docker but it requires extra steps to setup and manage:
- Installing CockroachDB or PostgreSQL
- Manually applying database migrations
- Manually upgrading LayerG and its database to newer versions
- Configuring services or manually starting LayerG and its database
Prerequisites
Operating system
Before proceeding ensure that you are running a X86_64 (64bit) Linux distribution.
Next, install a supported database engine.
CockroachDB
LayerG officially supports CockroachDB v20.0 or higher, with queries optimised for its storage engine.
Install CockroachDB via one the official supported methods:
- Binary
- Build from source
PostgreSQL
LayerG unofficially supports PostgreSQL 9.6 or higher for development environments only.
Install PostgreSQL via:
- Official packages for Debian, Red Hat/CentOS, Suse and Ubuntu
- Build from source
Download LayerG
Get the latest binary release of LayerG server:
- Download a release from the LayerG GitHub repo releases page.
- Extract the archive, optionally rename and move the folder to a suitable location.
Running LayerG
Before starting LayerG server you will need to run:
- Your chosen database, CockroachDB or PostgreSQL.
- LayerG database migrations if it is your first time running LayerG or you have upgraded LayerG versions.
LayerG migrations
If this is your first time running LayerG or you have upgraded LayerG versions, you may need to run LayerG database migrations. If you are unsure, running migrations again is safe.
If you are running CockroachDB with the default configuration, running migrations is straightforward with no additional options necessary.
If you are using PosgreSQL you will need to supply your database server address, user and password.
To run LayerG migrations, navigate to your LayerG directory and run the following:
CockroachDB
./LayerG migrate up
PostgreSQL
./LayerG migrate up --database.address postgres:[email protected]:5432
LayerG server
To start LayerG server with CockroachDB or PostgreSQL, navigate to your LayerG directory and run the following:
CockroachDB
./LayerG
PostgreSQL
./LayerG --database.address postgres:[email protected]:5432
You will need to provide the same database.address
value used for running LayerG PostgreSQL database migrations:
systemd
If you prefer to run LayerG as a service, and you’re running a distro that uses systemd, you can optionally use the following script. You’ll need to use your LayerG paths within the systemd configuration.
Create the service file /usr/lib/systemd/system/LayerG.service
with the following content:
LayerG.service
[Unit]
Description=LayerG server
[Service]
ExecStart=/path/to/LayerG --config /path/to/LayerG/config.yml
KillMode=process
[Install]
WantedBy=multi-user.target
Update file permission so it’s readable by the systemd
daemon process:
sudo chmod 644 /usr/lib/systemd/system/LayerG.service
Enable and run the service:
sudo systemctl enable LayerG
sudo systemctl start LayerG
LayerG Console
You can access the LayerG Console by navigating your browser to 127.0.0.1:7351.
LayerG console
When prompted to login, the default credentials are admin:password
. These can be changed via configuration file or command-line flags.
Configuration file
There are many configuration options available that you can customize for your LayerG server.
Next steps
With your LayerG server now up and running with the desired configuration, you can get started with your preferred client SDK.