Platform Installation
Install the Enjin Platform package dependencies
-
Your app will be located in
/var/www/laravel/
. Use thecd
command to navigate to this folder:cd /var/www/laravel/
-
We are now ready to install the required extensions, install them with the following command:
Check your installed php version
This guide was tested on php version 8.2, which is why the extensions are installed on version 8.2
Make sure to install the extensions on the same php version that your server is running.
To check which php version is currently installed, run the commandphp -v
sudo apt-get update sudo apt install php8.2-{common,sqlite3,gmp,intl,mysql,bcmath,pcov,redis}
-
Check that Go is installed, and install it if not:
go version
-
If the above command doesn't return something like
go version go1.18.1 linux/amd64
then proceed to install it with these commands (the following is from https://www.cyberciti.biz/faq/how-to-install-gol-ang-on-ubuntu-linux/).sudo apt update sudo apt upgrade sudo apt search golang-go sudo apt search gccgo-go sudo apt install golang-go
Install and configure the Enjin Platform Core package
-
Delete the
composer.lock
file if it exists:rm composer.lock
-
Edit the
composer.json
file using a tool likenano
orvim
and set theminimum-stability
property todev
. If using nano you can save and quit withctrl-x
and theny
followed byenter
-
Run the composer require command from the root of your Laravel folder for each of the Enjin Platform packages you wish to install.
Platform Packages
In this guide, we are installing platform-core package only, this is the only required package.
All other packages are optional.
To install additional packages, check out the Installing Additional Platform Packages sectioncomposer require enjin/platform-core
-
Once the core package is installed, build the
sr25519
plugin:cd vendor/gmajor/sr25519-bindings/go && go build -buildmode=c-shared -o sr25519.so . && mv sr25519.so ../src/Crypto/sr25519.so && chown $USER:www-data ../src/Crypto/sr25519.so && cd ../../../../
-
Run the platform database migrations:
php artisan migrate
-
Add these variables to your .env file, the .env file is located in the root of the laravel folder and you can edit it with one of the built-in text editors such a nano:
sudo nano .env
The required additions are:
AUTH_DRIVER=basic_token BASIC_AUTH_TOKEN= CHAIN=substrate NETWORK=canary DAEMON_ACCOUNT=
-
You should set the
BASIC_AUTH_TOKEN
to a long random string, this will be your key to access the API from your services. -
Set the
NETWORK
to eithercanary
(for testnet) orenjin
(for mainnet). -
If you wish to use the wallet daemon to sign transactions then you should set your wallet daemon account address in the
DAEMON_ACCOUNT
.env var. -
Additionally, we need to update the
APP_URL
to your public facing URL.APP_URL=https://your.domain.com
Continue with the installation
If you wish to use features such as Beam, Fuel Tanks, Marketplace, or UI, please continue to the Installing Additional Packages page.
If not, please continue to the Setting up the Decoder page.
Setup Automated Database Pruning
The ingest process will store data over time in the database. Once processed, this data can be optionally pruned to save storage space in the database.
- Ensure that Cron is installed and enabled
sudo apt update sudo apt install cron sudo systemctl enable cron
- Edit using crontab
crontab -e
- Add the following entry to the end of the file, after the last #. This will run the scheduler every minute, which will decide when to perform database pruning
* * * * * cd /var/www/laravel && php artisan schedule:run >> /dev/null 2>&1
- Ensure that Laravel scheduler command is correct
nano /var/www/laravel/app/Console/Kernel.php
- Within the schedule function, make sure it's scheduled for the period of time you'd like. For example, hourly or daily.
/** * Define the application's command schedule. */ protected function schedule(Schedule $schedule): void { $schedule->command('model:prune', ['--model' => \Enjin\Platform\Models\Laravel\Block::class])->daily(); }
Updated 2 months ago