golemcloud / golem

Golem is an open source durable computing platform that makes it easy to build and deploy highly reliable distributed systems.
https://learn.golem.cloud/
Apache License 2.0
530 stars 59 forks source link

Submission for #1004 Bounty Claim #1033

Closed anchalshivank closed 3 weeks ago

anchalshivank commented 3 weeks ago

/resolve #1004 /claim #1004

Features

Note: The remaining tasks are currently in progress.

anchalshivank commented 3 weeks ago

Documentation


Step 1: Initialize Golem Environment

Ensure you have two mandatory folders, read-only and read-write, in your directory. The golem-cli will scan these to create the configuration file.

Command:

golem-cli init

Output:

Config file created

Explanation: The init command sets up the initial Golem configuration, generating a golem.yaml file. This file is essential for linking components and configuring further operations like adding or updating components.


Step 2: Reinitialize Component Configuration

Use the re-init command to refresh the YAML file if there are changes in the folder structure.

Command:

golem-cli component re-init

Output:

Config file created

Step 3: Add a New Component

To add a component, compress the read-write, read-only, and golem.yaml files into a single zip (e.g., ifs.zip), which will be stored on the backend.

Command:

golem-cli component add --component-name golem_cloud out/comp_a.wasm

Output:

{
  "componentUrn": "urn:component:59039a00-30db-4b73-85e6-4c9f2a293e92",
  "componentVersion": 0,
  "componentName": "golem_cloud",
  "componentSize": 2946151,
  "createdAt": "2024-10-29T20:59:23.287340467Z",
  "exports": [
    "golem:component/api.{initialize-cart}(user-id: string)",
    "golem:component/api.{add-item}(item: record { product-id: string, name: string, price: float32, quantity: u32 })",
    "golem:component/api.{remove-item}(product-id: string)",
    "golem:component/api.{update-item-quantity}(product-id: string, quantity: u32)",
    "golem:component/api.{checkout}() -> variant { error(string), success(record { order-id: string }) }",
    "golem:component/api.{get-cart-contents}() -> list<record { product-id: string, name: string, price: float32, quantity: u32 }>"
  ]
}

Step 4: Update the Component

Use the update command to update the component configuration in the backend. This does not affect the worker’s IFS, which is not implemented yet.

Command:

golem-cli component update --component-name golem_cloud out/comp_a.wasm

Output:

{
  "componentUrn": "urn:component:59039a00-30db-4b73-85e6-4c9f2a293e92",
  "componentVersion": 1,
  "componentName": "golem_cloud",
  "componentSize": 2946151,
  "createdAt": "2024-10-29T21:01:51.565224247Z",
  "exports": [
    "golem:component/api.{initialize-cart}(user-id: string)",
    "golem:component/api.{add-item}(item: record { product-id: string, name: string, price: float32, quantity: u32 })",
    "golem:component/api.{remove-item}(product-id: string)",
    "golem:component/api.{update-item-quantity}(product-id: string, quantity: u32)",
    "golem:component/api.{checkout}() -> variant { error(string), success(record { order-id: string }) }",
    "golem:component/api.{get-cart-contents}() -> list<record { product-id: string, name: string, price: float32, quantity: u32 }>"
  ]
}

Visual Examples

Screenshot of Golem CLI initialization and add component Screenshot of Golem CLI update component


Worker API

The Worker API allows you to explore the IFS directory for any worker and download specific files by clicking on them.

Screenshot from 2024-10-30 02-49-35

jdegoes commented 3 weeks ago

@anchalshivank Congratulations on submitting your solution for our Bounty-to-Hire challenge (#1004)!

We have reviewed your pull request. While you have made some progress toward #1004, there is still so much work left to do, and existing work that needs to be restructured, that we have decided you will not be progressing to the next phase.

At this point, we wish to thank you for your work on this open source project, and your participation in the challenge, and encourage you to keep an eye on future bounties, which your work in this one has prepared you for.

Congratulations again on being one of our contestants and putting so much effort into your work!