Skip to content

Commit d0047dd

Browse files
authored
Merge pull request #374 from weswalla/update/v0.5.0
Update/v0.5.0
2 parents c37dad5 + 849b15d commit d0047dd

File tree

94 files changed

+6809
-3476
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+6809
-3476
lines changed

DEVELOPERS.md

Lines changed: 31 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,136 +1,60 @@
11
## Developers
22

3-
### Managing Dependencies for Developing Acorn
3+
This is a monorepo that includes the frontend and backend code for Acorn. All zomes and rust crates are contained in this repo. The main zome code is in `./happs/happ` where a widely used rust crate `hdk_crud` has been moved to `./happs/lib` for easier maintenance.
44

5-
There are several cargo and holochain dependencies you need to manage when you change any of the holochain aspects of Acorn:
5+
Note, there are two build targets and thus two development modes:
66

7-
- [`holochain-runner`](https://github.com/lightningrodlabs/holochain-runner)
8-
- a rust binary that bundles a preconfigured conductor to simplify the app packaging process.
9-
- [`electron-holochain`](https://github.com/lightningrodlabs/electron-holochain)
10-
- an electron template which includes `holochain-runner`, meant to reduce boilerplate around building desktop happs. All that's required are the UI and `.happ` files.
11-
- [`hdk_crud`](https://github.com/lightningrodlabs/hdk_crud)
12-
- a generic zome utility crate for defining entry types and automatically generating CRUD for each of them. Used by `acorn-happ`.
13-
- [`acorn-happ`](https://github.com/lightningrodlabs/acorn-happ)
14-
- all of the zome logic lives here. Uses `hdk_crud` to define all the Acorn entry types, like outcomes, edges, etc.
7+
- Acorn Desktop (app packaging is currently managed by a separate repo [acorn-desktop](https://github.com/lightningrodlabs/acorn-desktop))
8+
- Acorn Moss Tool
159

16-
### Building the frontend
10+
## setup
1711

18-
There are two build targets:
12+
- you must have nix installed, then run `nix develop` at the root. This will setup a nix shell environment with all the required environment packages (holochain, node, etc)
13+
- run `yarn install`
14+
- build the happs by running `yarn run pack-happs`
1915

20-
- desktop
21-
- Weave app
16+
### Acorn Desktop
2217

23-
### Run Locally and Develop on your Computer
18+
When you are running the app locally for the desktop version, you need to run two separate commands.
2419

25-
_Prerequisites_
20+
- In the first terminal window run `yarn run desktop:ui`
21+
- In the second terminal window run `yarn run desktop:happ`
2622

27-
- Have `nodejs` (v20) and `yarn` (v1, classic) installed on your system
23+
This will launch the ui and a electron app with the holochain conductor preconfigured and the acorn happ loaded.
2824

29-
Then run
25+
If you want multiple instances to test multi-agent scenarios run `yarn run desktop:happ -n 2` (or any number)
3026

31-
- `yarn install`
32-
- `yarn run dev`
27+
Alternatively, instead of launching the ui separately, you can run `yarn run desktop:build-webhapp` and then `yarn run desktop:webhapp`. This will launch a fully packaged webhapp in a preconfigured electron environment.
3328

34-
In the future, just run `yarn run dev` anytime to develop.
29+
### Acorn Moss Tool
3530

36-
When you run `yarn run dev` a `user-data/` directory is created and this is where user data including private keys, and also data generated through use of the app is stored.
31+
- In the first terminal window run `yarn run moss:ui`
32+
- In the second terminal window run `yarn run moss:happ`
3733

38-
You can run `yarn run user-data-reset` if you have user data in development, but you want to clear it, and start over with fresh identities.
34+
If you want 2 agents, open a 3rd terminal window and run `yarn run moss:happ2`
3935

40-
> NOTE: if you see a blank screen once electron launches the app, refresh the page (using View -> Reload or Cmd/Ctrl-R) to see app contents.
36+
If you want to test the full webhapp, run `yarn run moss:build-webhapp` then run `yarn run moss:webhapp`. If you want a second agent, run `yarn run moss:webhapp2`.
4137

42-
#### Commands that are more specific to your use case:
38+
### Building / Packaging Desktop App
4339

44-
You can run the web process and the electron processes separately, instead of running `yarn run dev` which combines them.
40+
First, build the webhapp if you haven't done so yet:
4541

46-
**web** (user interface)
42+
- `yarn run desktop:build-webhapp`
4743

48-
- `yarn run web`
44+
This will create an `[acorn-desktop.webhapp](./happs/happ/workdir/acorn-desktop.webhapp)` file. Upload this to the [Acorn release page](https://github.com/lightningrodlabs/acorn/releases) with the appropriate version tag.
4945

50-
**electron**
46+
Then, clone the `[acorn-desktop](https://github.com/lightningrodlabs/acorn-desktop/tree/v11.1.2)` repo. Take the `acorn-desktop.webhapp` file and copy it into the `/pouch` directory. Follow the rest of the instruction in the README. This should trigger a github action which automatically builds and releases multi-platform versions of Acorn, signed and ready to download on the [release page](https://github.com/lightningrodlabs/acorn-desktop/releases)
5147

52-
- `yarn run electron`
48+
### Building / Packaging Moss Tool
5349

54-
#### Multi-User Testing
50+
Build the webhapp,
5551

56-
run the following commands in separate terminal instances (must have a running instance of acorn for the first user, either by running `yarn run dev` or the below commands without the `2`):
52+
- `yarn run moss:build-webhapp`
5753

58-
- `yarn run web(2,3,4)`
59-
- `yarn run electron(2,3,4)`
54+
This will create an `[acorn-moss.webhapp](./weave-tool/acorn-moss.webhapp)` file. Upload this to the [Acorn release page](https://github.com/lightningrodlabs/acorn/releases) with the appropriate version tag.
6055

61-
After running these commands, a `user-data/` directory is created with user data. It too can be cleared by running `yarn run user-data-reset`.
62-
63-
### Building / Packaging
64-
65-
To build:
66-
67-
- `yarn run build`
68-
69-
The packaged executables can be found in `frontend/electron/out`.
70-
71-
In order to get cross-platform builds, just tag your repository like `v1.0.0-alpha` and push the tag to Github. CI will automatically start running a build, under the "Release" action.
72-
73-
> Macos: You will need to have set the following environment variables as repository secrets:
74-
>
75-
> - APPLE_CERTIFICATE_BASE64
76-
> - APPLE_CERTIFICATE_PASS
77-
> - APPLE_DEV_IDENTITY
78-
> - APPLE_ID_EMAIL
79-
> - APPLE_ID_PASSWORD
80-
> - APPLE_TEAM_ID
81-
>
82-
> The first two should be set as equivalents of `MACOS_CERTIFICATE` = `APPLE_CERTIFICATE_BASE64` and `MACOS_CERTIFICATE_PWD` = `APPLE_CERTIFICATE_PASS` as found in the following article, which also provides other instruction regarding this: https://localazy.com/blog/how-to-automatically-sign-macos-apps-using-github-actions
56+
Publish this to the weave tool curation list, following the instruction [here](https://github.com/lightningrodlabs/weave-tool-curation/blob/main/0.13/README.md). You can view an example PR of this [here](https://github.com/lightningrodlabs/weave-tool-curation/pull/40).
8357

8458
### Versioning
8559

86-
Each version of the app will either change, or not change, the paths to the user data folders in use by the application.
87-
88-
The user data will be located under `acorn` in the platform specific appData folder, as specified by `appData` here: https://www.electronjs.org/docs/latest/api/app#appgetpathname
89-
90-
It is then in a specific sub-folder that relates to one of two types of data:
91-
92-
- source chain and DHT -> `databases-${INTEGRITY_VERSION_NUMBER}`
93-
- private keys -> `keystore-${KEYSTORE_VERSION_NUMBER}`
94-
95-
INTEGRITY_VERSION_NUMBER and KEYSTORE_VERSION_NUMBER are defined in `electron/src/holochain.ts` and can be modified as needed in order to jump to new versions of holochain, or a new app DNA.
96-
97-
You can tweak INTEGRITY_VERSION_NUMBER and KEYSTORE_VERSION_NUMBER independently.
98-
99-
INTEGRITY_VERSION_NUMBER should be incremented when a new DNA is in use, or when a new version of holochain which is not backwards compatible with prior versions is bumped to. In the case of new happ files being used, this occurs when the version number of the happ release in [./scripts/download-happs.sh](./scripts/download-happs.sh) changes. It will cause users to have to go through the migration process.
100-
101-
KEYSTORE_VERSION_NUMBER should be incremented if the version of lair-keystore changes, and has a new key format. Or if you otherwise want users to have to switch and generate new keys.
102-
103-
## Happ Code
104-
105-
The happ code has been separated into its own repository with its own release process. This has been done even though developing new features can sometimes involve the modification of that code, as well as the frontend and desktop wrapper code.
106-
107-
The repo is here: https://github.com/lightningrodlabs/acorn-happ.
108-
109-
After making changes, and performing a release, just edit [./scripts/download-happs.sh](./scripts/download-happs.sh) to point to the new release, and then run `yarn run download-happs` to download the new release.
110-
111-
As mentioned above, INTEGRITY_VERSION_NUMBER should be incremented when the happ release has been updated.
112-
113-
## Dependencies
114-
115-
This project uses [holochain-runner](https://github.com/lightningrodlabs/holochain-runner) and [electron](https://www.electronjs.org/docs/latest/api/app)
116-
117-
## Technical Overview
118-
119-
Acorn functions at a high level according to these patterns:
120-
121-
- an 'electron' wrapper is responsible for
122-
- creating a 'BrowserWindow' application window through which users interact with the HTML/JS/CSS GUI of Acorn
123-
- starting up and stopping background processes for Holochain related services, including the main holochain engine, and the holochain "keystore" which handles cryptographic signing functions. It is necessary for these background processes to be running while the application is open, and for them to stop when it is closed/quit, because the GUI must talk to these components in order for it to perform any of its primary functions such as reading and writing data.
124-
- The `holochain` binary shipped by the holochain organization is **not** directly bundled, and executed. An alternative approach is taken for the needs of Acorn. This alternative approach involves the compilation of a custom binary to run the core Holochain engine, the "conductor", which is achieved by importing shared code from the `holochain` binary source code. It relies on a general library that was developed with Acorn in mind, the [holochain-runner](https://github.com/lightningrodlabs/holochain-runner/). This strategy was taken to optimize performance and cut down on cross-language (js <-> rust) complexity. Due to this architecture, the electron js code does not need to call any functions of the `admin websocket` typically exposed by `holochain` to manage the Conductor state. This also improves code development simplicity, as it minimizes the surface area/complexity of the electron side code, and keeps it "thin".
125-
- This custom binary also helps the GUI / electron application know about the status of the Conductor. It does this by subscribing to events emitted from the `holochain-runner`, and forwarding those events to the GUI via electron's IPC messages.
126-
- Within the application, here is how Acorn utilizes Holochain:
127-
- A new user will need a new private/public key pair to represent their unique identity within Acorn. This will be generated automatically on the first launch of Acorn. Acorn will look in the following folder on the users computer to determine whether this is the first launch or a re-launch (`-X` would be replaced by "integrity version" numbers such as `1`, and `-Y` would be replaced by "keystore version" numbers such as `1`, both are the numbers associated in the [Versioning](#versioning) section of this doc):
128-
- Linux: `~/.config/Acorn/databases-X` and `~/.config/Acorn/keystore-Y`
129-
- MacOS: `~/Library/Application Support/Acorn/databases-X` and `~/Library/Application Support/Acorn/keystore-Y`
130-
- Windows: coming soon...
131-
- In Holochain, there is a pattern of a Conductor running 'apps', where an app is a collection of Cells (which are DNA + Agent), all configured to be running under the same Agent private keys
132-
- Instead of installing many DNAs within an "app", Acorn installs many/multiple "apps" each with one Cell.
133-
- On initial launch, the first "app" containing a Cell is automatically installed and activated, as all users need it to operate the app and onboard themselves. It is the "profile" app. It is responsible for sharing data globally between all Acorn users to do with users profile metadata.
134-
- In order to create a "Project" within Acorn, a whole new "app" containing one Cell is installed and activated. _By taking the unique 5 word secret phrase generated in the UI and injecting it into the DNA as a "uid" key/value, we create a unique secure network and DHT for that Project, which is guessable/joinable only by those who know that same secret phrase, which can be shared with them via chat channels outside of Acorn._
135-
- When the UI calls into the Conductor to list out which "apps" are installed, it receives back a list like this: `["main-app", "acorn-project-206088-uid-pickle-glandular-cache-jugular-battered", "acorn-project-664715-uid-twinky-mockup-foothold-skiing-handed", "acorn-project-918455-uid-puffball-alkalize-freckles-drier-flame"]` which distinguishes between apps which are project apps, any with the prefix "acorn-project" and the 1 app which is not, which is called "main-app". It uses this distinction to make all the necessary Zome calls into that 1 Cell within each project app to find the Project metadata (`ProjectMeta` in the code) and list it out in the UI on the Dashboard.
136-
- All user data is either stored in the previously mentioned platform specific "application data" folder, and also in the chromekit/electron "localstorage" memory. Only very simple things such as preferences for Trackpad or Mouse are currently stored in "localstorage", the rest is in the application support folder, namespaced by the version number you are currently running.
60+
When you are bumping a version, do a global search for the version number and replace it with the new one. You can see an example commit of this [here](https://github.com/lightningrodlabs/acorn/pull/374/commits/fffe15395ee489d25a0aab7fbc48d674bee97991).

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Acorn is currently in **Alpha** testing phase.
66

77
## Things you can do
88

9-
- [**Download & install the latest Acorn release**](https://github.com/lightningrodlabs/acorn/releases/tag/v11.1.3).
9+
- [**Download & install the latest Acorn release**](https://github.com/lightningrodlabs/acorn/releases/tag/v11.2.0).
1010

1111
- Check out the [Acorn Knowledge Base](https://docs.acorn.software) to learn more about Acorn, its methodology and features.
1212

0 commit comments

Comments
 (0)