Purpose
This guide provides instructions for setting up a development environment on Windows using WSL (Windows Subsystem for Linux) to work with GalaChain CLI, including installation of required tools and running end-to-end tests.
Procedure
Install WSL and a Linux Distribution:
Install WSL:
Open PowerShell as Administrator
Right-click on the Start menu, select "Windows PowerShell (Admin)".
Run the following command
wsl --install
This command will automatically download and install the latest version of Ubuntu from the Microsoft Store.
Restart Computer: Restart your computer when prompted.
Launch Ubuntu:
After the installation is complete, Ubuntu will launch automatically and you will be asked to enter your username and fill your password. To start it manuallt, you can launch Ubuntu from the Start menu or by typing wsl --distribution Ubuntu in the Command Prompt or PowerShell.
Set Up Ubuntu:
Create Username and Password: Upon the first launch, Ubuntu will ask you to create a username and password. Follow the on-screen instructions to set up your Ubuntu environment.
Get root privilege
For this guide, we will grant ourselves sudo (administrator) privileges.
Sudo allows users to execute commands with the privileges of another user, typically the superuser or root. However, exercise caution, as improper use of sudo can lead to unintended system changes or security vulnerabilities.
sudo su
Update and Upgrade Ubuntu:
Once inside Ubuntu, run the following commands to update the package lists and upgrade the installed packages:
apt update && apt upgrade -y
Install Node.js and npm:
Run the following commands to install Node.js and npm:
curl -fsSL https://deb.nodesource.com/setup_21.x | sudo -E bash - && apt-get install -y nodejs
Install Docker and Docker Compose:
Run the following commands to install Docker and Docker Compose:
Add Docker's official GPG key:
apt-get install ca-certificates curl && install -m 0755 -d /etc/apt/keyrings && curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc && chmod a+r /etc/apt/keyrings/docker.asc
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
tee /etc/apt/sources.list.d/docker.list > /dev/null
apt-get update && apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose docker-compose-plugin -y
Install jq & yq:
Run the following command to install jq and yq:
apt install jq -y && snap install yq
Install the GalaChain CLI:
Run the following command to install the GalaChain CLI globally:
npm install -g @gala-chain/cli
Initialize your project:
galachain init <project-name>
It will create a sample project inside <project-name> directory.
Enter into your project:
cd <project-name>
Install all dependencies
npm i
Start the Network and Run Tests:
Run the following command to start the network:
npm run network:start
Run End-to-End Tests:
Open a second prompt, enter into your project folder:
cd ~/<project-name>
Enter the following command to run end-to-end tests:
npm run test:e2e