Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/orch dapp walkthrough documentation #1169

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

Jovonni
Copy link
Contributor

@Jovonni Jovonni commented Aug 6, 2024

documentation for orchestration-basics walkthrough:

  • contract
  • ui
  • installation
  • testing

@Jovonni Jovonni requested a review from amessbee August 6, 2024 14:09
@Jovonni Jovonni self-assigned this Aug 6, 2024
Copy link

cloudflare-workers-and-pages bot commented Aug 6, 2024

Deploying documentation with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5319631
Status: ✅  Deploy successful!
Preview URL: https://d0034bb0.documentation-7tp.pages.dev
Branch Preview URL: https://dev-orch-dapp-walkthrough.documentation-7tp.pages.dev

View logs

Copy link

github-actions bot commented Aug 6, 2024

Cloudflare deployment logs are available here

## Troubleshooting Docker
During setting up the environment, you may run into a few issues with docker. Here are two common setup requirements.

### Disable Kubernetes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we have to enable it, not disable it. That's what I had to do.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, we should recommend somewhere to click the "reset k8s cluster" button before spinning it up

<img src="../../assets/docker-kube.png" width="100%" />

### Increasing resources allocated to docker
From inside of "settings", navigate to the "Resources" section. By default docker doesn't optimize the resources allocated for running resource-intensive environments. For this environment, we want to ensure our `CPU limit`, `Memory Limit`, and `Swap` are all bumped up to 75% their max. You can always increase/decrease after you get everything setup, and determine how much resources are needed for your machine.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the % depends on your machine. For me, 10GB memory worked, while 8GB did not. My swap was at 1GB in both cases.

Copy link
Member

@mujahidkay mujahidkay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed this by following the guide myself and ran into a few confusions. Couldn't go past a point in the docs (mentioned below) so this only a partial review up till that point.

**Check Agoric Daemon Status**
Verify that the Agoric daemon is running with the following command:
```bash
agd status
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Neither the agoric-sdk README nor anywhere here do we mention anything remotely related to setting up the agd CLI. I followed the steps in this doc to set it up

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mujahidkay and I wrote it in this document after learning it firsthand from @Jovonni :-)
But you are right this needs to go somewhere. Maybe @mujahidkay can find an appropriate place in docs to insert this information, and then we can link it here?

Run the following commands from the `agoric-sdk/multichain-testing/` directory:

```bash
make override-chain-registry
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to make the following change in the Makefile to make this command work. We need to update a few things in the README over at agoric-sdk/multichain-testing
image

**Restart the Environment**
If you need to restart your environment for any reason, use the following command from `agoric-sdk/multichain-testing`:
```bash
make teardown ; make stop; make stop-forward; make clean; make; make port-forward
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a) targets are run sequentially afaik so we can use it like this

Suggested change
make teardown ; make stop; make stop-forward; make clean; make; make port-forward
make teardown stop stop-forward clean setup port-forward

b) better yet, thoughts on adding a restart target in the Makefile helpers above?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense to me.

During setting up the environment, you may run into a few issues with docker. Here are two common setup requirements.

### Enabling Kubernetes
Inside of "settings", navigate to the "kubernetes" section. Here, you want to ensure that you select the "Enable Kubernetes" checkbox. You will have to restart docker to make these changes take effect. This is something to keep this in mind if you have any containers that are currently running.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Inside of "settings", navigate to the "kubernetes" section. Here, you want to ensure that you select the "Enable Kubernetes" checkbox. You will have to restart docker to make these changes take effect. This is something to keep this in mind if you have any containers that are currently running.
Inside of "Settings", navigate to the "Kubernetes" section. Here, you want to ensure that you select the "Enable Kubernetes" checkbox. You will have to restart docker to make these changes take effect. This is something to keep in mind if you have any containers that are currently running.

<img src="../../assets/docker-kube.png" width="100%" />

### Increasing resources allocated to docker
From inside of "settings", navigate to the "Resources" section. By default docker doesn't optimize the resources allocated for running resource-intensive environments. For this environment, we want to ensure our `CPU limit`, `Memory Limit`, and `Swap` are all bumped up to 75% their max. You can always increase/decrease after you get everything setup, and determine how much resources are needed for your machine.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also think this number will be different for different people. I had to bump up my memory to 15GB for the pods to be up and running under 15 minutes.

Suggested change
From inside of "settings", navigate to the "Resources" section. By default docker doesn't optimize the resources allocated for running resource-intensive environments. For this environment, we want to ensure our `CPU limit`, `Memory Limit`, and `Swap` are all bumped up to 75% their max. You can always increase/decrease after you get everything setup, and determine how much resources are needed for your machine.
From inside of "Settings", navigate to the "Resources" section. By default, docker doesn't optimize the resources allocated for running resource-intensive environments. For this environment, we want to ensure our `CPU limit`, `Memory Limit`, and `Swap` are all bumped up to 75% their max. You can always increase/decrease after you get everything setup, and determine how much resources are needed for your machine.

Comment on lines +128 to +134
Before deploying the contract, we want to generate a new address using the keyring inside of the localchain environment. To add a new address to the keychain inside the Kubernetes pod, run the following command from the top-level directory:

```bash
make add-address
```

Now, inside of `contract/`, paste the resulting `agoric1` prefixed address into the `Makefile` under the `ADDR`variable.
Copy link
Member

@mujahidkay mujahidkay Aug 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is very confusing due to the last line. My initial thoughts were that we need to run make add-address in dapp-orchestration-basics root workspace but the absence of a Makefile there redirected me to consider agoric-sdk folder since it says top-level directory. But that's not the case either. We can make the following changes to clear up that confusion. Also, note that there is no ADDR variable in that Makefile - did you mean ACCT_ADDR?

Edit: I was using the wrong branch to test the setup.

Comment on lines +138 to +142
To now fund the account we just generated, we run the following command from the top-level directory.

```bash
make fund
```
Copy link
Member

@mujahidkay mujahidkay Aug 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am unable to proceed past this step. Which Makefile has this fund target? I can only see fund-wallet under multichain-testing and fund-acct under dapp-orchestration-basics/contract

Edit: I was using the wrong branch to test the setup. orca-v1 does have the targets, thanks @amessbee for unblocking!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good q @mujahidkay , this is from dapp-orchestration-basics top-level directory:
https://github.com/Agoric/dapp-orchestration-basics/blob/d43ebe67012a85ac404d76687bf91f9571b10594/Makefile#L9

which is just calling:

yarn workspace  dapp-agoric-orca-contract fund

which then just calls the fund as convenience:
https://github.com/Agoric/dapp-orchestration-basics/blob/d43ebe67012a85ac404d76687bf91f9571b10594/contract/package.json#L26

Copy link
Contributor

@amessbee amessbee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added few general comments but great work man - kudos!

# Agoric Orchestration Basics Installation Guide
Here, we will walk through installing the Orchestration-Basics demo project onto your local machine.

## Table of Contents
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, remove this table as there is a default one in the right side panel? What do you think?

- an Osmosis node
- an Agoric <-> Gaia hermes relayer
- an Agoric <-> Osmosis hermes relayer

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- a Gaia <-> Osmosis hermes relayer
- chain registry node

```

## Multichain-Testing Makefile Helpers
To streamline your workflow, you can add the following commands to the bottom of your `multichain-testing/Makefile`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be a PR in agoric-sdk to update Makefile there rather than asking devs to do it locally?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally yes. we did capture it in this issue here @amessbee:
Agoric/agoric-sdk#9856

make teardown ; make stop; make stop-forward; make clean; make; make port-forward
```

## Troubleshooting Docker
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is absolutely necessary - thanks for doing this!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably have a separate page for troubleshooting and not just for Docker, that can be updated more frequently than this page? What are your thoughts on this? @Jovonni

<img src="../../assets/docker-resources.png" width="100%" />


## Adding a New Address
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A line or two about the reasoning behind would be very appreciated by devs IMO. To answer questions like: why are we doing this? what/where is this new address needed for?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants