Lamden Setup on Windows
Performing development on Windows can sometimes be tricky. Nix based operating systems have a build in C++ compilers and Windows does not. Some Lamden developers have exprienced issues because of this. Additionally, many of the tools and programs come preinstalled on Linux like Python and Git!
Luckily Microsoft has a solution! Windows Subsystem for Linux. Which is basically a Linux virtual machine that you access through terminal. There is no GUI, but some really nice tools Visual Studio Code can reach inside WLS and it is like you are developing natively on Windows.
Prequisites
- Must be running Windows 10
Installation Guide
- Install and configure WSL (Windows Subsystem for Linux) 2
- Choose Unbuntu as the Linux distribution 20.04
- Install Visual Studio Code (VS Code)
- Install the VS Code WSL Extenstion
- Install the VS Code Python Extenstion
- Download and install the Linux kernel update package
- Install Docker
- Follow the Docker WLS 2 Backend guide,*Note: The prerequisites were completed in the above steps
- Open a terminal:
Start > Ubuntu
- Run
docker run -d -p 27017:27017/tcp --name mongodb mongo:latest
to create and start a Docker containter for Mongo DB (in the future you can delete this containter and use this command to reset the database or change the name--name
argument to create multiple containers for different projects) - Create a mongo db startup script
- Run
echo "docker start mongodb" > ~/startmongo.sh
- Run
chmod 755 ~/startmongo.sh
to grant execute permissions - Run
pip3 install contracting
to install the Lamden Contracting Python Library
Usage
- Open a terminal:
Start > Ubuntu
- Run
~/startmongo.sh
to start mongo in Docker from Ubuntu if the 'mongodb' Docker containter is not running - Run
cd ~
to change directory to your home directory - Clone the repo using
git clone https://github.com/JeffWScott/my_token_lamden_tutorial.git
- Run
code my_token_lamden_tutorial
to open the tutorial folder in VS Code 1 Under theserver
folder selectcontracting_server.py
and in the top right corner hit the play button - The results should be something like below in the termimal window:
[email protected]:~/my_token_lamden_tutorial$ /usr/bin/python3 /home/onlyluck/my_token_lamden_tutorial/server/contracting_server.py
[2020-09-24 00:23:50 -0400] [1990] [INFO] Goin' Fast @ http://0.0.0.0:3737
[2020-09-24 00:23:50 -0400] [1990] [INFO] Starting worker [1990]
- Open http://localhost:3737/contracts and if everything is working you should see:
{"contracts":["submission","my_token"]}