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

Add more details to the Holochain upgrade guide #426

Merged
merged 10 commits into from
Feb 21, 2024

Conversation

ThetaSinner
Copy link
Member

No description provided.

Copy link
Member

@steveej steveej left a comment

Choose a reason for hiding this comment

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

thanks, i'm sure this will help lots of devs. i added some non-critical suggestions.

src/pages/get-started/upgrade-holochain.md Outdated Show resolved Hide resolved
src/pages/get-started/upgrade-holochain.md Show resolved Hide resolved

### Update Cargo dependencies

This section is harder to write a general guide for because it's common for hApps to add dependencies on other Holochain crates. If you have added other dependencies than the `hdi` and `hdk` to your project then you will need to update those too but figuring out which versions you
Copy link
Member

Choose a reason for hiding this comment

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

i like this honest preface

src/pages/get-started/upgrade-holochain.md Show resolved Hide resolved
src/pages/get-started/upgrade-holochain.md Outdated Show resolved Hide resolved
Co-authored-by: Stefan Junker <1181362+steveej@users.noreply.github.com>
Copy link

@c12i c12i left a comment

Choose a reason for hiding this comment

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

Great documentation and very easy to follow

Something to consider though, the package.json scripts in 0.1 and 0.2 vary with regards to calling hc run-local-services in the launch script which was not done before in 0.1. Running this command also requires that BOOTSTRAP_PORT and SIGNAL_PORT are set in the start script so that they are referenced in the launch script

Here is an example

0.1:

  "scripts": {
    "start": "AGENTS=2 npm run network",
    "network": "hc s clean && npm run build:happ && UI_PORT=8888 concurrently \"npm start -w ui\" \"npm run launch:happ\" \"holochain-playground\"",
    "test": "npm run build:zomes && hc app pack workdir --recursive && npm t -w tests",
    "launch:happ": "hc-spin -n $AGENTS --ui-port $UI_PORT workdir/{{app_name}}.happ",
    "start:tauri": "AGENTS=2 npm run network:tauri",
    "network:tauri": "hc s clean && npm run build:happ && UI_PORT=8888 concurrently \"npm start -w ui\" \"npm run launch:tauri\" \"holochain-playground\"",
    "launch:tauri": "echo \"pass\" | RUST_LOG=warn hc launch --piped -n $AGENTS workdir/{{app_name}}.happ --ui-port $UI_PORT network mdns",
    "package": "npm run build:happ && npm run package -w ui && hc web-app pack workdir --recursive",
    "build:happ": "npm run build:zomes && hc app pack workdir --recursive",
    "build:zomes": "RUSTFLAGS='' CARGO_TARGET_DIR=target cargo build --release --target wasm32-unknown-unknown"
  }

0.2

  "scripts": {
    "start": "AGENTS=2 BOOTSTRAP_PORT=$(port) SIGNAL_PORT=$(port) npm run network",
    "network": "hc s clean && npm run build:happ && UI_PORT=8888 concurrently \"npm start -w ui\" \"npm run launch:happ\" \"holochain-playground\"",
    "test": "npm run build:zomes && hc app pack workdir --recursive && npm t -w tests",
    "launch:happ": "hc-spin -n $AGENTS --ui-port $UI_PORT workdir/{{app_name}}.happ",
    "start:tauri": "AGENTS=2 BOOTSTRAP_PORT=$(port) SIGNAL_PORT=$(port) npm run network:tauri",
    "network:tauri": "hc s clean && npm run build:happ && UI_PORT=8888 concurrently \"npm start -w ui\" \"npm run launch:tauri\" \"holochain-playground\"",
    "launch:tauri": "concurrently \"hc run-local-services --bootstrap-port $BOOTSTRAP_PORT --signal-port $SIGNAL_PORT\" \"echo pass | RUST_LOG=warn hc launch --piped -n $AGENTS workdir/{{app_name}}.happ --ui-port $UI_PORT network --bootstrap http://127.0.0.1:\"$BOOTSTRAP_PORT\" webrtc ws://127.0.0.1:\"$SIGNAL_PORT\"\"",
    "package": "npm run build:happ && npm run package -w ui && hc web-app pack workdir --recursive",
    "build:happ": "npm run build:zomes && hc app pack workdir --recursive",
    "build:zomes": "RUSTFLAGS='' CARGO_TARGET_DIR=target cargo build --release --target wasm32-unknown-unknown"
  }

I am not sure whether excluding hc run-local-services will have any effect in running the happ though

Co-authored-by: Stefan Junker <1181362+steveej@users.noreply.github.com>
@ThetaSinner
Copy link
Member Author

Hmm, that's an interesting one @c12i, when I scaffolded today I got a project that has hc-spin in for launching apps which wasn't the case for most people scaffolding a project - so documenting the diff in the package.json is going to be tricky...

I wonder if it's worth suggesting that people scaffold a project using 0.2 and diff it against their project to see if there are other changes they want? For example this project looks like it might have started from the scaffolding but has diverged quite a bit on scripts so it'd be hard to advise them what to do about resolving differences

@ThetaSinner
Copy link
Member Author

One more thing that might be worth mentioning actually is the Node.js upgrade. People will be on 18 but should ideally move to 20

@ThetaSinner
Copy link
Member Author

Added Node.js instructions

@ThetaSinner
Copy link
Member Author

Or actually @c12i, maybe I just scaffold a 0.2 app and include the scripts in this doc? Then people can diff against it with a bit less work... that does mean that future updates to the scripts will be missed but it might be a helpful way to get the initial move from 0.1 to 0.2 done smoothly

@c12i
Copy link

c12i commented Feb 20, 2024

I got a project that has hc-spin in for launching apps which wasn't the case for most people scaffolding a project

Yep this is a very recent change, I assume older happs on 0.1 will still be relying on hc launch to launch their apps, this version doesn't require hc run-local-services to be called.

Documenting the diff will be tricky indeed, I think what I can suggest would be to add hc-spin as a dev dependency and update the launch script to move away from hc launch to hc-spin like so hc-spin -n $AGENTS --ui-port $UI_PORT workdir/{{app_name}}.happ

@ThetaSinner
Copy link
Member Author

Cool, I'll give that a go and see what you think :)

@c12i
Copy link

c12i commented Feb 20, 2024

Should have mentioned the version of hc-spin to use with 0.2 btw, here it is ^0.200.10

@ThetaSinner
Copy link
Member Author

I can update that, but the command I'm giving will install the latest version of 0.2000.x for hc-spin, I'm trying to make as few of the commands as I can require thought from the user about what to change

Copy link

@c12i c12i left a comment

Choose a reason for hiding this comment

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

looking good now 👍🏽

@ThetaSinner ThetaSinner merged commit 9ef093a into main Feb 21, 2024
6 checks passed
@ThetaSinner ThetaSinner deleted the more-details-in-holochain-upgrade-guide branch February 21, 2024 11:36
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