Skip to content

Commit

Permalink
v0.6.0-alpha with realtime collaboration improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Connoropolous committed Jan 31, 2022
1 parent baa7144 commit a058058
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 23 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,16 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload "${GITHUB_REF#refs/tags/}" "electron/out/Acorn-0.5.9-alpha.AppImage" --clobber
gh release upload "${GITHUB_REF#refs/tags/}" "electron/out/Acorn-0.6.0-alpha.AppImage" --clobber
- name: upload binary (macos only)
if: ${{ runner.os == 'macOs' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload "${GITHUB_REF#refs/tags/}" "electron/out/Acorn-0.5.9-alpha.dmg" --clobber
gh release upload "${GITHUB_REF#refs/tags/}" "electron/out/Acorn-0.6.0-alpha.dmg" --clobber
- name: upload binary (Windows only)
if: ${{ runner.os == 'Windows' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload "$($env:GITHUB_REF -replace "refs/tags/")" "electron/out/Acorn.Setup.0.5.9-alpha.exe" --clobber
gh release upload "$($env:GITHUB_REF -replace "refs/tags/")" "electron/out/Acorn.Setup.0.6.0-alpha.exe" --clobber
54 changes: 46 additions & 8 deletions DEVELOPERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,52 @@ To build:

- `npm run build`

> Macos: You will need to have set
> APPLE_ID_EMAIL
> and
> APPLE_ID_PASSWORD
> as environment variables, in addition to having a certificate for the Apple Developer
> account installed on the system you are building on.
The packaged executables can be found in `frontend/electron/out`.

You will find the packaged executables in `electron/out`.
In order to get cross-platform builds, just tag your repository like `v0.0.1` and push the tag to Github. CI will automatically start running a build, under the "Release" action.

> Macos: You will need to have set the following environment variables as repository secrets:
> - APPLE_CERTIFICATE_BASE64
> - APPLE_CERTIFICATE_PASS
> - APPLE_DEV_IDENTITY
> - APPLE_ID_EMAIL
> - APPLE_ID_PASSWORD
>
> 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

### Versioning

Each version of the app will either change, or not change, the paths to the user data folders in use by the application.

The user data will be located under `mova` in the platform specific appData folder, as specified by `appData` here: https://www.electronjs.org/docs/latest/api/app#appgetpathname

It is then in a specific sub-folder that relates to one of two types of data:
- source chain and DHT -> `databases-${DATABASES_VERSION_NUMBER}`
- private keys -> `keystore-${KEYSTORE_VERSION_NUMBER}`

DATABASES_VERSION_NUMBER and KEYSTORE_VERSION_NUMBER are defined in `frontend/electron/src/holochain.ts` and can be modified as needed in order to jump to new versions of holochain, or a new app DNA.

You can tweak DATABASES_VERSION_NUMBER and KEYSTORE_VERSION_NUMBER independently.

DATABASES_VERSION_NUMBER should be incremented when a new DNA is in use. It will cause users to have to re-create profiles and re-instate data they've previously added.

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.


## Dependency Versions Information

This project is currently using:

https://github.com/holochain/holochain/releases/tag/holochain-0.0.115

https://github.com/Sprillow/holochain-runner/releases/tag/v0.0.30

Lair Keystore Revision [v0.0.9 Nov 4, 2021](https://github.com/holochain/lair/releases/tag/v0.0.9)

https://docs.rs/hdk/0.0.115/hdk/index.html

and electron version 12 [https://www.electronjs.org/](https://www.electronjs.org/)

## Technical Overview

Expand All @@ -75,7 +113,7 @@ Acorn functions at a high level according to these patterns:
- an 'electron' wrapper is responsible for
- creating a 'BrowserWindow' application window through which users interact with the HTML/JS/CSS GUI of Acorn
- 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.
- 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. This is found in the [conductor](./conductor) folder. It relies on a general library that was developed with Acorn in mind, the [embedded-holochain-runner](https://github.com/Sprillow/embedded-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".
- 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. This is found in the [conductor](./conductor) folder. It relies on a general library that was developed with Acorn in mind, the [holochain-runner](https://github.com/Sprillow/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".
- 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 `embedded-holochain-runner`, and forwarding those events to the GUI via electron's IPC messages.
- Within the application, here is how Acorn utilizes Holochain:
- 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-Y-Z` would be replaced by version numbers such as for `v0.5.1` it would be `-0-5-1`):
Expand Down
4 changes: 2 additions & 2 deletions electron/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion electron/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "acorn",
"version": "0.5.9-alpha",
"version": "0.6.0-alpha",
"description": "Create the future",
"main": "dist/index.js",
"scripts": {
Expand Down
9 changes: 7 additions & 2 deletions electron/src/holochain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ import * as path from 'path'
import { app } from 'electron'
import { HolochainRunnerOptions, StateSignal, PathOptions } from 'electron-holochain'

// see the DEVELOPERS.md about incrementing
// these values
const DATABASES_VERSION_NUMBER = '1'
const KEYSTORE_VERSION_NUMBER = '1'

// these messages get seen on the splash page
export enum StateSignalText {
IsFirstRun = 'Welcome to Acorn...',
Expand Down Expand Up @@ -76,11 +81,11 @@ const devOptions: HolochainRunnerOptions = {
}
const prodOptions: HolochainRunnerOptions = {
dnaPath: profilesDnaPath, // preload
datastorePath: path.join(app.getPath('userData'), 'databases-0-5-9-alpha'),
datastorePath: path.join(app.getPath('userData'), `databases-${DATABASES_VERSION_NUMBER}`),
appId: MAIN_APP_ID,
appWsPort: 8889,
adminWsPort: 1235,
keystorePath: path.join(app.getPath('userData'), 'keystore-0-5-9-alpha'),
keystorePath: path.join(app.getPath('userData'), `keystore-${KEYSTORE_VERSION_NUMBER}`),
proxyUrl: COMMUNITY_PROXY_URL,
}

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "acorn",
"version": "0.5.9-alpha",
"version": "0.6.0-alpha",
"description": "Acorn is software that helps people create the future",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion web/dist/splashscreen.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<div class="splash-content-wrapper">
<div>
<div class="splash-logo">acorn</div>
<div class="splash-version">version 0.5.9-alpha</div>
<div class="splash-version">version 0.6.0-alpha</div>
</div>
<div class="splash-loading-message" id="activity">
Setting up Holochain...
Expand Down
4 changes: 2 additions & 2 deletions web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "acorn-ui",
"version": "0.5.9-alpha",
"version": "0.6.0-alpha",
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/preset-env": "7.5.5",
Expand Down

0 comments on commit a058058

Please sign in to comment.