Production Setup

The following information will provide all the details necessary to set up an instance of ARKScan for production. Before embarking on the installation process, you will need to acquire or gain access to a Virtual Private Server (VPS). In addition, you will need to install several different components and packages onto your server before cloning the ARKScan repository and installing the required dependencies. See the requirements below and ensure that you have everything ready before proceeding further.

Information

ARKScan requires two separate databases, namely a Core database that serves data to ARKScan, and another for local storage of additional data (such as forging statistics, for instance).

Requirements

Hardware - As aforementioned, you will need to acquire a VPS in order to install ARKScan for production. Take note of the requirements specified below and ensure that your VPS is capable of running ARKScan.

Specifications RAM CPUs Information
Minimum 8GB 4 The absolute bare minimum
Recommended 16GB 8 Ensures smooth and effective data aggregation and computation
Ideal 32GB 16 Provides ARKScan and Core with ample room for spikes in resource consumption

Information

If you do not want to deal with the complexities of deployment, we recommend using Laravel Forge and Laravel Envoyer or Laravel Vapor if you prefer to go serverless and forget about scaling. Note that you will need to pay for these services, so take this into account before investigating further.

Software - You will need to install several items onto your VPS in order for ARKScan to work correctly. As such, you will need to install everything listed under Server Requirements in the official Laravel documentation - note that you will require at least PHP 8.0 and that all extensions you install will need to align with this.

In addition, you will also need to install the following items:

Help

ARKScan requires PHP 8.0 in order to run. When installing extensions, ensure that you select the appropriate version before doing so. For everything else, you should install the latest versions to avoid any unnecessary issues.

Setup

The following instructions will guide you through the setup and configuration process for a VPS. Take care to ensure that you have satisfied all the abovelisted requirements and reviewed the additional points before continuing.


Acquire Files

Clone the Repository - To begin, enter the following command to clone the ARKScan repository and wait for it to copy all the necessary files onto your VPS.

1git clone https://github.com/ArkEcosystem/explorer.git

Install Dependencies - cd into your ARKScan folder and run the relevant commands to install the necessary Composer and Yarn dependencies. Bear in mind that this process may take several minutes to complete depending on your location and/or internet connection.

1cd explorer
2composer install --ignore-platform-reqs --optimize-autoloader --no-dev
3yarn

Prepare the Application

Generate the Environment - Run the following command to create a copy of the default environment variables for ARKScan. This will generate a .env file containing some of the necessary data you will require for your production instance. Naturally you will need to configure some parameters in accordance with your unique setup, but we will cover this in Adjust Environment Variables.

1cp .env.example .env

Create a Database - As previously stated, ARKScan requires two databases, one of which is a local database for forging statistics. By default, the .env file is configured to use SQlite via the DB_CONNECTION=sqlite setting. As such, the default database file it will look for is database/database.sqlite, so create the necessary file by running touch database/database.sqlite.

Help

While SQLite will work, it is also possible to use PostgreSQL. To learn more about how to set up a PostgreSQL database, click here.


Adjust Environment Variables

Configure the Environment - You will then need to nano into your .env file and edit the parameters so that it uses both of your databases. With regards to your local database, if you created a database.sqlite file, there is no need to make any further adjustments since the default value is DB_CONNECTION=sqlite. However, if you set up a database using PostgreSQL, you will need to alter the parameters accordingly:

1DB_CONNECTION=pgsql
2DB_HOST=127.0.0.1
3DB_PORT=5432
4DB_DATABASE=<your-database-name>
5DB_USERNAME=<your-username>
6DB_PASSWORD=<your-password>

The next step involves setting the parameters for your core database - if you have not yet set up a core database, please follow the Core Setup guide before proceeding further.

You will need to fill in the necessary details for either a local connection or a PostgreSQL database. Regardless of which applies to your installation, you will use the exact same environment variables but enter in any values that apply to your particular database.

1ARKSCAN_NETWORK=production
2ARKSCAN_DB_HOST=127.0.0.1 for local, or an ip address for remote
3ARKSCAN_DB_PORT=5432
4ARKSCAN_DB_DATABASE=<your-database-name>
5ARKSCAN_DB_USERNAME=<your-username>
6ARKSCAN_DB_PASSWORD=<your-password>

In addition to the above, ensure that you set the following parameters as specified:

1APP_ENV=production
2APP_DEBUG=false

Help

For more information about the function of the APP_DEBUG= parameter, please review the Debug Mode section of the official Laravel documentation.

Finally, change these from the default file parameter:

1CACHE_DRIVER=redis
2QUEUE_CONNECTION=redis

Finalize ARKScan Setup

Generate an Application Key - Run the following command to set the APP_KEY value in your .env file.

1php artisan key:generate

Warning

If no database exists, running the php artisan key:generate command will result in an error.


Set up Your Local Database - Run the following command to set up your local database to store delegate forging statistics.

1php artisan migrate:fresh

Start Horizon - Having set up your databases, run the following command to start Horizon. Then run the second command to cache all the required data for ARKScan. Note that you should only execute the second command on the initial setup and rely on the scheduled jobs located in the Kernel.php file (located here ) thereafter.

1php artisan horizon
2php artisan explorer:cache-development-data

Help

For more information about Horizon, please review the section on Running Horizon in the official Laravel documentation. Note that you will need to have Supervisor installed and configured in order for Horizon to work as intended, otherwise errors will result.

Delegate Performance

An additional database stores missed blocks in order to derive performance metrics for delegates. These values represent the average performance levels based on data from the past 30 days. To generate them for the first time you run ARKScan, execute the command php artisan explorer:forging-stats-build --days=30.

Information

The initial calculation may take a while to run, but scheduled jobs append new values once storage of the initial 30 days has taken place.

Vote Report

You can create a vote report text file by executing the explorer:generate-vote-report command. By default, this process runs every 5 minutes.


Conducting a Preliminary Check

Before attempting to setup Nginx, check that ARKScan is working correctly by running php artisan serve --host 0.0.0.0. This will make it available on the server’s IP via port 8000, meaning you can connect directly to it by entering http://<your-server-ip>:8000 in your browser. If ARKScan runs as intended, then any further issues that may occur will relate to Nginx rather than something else in your configuration.


Configure Your Web Server

The final step in the Production setup entails configuring your web server for ARKScan. As such, we use and recommend Nginx - follow the example under Server Configuration in the official Laravel documentation to set up Nginx.

Once you have completed the setup, you can navigate to your instance of ARKScan by entering in http://<your-server-ip>. Alternatively, if you set up a domain, navigate to http://<your-domain-name> and view your instance of ARKScan there.

Information

You can also configure your web server using Apache instead. However, the guide and process for this is not covered in our documentation. Consult the relevant resources if you wish to use Apache for your setup.

Last updated 2 years ago
Edit Page
Share: