Skip to content

Commit 8129fe7

Browse files
committed
yea
1 parent 2407c76 commit 8129fe7

30 files changed

+397
-109
lines changed

Diff for: .gitignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@ front/dist/*.js.map
77
Cargo.lock
88
target/
99
back/.cargo/
10-
.hc
10+
back/workdir/acorn.happ
11+
back/workdir/profiles.dna
12+
back/workdir/projects.dna
13+
.hc
14+
databases

Diff for: README.md

+24-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,27 @@
11
# Acorn
2+
## built with Holochain
3+
4+
To set up fresh:
5+
__back__
6+
- run `npm run install-holochain`
7+
- run `npm run pack-happ`
8+
- run `npm run run-happ`, this starts holochain service
9+
- in a separate terminal, run `npm run install-happ`
10+
__front__ (user interface)
11+
- in a separate terminal than `back` commands
12+
- Use nodejs version 14
13+
- run `npm install`
14+
- run `npm run install-ui`
15+
- run `npm run run-ui`
16+
- Open up http://localhost:8080/ OR to view in Electron, run `npm start`
17+
18+
If you make changes to back/crates or back/zomes, you will need to restart your database from scratch:
19+
- stop a running `npm run run-happ` service
20+
- delete `databases` folder
21+
- run `npm run pack-happ`
22+
- restart the `run-happ` service with `npm run run-happ`
23+
- in a separate terminal, run `npm run install-happ`
24+
- you can now reload your UI and check out your new code, you do not need to restart your UI/front
25+
226

3-
## build with Holochain
427

Diff for: back/conductor-config.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
environment_path: databases # note this is relative to the path from which `holochain` gets run, not where this file sits
3+
use_dangerous_test_keystore: false
4+
signing_service_uri: ~
5+
encryption_service_uri: ~
6+
decryption_service_uri: ~
7+
dpki: ~
8+
keystore_path: ~
9+
passphrase_service: ~
10+
admin_interfaces:
11+
- driver:
12+
type: websocket
13+
port: 1234 # must match config-admin-ws value
14+
network: ~

Diff for: back/crates/dna_help/src/lib.rs

+8-8
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,11 @@ macro_rules! crud {
264264
let address = create_entry(&entry)?;
265265
let entry_hash = hash_entry(&entry)?;
266266
let path = Path::from([<$i:upper _PATH>]);
267-
let start_ensure_time: std::time::Duration = sys_time()?;
268-
debug!("start! of Path.ensure() time {:?}", start_ensure_time.clone());
267+
// let start_ensure_time: std::time::Duration = sys_time()?;
268+
// debug!("start! of Path.ensure() time {:?}", start_ensure_time.clone());
269269
path.ensure()?;
270-
let end_ensure_time: std::time::Duration = sys_time()?;
271-
debug!("end! of Path.ensure() time {:?}", end_ensure_time.clone());
270+
// let end_ensure_time: std::time::Duration = sys_time()?;
271+
// debug!("end! of Path.ensure() time {:?}", end_ensure_time.clone());
272272
let path_hash = path.hash()?;
273273
create_link(path_hash, entry_hash.clone(), ())?;
274274
let wire_entry = [<$crud_type WireEntry>] {
@@ -277,16 +277,16 @@ macro_rules! crud {
277277
entry_address: $crate::WrappedEntryHash(entry_hash)
278278
};
279279
if (send_signal) {
280-
let start_signal_time: std::time::Duration = sys_time()?;
281-
debug!("start!! of signal time {:?}", start_signal_time.clone());
280+
// let start_signal_time: std::time::Duration = sys_time()?;
281+
// debug!("start!! of signal time {:?}", start_signal_time.clone());
282282
let signal = $convert_to_receiver_signal([<$crud_type Signal>] {
283283
entry_type: $path.to_string(),
284284
action: $crate::ActionType::Create,
285285
data: [<$crud_type SignalData>]::Create(wire_entry.clone()),
286286
});
287287
let _ = $crate::signal_peers(&signal, $get_peers);
288-
let end_signal_time: std::time::Duration = sys_time()?;
289-
debug!("end!! of signal time {:?}", end_signal_time.clone());
288+
// let end_signal_time: std::time::Duration = sys_time()?;
289+
// debug!("end!! of signal time {:?}", end_signal_time.clone());
290290
}
291291
Ok(wire_entry)
292292
}

Diff for: back/scripts/add-app-ws.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
ADMIN_PORT=$(cat "config-admin-ws")

Diff for: back/scripts/install-happ.sh

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
ADMIN_PORT=$(cat "config-admin-ws")
3+
APP_PORT=$(cat "config-app-ws")
4+
MAIN_APP_ID=$(cat "config-main-app-id")
5+
6+
# INSTALL THE HAPP
7+
# this will also generate an agent
8+
# and it will also activate the app
9+
hc sandbox call --running=$ADMIN_PORT install-app-bundle --app-id=$MAIN_APP_ID back/workdir/acorn.happ
10+
11+
# ACTIVATE THE WEBSOCKET PORT
12+
hc sandbox call --running=$ADMIN_PORT add-app-ws $APP_PORT

Diff for: back/scripts/pack-happ.sh

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
# Compile the WASM
3+
CARGO_TARGET_DIR=target cargo build --release --target wasm32-unknown-unknown
4+
# Pack DNAs
5+
hc dna pack --output=back/workdir/profiles.dna back/workdir/dna/profiles
6+
hc dna pack --output=back/workdir/projects.dna back/workdir/dna/projects
7+
# Pack the Happ with everything
8+
hc app pack --output=back/workdir/acorn.happ back/workdir/happ

Diff for: back/workdir/acorn.happ

-1.89 MB
Binary file not shown.

Diff for: back/workdir/dna/profiles.dna

-740 KB
Binary file not shown.

Diff for: back/workdir/dna/projects.dna

-864 KB
Binary file not shown.

Diff for: back/workdir/happ/happ.yaml

+28-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ slots:
88
strategy: create
99
deferred: false
1010
dna:
11-
bundled: "../dna/profiles.dna"
11+
bundled: "../profiles.dna"
1212
properties: ~
1313
uuid: ~
1414
version: ~
@@ -18,8 +18,33 @@ slots:
1818
strategy: create
1919
deferred: true
2020
dna:
21-
bundled: "../dna/projects.dna"
21+
bundled: "../projects.dna"
2222
properties: ~
2323
uuid: ~
2424
version: ~
25-
clone_limit: 0
25+
clone_limit: 0
26+
27+
# Provisioning options
28+
# as seen on March 25, from here:
29+
# https://github.com/holochain/holochain/blob/d2ce21aa51672328e162f9a5c8137ccba9efd5b8/crates/holochain_types/src/app/app_manifest/app_manifest_v1.rs#L156-L176
30+
# /// Rules to determine if and how a Cell will be created for this Dna
31+
# #[derive(Clone, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
32+
# #[serde(rename_all = "snake_case")]
33+
# #[serde(tag = "strategy")]
34+
# #[allow(missing_docs)]
35+
# pub enum CellProvisioning {
36+
# /// Always create a new Cell when installing this App
37+
# Create { deferred: bool },
38+
# /// Always create a new Cell when installing the App,
39+
# /// and use a unique UUID to ensure a distinct DHT network
40+
# CreateClone { deferred: bool },
41+
# /// Require that a Cell is already installed which matches the DNA version
42+
# /// spec, and which has an Agent that's associated with this App's agent
43+
# /// via DPKI. If no such Cell exists, *app installation fails*.
44+
# UseExisting { deferred: bool },
45+
# /// Try `UseExisting`, and if that fails, fallback to `Create`
46+
# CreateIfNotExists { deferred: bool },
47+
# /// Disallow provisioning altogether. In this case, we expect
48+
# /// `clone_limit > 0`: otherwise, no Cells will ever be created.
49+
# Disabled,
50+
# }

Diff for: back/zomes/projects/src/lib.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use std::time::Duration;
1+
// use std::time::Duration;
22

33
use dna_help::{create_receive_signal_cap_grant, fetch_links, signal_peers, WrappedAgentPubKey};
44
use hdk::prelude::*;
@@ -18,8 +18,8 @@ use project::{
1818

1919
#[hdk_extern]
2020
fn init(_: ()) -> ExternResult<InitCallbackResult> {
21-
let start_init_time: Duration = sys_time()?;
22-
debug!("start of init time {:?}", start_init_time.clone());
21+
// let start_init_time: Duration = sys_time()?;
22+
// debug!("start of init time {:?}", start_init_time.clone());
2323
// authorize receive_signal
2424
// not the issue, takes about 2 ms
2525
create_receive_signal_cap_grant()?;
@@ -36,12 +36,12 @@ fn init(_: ()) -> ExternResult<InitCallbackResult> {
3636
let member_entry_hash = hash_entry(&member)?;
3737
create_link(member_path_address, member_entry_hash, ())?;
3838

39-
let end_init_time: Duration = sys_time()?;
40-
debug!("end of init time {:?}", end_init_time.clone());
41-
debug!(
42-
"difference in init time {:?}",
43-
end_init_time - start_init_time
44-
);
39+
// let end_init_time: Duration = sys_time()?;
40+
// debug!("end of init time {:?}", end_init_time.clone());
41+
// debug!(
42+
// "difference in init time {:?}",
43+
// end_init_time - start_init_time
44+
// );
4545
Ok(InitCallbackResult::Pass)
4646
}
4747

Diff for: config-admin-ws

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1234

Diff for: config-app-ws

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8888

Diff for: config-main-app-id

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
main-app

Diff for: front/package-lock.json

+135-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: front/package.json

+2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
"css-loader": "^3.2.0",
1010
"style-loader": "^1.0.0",
1111
"terser": "4.4.2",
12+
"ts-loader": "^8.0.18",
13+
"typescript": "^4.2.3",
1214
"webpack": "4.41.3",
1315
"webpack-cli": "^3.3.6",
1416
"webpack-dev-server": "^3.11.0",

0 commit comments

Comments
 (0)