Docker Setup

The following guide will provide all the details necessary to set up an instance of ARKScan for Docker. Ideally, developers should have experience working with containerization platforms such as Docker, AWS Fargate and Microsoft Azure. Take note that you can easily access ARKScan images via Docker Hub .

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

In order to successfully carry out an installation of ARKScan using Docker, you will need to download and install the following before proceeding further:

Attention

The minimum supported version of Docker is 20.10.x.

Setup

Follow the steps provided below in order to set up ARKScan with Docker. Ensure that you have all your credentials readily available as you will need these when configuring your environment.


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 system.

1git clone https://github.com/ArdentHQ/arkscan.git

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 Docker 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

Adjust Environment Variables

Configure the Environment - Navigate to your .env file and edit the following variables accordingly.

1APP_NAME=<your-arkscan-title>
2APP_URL=http://<your-domain>
3 
4ARKSCAN_NETWORK=production
5ARKSCAN_DB_HOST=<your-core-database-ip-address>
6ARKSCAN_DB_PORT=<your-core-database-port>
7ARKSCAN_DB_DATABASE=<your-core-database-name>
8ARKSCAN_DB_USERNAME=<your-core-database-username>
9ARKSCAN_DB_PASSWORD=<your-core-database-password>

Information

You should leave all other parameters at their default values. Adjusting any of these without the requisite knowledge will lead to a failed installation or issues with your Docker instance. Furthermore, when making use of a database that runs on the Docker host (such as a local machine or server), you may use the ARKSCAN_DB_HOST=host.docker.internal parameter to proxy calls from the Docker container to the host.


Run ARKScan (Official ARKScan Image)

The following command will pull the latest ARKScan image from Docker Hub and run the arkscan container.

1cd docker
2docker-compose up -d

Build and Run ARKScan (Build Yourself a Local Image)

Should you wish to build yourself a local image of ARKScan, run the following commands.

1cd docker
2docker-compose -f docker-compose-build.yml up -d

Success

If your build is successful, Creating arkscan ... done will appear.


Make Sure ARKScan is ‘Up’

The initial container startup should take two to three minutes for all the dependencies to install and setup to complete. Following this, you can monitor logs by executing the following command.

1docker logs --tail 50 -f arkscan

A successful startup will produce similar log entries to those detailed below.

1INFO success: nginx entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2INFO success: php-fpm entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
3INFO success: redis entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
4INFO success: horizon entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
5INFO success: short-schedule entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

Access ARKScan

After successfully carrying out a container startup, you can access ARKScan via http://localhost:8898 or http://<your-host-ip>:8898.

Help

If you want to start from scratch, run bash purge_all.sh.

Production Deployment and Zero Downtime Updates

If you wish to use Docker for production purposes and update your ARKScan instance without any downtime, follow the guide below that outlines how to proceed.

Blue/Green Deployment Approach

By making use of Traefik , a reverse proxy server with native Let’s Encrypt SSL support, (including automated certificate requests and renewal), you can easily deploy ARKScan and run updates without having to sacrifice any uptime. Using the Blue/Green Deployment Approach maximizes efficiency and allows you to manage your ARKScan instance much more easily.


Prepare ARKScan

Information

It is necessary to have the ARKScan repository available locally since it is mounted in the container as a volume.

Clone Repository for Initial Deployment - Using this approach, you will clone the repository as per normal but use a local folder titled arkscan-green this time around. Try to stick to the naming conventions contained within this guide as it will ensure the deployment process occurs without any errors.

1git clone https://github.com/ArdentHQ/arkscan.git arkscan-green

Generate the Environment - cd into your arkscan-green folder and run the command to create a copy of the default environment variables for ARKScan. Once again, this will generate a .env file containing some of the necessary data you will require for your ARKScan instance.

1cd ~/arkscan-green
2cp .env.prod .env

Configure the Environment - Open the .env file and edit the parameters as follows.

1APP_NAME=<your-arkscan-title>
2APP_URL=https://<your-domain>
3 
4ARKSCAN_NETWORK=production
5ARKSCAN_DB_HOST=<your-core-database-ip-address>
6ARKSCAN_DB_PORT=<your-core-database-port>
7ARKSCAN_DB_DATABASE=<your-core-database-name>
8ARKSCAN_DB_USERNAME=<your-core-database-username>
9ARKSCAN_DB_PASSWORD=<your-core-database-password>

You will also need to create a DNS A record that points to your ARKScan instance’s public IP address (For example, arkscan.your-domain.com).

Attention

For Cloudflare users, in order to ensure a successful SSL certificate request procedure, please disable host protection/proxy during initial deployment. You may re-enable it once your ARKScan instance is up and running.


Prepare Docker

Adjust Docker Environment - Open the docker/production/prod.env file and edit the following variables.

2DOMAIN=arkscan.your-domain.com

Deploy Containers - cd into your docker/production folder and run the subsequent command to deploy your instance of ARKScan.

1cd docker/production
2bash deploy-prod.sh

This will pull and run two containers:

traefik_traefik_1
This is the reverse proxy that forwards http/https requests to the domain you added as a DNS record designated A (as well as the DOMAIN parameter in your docker/production/prod.env file) to the internal ARKScan container.
green_arkscan_1
This is the internal ARKScan container that will trigger the reverse proxy to create an SSL certificate request to 'Let's Encrypt' and install it upon receiving it. The ARKScan setup will then commence within the container. Please note that this may take around 2-3 minutes to complete, so please wait for the script to fully execute before proceeding further.

If successful, you can access your instance of ARKScan via https://arkscan.your-domain.com (Note that http gets redirected to https).

Zero Downtime Updates

Information

In order to ensure the update process occur without errors, all subsequent updates require cloning the repo into a new location following the naming convention arkscan-blue or arkscan-green.

Clone Repository for Update - Since you cloned the repo into arkscan-green during your initial deployment, you will clone your first update into arkscan-blue. In addition, you will also copy all of your .env settings (that is, both your .env file and the docker/production/prod.env file) from the initial deployment folder instead of adding them from scratch. Run the commands as follows.

1cd ~
2git clone https://github.com/ArdentHQ/arkscan.git arkscan-blue
3cd ~/arkscan-blue/docker/production
4cp -f ~/arkscan-green/.env ~/arkscan-blue/.env
5cp -f ~/arkscan-green/docker/production/prod.env ~/arkscan-blue/docker/production/prod.env

Deploy Containers - Run the following command to pull and run a new ARKScan container called blue_arkscan_1 which will follow a similar deployment process as the initial deployment.

1bash deploy-prod.sh

Success

After successful deployment, the script will remove your old ARKScan container (namely green_arkscan_1) and notify you that it is now safe to remove your previous source folder ~/arkscan-green. Consequently, during the update process, you should not experience any ARKScan downtime as the reverse proxy should handle the proper distribution of the traffic.


Subsequent Updates

You should carry out any further updates using the approach outlined above - remember to preserve the local source folder naming conventions as described earlier in this guide. Logically speaking, your next update will require you to clone the repo into the ~/arkscan-green folder.

1cd ~
2rm -rf ~/arkscan-green
3git clone https://github.com/ArdentHQ/arkscan.git arkscan-green
4cd ~/arkscan-green/docker/production
5cp -f ~/arkscan-blue/.env ~/arkscan-green/.env
6cp -f ~/arkscan-blue/docker/production/prod.env ~/arkscan-green/docker/production/prod.env
7bash deploy-prod.sh
Last updated 2 years ago
Edit Page
Share: