Emma Turner
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Running the demo ## Repositories: - Visualisation: https://github.com/elevate-web3/tezos-rollup-celebration - Demo orchestrator: https://gitlab.com/tezos/tezos - branch: `emturner@demo-orchestrator` - Wasm demo: https://gitlab.com/trili/wasm-demo - branch: `emturner@ssh-orchestrator` ## Initial Setup At the start, we'll stick to ensuring everything is working locally. ### Visualisation Visualisation is split into two parts, the `collector` and the `aggregator`. The `collector` runs on the same machine as the rollup node, and scrapes the kernel's debug-log. The `aggregator` connects to every running collector, and retrieves the logs, which is then displayed as pixel-updates in the aggregator UI. #### Building To build the aggregator run the following: On Linux: ``` make build-collector-docker make build-aggregator-docker ``` On Mac: ``` brew install clojure cd clojure-front-and-aggregator make download-deps make build-prod-cljs cd .. cd collector && cargo build --release cd .. && cp collector/target/release/collector ./collector-bin ``` #### Running Add a `config.json` file in the root of the visualisation repo: ``` [ { "host": "0.0.0.0", "port": 20000, "row": 0, "column": 0 } ] ``` This tells the aggregator how to connect to any running collectors. Then create a logfile: `touch kernel-0.log`. We can then start running the collector. On linux: ``` docker run \ --name collector \ -net=host \ -v $PWD:/logs \ collector:demo \ 0 0 20000 /logs/kernel-0.log ``` On Mac: ``` ./collector-bin --log-path kernel-0.log \ --port 20000 \ --row 0 \ --col 0 ``` From a new terminal, then run the aggregator. On Linux: ``` make run-aggregator-docker ``` On Mac: ``` cd clojure-front-and-aggregator make run-aggregator ``` You should now be able to navigate to `localhost:9000` in your browser, to see the visualisation. #### Testing the visualisation There is a program to randomly generate kernel logs in the `wasm-demo` directory (under `debug_log`, or under `mockup_log` in the visualisation repo). Ensure that the aggregator & collector are running, and then run: ``` cd mockup_log cargo build --release cargo run --release -- ../kernel-0.log ``` You should now see random pixel updates in the visualisation. This may be blocky in updates, due to internal batching in the collector & aggregator. ### Kernel Messages Message generation takes place in the Wasm Demo repository. The messages are ultimately changes of pixel colours. Each block, a transition from one image to the next takes place. The images supported, should be in the `.ppm` format, and must be _2500x2000_ pixels in size (corresponding to a 15 mega-pixel image) with RGB channels only. These should be placed in the `imgs` subdirectory, and named: `0.ppm`, `1.ppm`, etc. The first `0.ppm` image should be completely black (every pixels R,G & B values set to `0`). #### Calculate image diffs Create the image diffs for each rollup by running the following: ``` cd image-diff ./generate.sh ``` This will build the `image-diff` program, and produce output in `image-diff/level*.diff` folders. #### Generating kernel messages The kernel messages are generated from the image diffs above. From the top-level of the wasm-demo repo: ``` cd account_diff_to_tx ./generate.sh ``` This will take a while... it's producing many messages. > **NB** on Mac you may have to edit the `generate.sh` file, to change > `wait -n` to `wait` ## Deploying GCP machines Navigate to `wasm-demo` repository, to the `terraform/` directory. Open the `README.md` file there, and ensure your have the requirements setup. On Mac: * Install gcloud ```bash brew install --cask google-cloud-sdk ``` * Install packer ``` brew install packer ``` * Install terraform ``` brew install terraform ``` ### Create the packer image In the wasm-demo repository. Edit the `terraform/scripts/install_script.sh` to set the [latest Mondaynet docker image](https://teztnets.xyz/mondaynet-about), and remove the custom docker image (tezos:demo) - this may be included later if a custom mondaynet image is required. This script is used by the packer build to generate the custom image. Then follow the [README instructions](https://gitlab.com/trili/wasm-demo/-/blob/main/terraform/README.md) to build the packer image. This will ouput a disk image name `custom-cos-*`, make a note of this. ### Authenticate with terraform You can login with ``` gcloud auth application-default login ``` after which you can run `terraform init` and `terraform plan`. If you run into an authentication problems because credentials cannot be parsed, you might need to modify the file `terraform/providers.tf` and remove the line `credentials=vars.gcp_credentials`. Then run `terraform init` and `terraform plan` again. Removing the `credentials` line in the `providers.tf` file will cause terraform to default to the credentials listed in `$HOME/.config/gcloud/application_default.json`, which have been initialised with the `gclooud auth application-default login` command. See more info here: https://stackoverflow.com/questions/57453468/google-cloud-credentials-with-terraform ### Create machines with terraform Before running the terraform, there are a couple of things to edit. `locals.tf`: set `source_image` to the disk image name from the [previous step](https://hackmd.io/W-_MZ45MRZ6KJW78FR5V6g?both#Create-the-packer-image). `variables.tf`: set `target_size` to the number of machines you want to deploy. Elswhere in the file, are the number of rollups/dacs per machine - you'll want the total number to match of each. There are other variables that are explained in the [README](https://gitlab.com/trili/wasm-demo/-/blob/main/terraform/README.md#variables). You then need to edit `scripts/startup_script.sh`, `scripts/startup_dac.sh`: - set the docker image to the mondaynet image. - set the mounted directory from `/home/emma` to `/home/<username>` (your current username on your localmachine). - set the ssh public key to your ssh public key Run `terraform apply` to deploy the machines. > NB please always run `terraform destroy` when you're finished with your machines!! #### Debugging You can `ssh` into machines using the gcloud command (from the google compute console, you can retrieve the ssh command). Check the correct images are running with `docker ps`, and you can see the startup script logs by running: ``` sudo journalctl -u google-startup-scripts.service ``` When you run terraform apply, you'll see an output of IP addresses. #### Setting up the aggregator In the wasm-demo repo, terraform directory Run the following to setup the aggregator: ``` ./scripts/collector-config.sh ``` > Ensure that the 'rollups_per_machine' variable in > `scripts/collector-config.sh` matches the `rollup_per_machine` in > `variables.tf`. Then copy the resulting `config.json` to the top-level of the visualisation repo. Then [run the aggregator](https://hackmd.io/W-_MZ45MRZ6KJW78FR5V6g?both#Running). It should connect to the collectors running on GCP. #### Setting up the orchestrator In the tezos repository, on the demo branch. Copy the `address` fields of the terraform output, and then go to the orchestrator `main.ml` file (src/bin_1mtps_demo_orchestrator/main.ml). Then replace the adddress variables at the top level. Replace the `ssh_id` variable with the path to your ssh key. There are some paths you will need to fix in the `Local` module to point them to the required repositories on your machine. Download the latest mondaynet snapshot - you dont need to run this everytime, as it gets updated twice a day, and the tezt orchestrator snapshots a later version everytime you run. ``` curl http://mondaynet.snapshots.s3-website.eu-central-1.amazonaws.com/mondaynet-rolling-snapshot \ --output src/bin_1mtps_demo_orchestrator/artifacts/snapshot.rolling ``` Run the demo nodes first: ``` echo nodes | dune exec src/bin_1mtps_demo_orchestrator/main.exe -- --verbose ``` Then in a different terminal you can run the dac nodes and messages! ``` echo rest | dune exec src/bin_1mtps_demo_orchestrator/main.exe -- --verbose ``` ## Running the demo Get the name of the latest *Mondaynet* docker container from [teztnets](https://teztnets.xyz/mondaynet-about). Then navigate to `src/bin_1mtps_demo_orchestrator/main.ml` in `tezos/tezos`. There are a few variables that you'll need to adjust: ``` let ssh_id = "<path to ssh key file>" let network = "<latest mondaynet network>" ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully