3. Running Flan in local

Running Flan project in your local machine.

Creating your Golem Virtual Machine

This step is only necessary if you want to create a new Golem VM, if no you can still use the once already pushed to Golem using the hash present in the flan-api project.

First let's open a console and locate it into the flan-docker project folder, to build and publish a docker image:

# Let's locate in the flan-docker folder
cd packages/flan-docker

# Build docker vm
docker build -t nestorbonilla/flan-image .

# Push vm to docker hub
docker push nestorbonilla/flan-image

Once we have our Docker image in docker hub, let's convert it to a golem VM:

# First time wil compile a new vm image
gvmkit-build nestorbonilla/flan-image:latest --push

# Second time will push the vm image to golem
gvmkit-build nestorbonilla/flan-image:latest --push

The result of the last command will be the hash of the Golem VM, and you will need to use it to refer to your VM in your implementation.

Run Flan project

Flan contains three separate projects:

  • flan-api

  • flan-docker

  • flan-app

We already used flan-docker to publish our own Golem VM, now let's run the other two to interact with our app.

# let's install dependencies
yarn install

# run flan-app
yarn start

# run flan-api
yarn golem

Running Yagna Daemon

If you have not installed Yagna, you should follow the instructions of the following link before continue.

To run in local we will need to send our tasks to Golem via through a Yagna daemon. For this we will need to have two consoles:

CONSOLE 1
# run yagna daemon
yagna service run
CONSOLE 2
# removes previous account data
rm -rf $HOME/Library/Application\ Support/GolemFactory.yagna

# check there's no accounts
yagna app-key list

# generates a new requestor account
yagna app-key create requestor

# export required environment variable with the generated account
export YAGNA_APPKEY=insert-your-32-char-app-key-here

# fauce funds for the created account
yagna payment init -r
yagna payment init -r --driver=NGNT

# verify funds
yagna payment status

Before running Yagna service I recommend clean previous account data.

Send tasks to Golem Virtual Machine

Now we're ready to send our tasks to Golem, so open our browser and go to:

Here we just need to select our parameters:

  • first year

  • last year

  • country

  • count

Then click on the button "Calculate with Golem", and now let's wait for Golem to distribute the task and execute it. Once it concludes you should see a new plot image that represents a BCG Growth-Share Matrix of the selected country between the years you have chosen. This will helps entrepreneurs to have a recommendation on what sector do they would need to research more if they want to start a new initiative, all this based on all the exports and imports happening worldwide compared with the current country, such a deal!

Thanks for reaching the end! 🙌🏻

Last updated