Configuring Telescope on PC
Published: 2020-11-07 20:33:45

0. Background:
My laptop has AMD Ryzen 7 4800H CPU, 2x8 G DDR4 memory,  and NVIDIA GTX 1660 Ti graphic card. The version of my Windows 10 is 1909 (OS Build 18363.1139).

1. Initial Excitement:
	Prior to jumping right into the installations and configurations of Seneca’s Telescope, I went over the instruction for the environment setup(https://github.com/Seneca-CDOT/telescope/blob/master/docs/environment-setup.md) and was very glad to see that I could accomplish the task by using Windows Subsystem Linux (WSL2). It is a widely known fact that the virtualisation feature of Windows 10 should be turned in order to install Ubuntu. 


2. The Pain:
	I religiously followed the instructions until I got stuck at downloading Ubuntu for WSL. It took me some time to enable the previously disable Windows Store app on my laptop. 
	2.1 Reinstall MS Store:
	Press Windows key + X
	Click Windows PowerShell (Admin)
	At the command prompt, type the following then hit Enter:
```     
Get-AppXPackage *WindowsStore* -AllUsers | Foreach {Add-AppxPackage -	DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
```

The pain started when I was trying to download Ubuntu and Ubuntu 20.04LTS within Windows Store. Microsoft requires me to register in order to finish and install the above software. Begrudgingly I finished the registration. The downloading processes of the two software either move at the speed of 8k per second and periodically hang up. I had to repeatedly use WSReset.exe to reset Windows Store and clean its cache. After multiple days’ attempt, my journey reached the point the OS keeps telling me that 
	
“WslRegisterDistribution failed with error: 0x80370102
Error: 0x80370102 The virtual machine could not be started               because a required feature is not installed.”   

After another day of Google search solutions, I came to realization that using WSL2 to install Telescope was not a viable solution especially there existed even more technical issues to solve. 


3. Alternative Solution:
	Having to give up all the work I have done, I utilized VirtualBox to run Ubuntu. This method is a much stress-free option. There is only one confusion that caused half-day delay.

In the instructions, that titled as “After installing the prerequisites:”, the instruction reads
“In the root directory, run cp env.example .env on Linux/Mac or copy env.example .env.”
I went to the root of Ubuntu and made a .env file there. After hours of attempt, I realized the instruction means the top level directory of Telescope rather than the root of Ubuntu. After solving the issue, everything is run as told.  

The following is issues I came across and how to solve them:

1. Failed to check elasticsearch
```
curl http://localhost:9200
curl: (7) Failed to connect to localhost port 9200: Connection refused
```
then:
```
	sudo systemctl restart elasticsearch
	curl http://localhost:9200

{
"name" : "bpan2-VirtualBox",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "ZFKMgmlMT_Sg5poO5IwHiw",
"version" : {
         "number" : "7.6.2",
         "build_flavor" : "default",
         "build_type" : "deb",
         "build_hash" : f48eb35cf30adf4db14086e8aabd07ef6fb113f",
         "build_date" : "2020-03-26T06:34:37.794943Z",
         "build_snapshot" : false,
         "lucene_version" : "8.4.0",
         "minimum_wire_compatibility_version" : "6.8.0",
         "minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
```
then:

```
curl http://localhost:9200/_cluster/health?pretty
{
  "cluster_name" : "elasticsearch",
  "status" : "green",
  "timed_out" : false,
  "number_of_nodes" : 1,
  "number_of_data_nodes" : 1,
  "active_primary_shards" : 3,
  "active_shards" : 3,
  "relocating_shards" : 0,
  "initializing_shards" : 0,
  "unassigned_shards" : 0,
  "delayed_unassigned_shards" : 0,
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 100.0
}
```
2. issues when running npm start:
	2.1. Error: Cannot find module 'dotenv'
	
        npm install dotenv
       
	2.2. Error: Cannot find module 'pino'

	npm install pino

	2.3. Error: Cannot find module 'express-pino-logger'
	npm i express-pino-logger --save

	2.4. Error: Missing `pino-pretty` module: `pino-pretty` must be installed separately
	npm install -g pino-pretty

3. issues when running npm run develop:
	3.1. gatsby: not found
        npm install

	3.2. install Passport:
	npm install passport