Skip to content
This repository has been archived by the owner on Feb 3, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1247 from holochain/release-0.0.11-alpha1
Browse files Browse the repository at this point in the history
Release 0.0.11-alpha1
  • Loading branch information
thedavidmeister committed Apr 11, 2019
2 parents e9429a6 + 18aac50 commit ab6983d
Show file tree
Hide file tree
Showing 69 changed files with 795 additions and 715 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Security

## [0.0.11-alpha1] - 2019-04-11

### Added

### Changed

- Performance optimization: Don't clone and parse WASM binaries for each distinct WASM execution such as Zome function calls and validation callbacks. Instead hold only one parsed module instance per zome on the heap and use that to initialize WASM instances. [#1211](https://github.com/holochain/holochain-rust/pull/1211)

### Deprecated

### Removed

### Fixed

- Fixes problem where Scenario tests hang when throwing an error during `runTape` [#1232](https://github.com/holochain/holochain-rust/pull/1232)

### Security

## [0.0.10-alpha2] - 2019-04-04

### Added
Expand Down
184 changes: 8 additions & 176 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,189 +28,21 @@ This code is loosely based on the [Golang prototype](https://github.com/holochai

[Holochain-Rust Architectural Overview](./doc/architecture/README.md)

## Documentation: The Book on Holochain
There is a work-in-progress book of documentation being written about `holochain-rust`. See the published version at the associated GitHub Pages for this repo, [https://developer.holochain.org/guide/latest](https://developer.holochain.org/guide/latest). See instructions for how to contribute to the book at [doc/holochain_101/src/how_to_contribute.md](./doc/holochain_101/src/how_to_contribute.md).

## Installation & Usage

**Important:** the instructions in this readme are for developers intending work on Holochain code-base itself, not Holochain application developers. If you want to use Holochain, please proceed to the instructions on the quick start installation guide: **https://developer.holochain.org/start.html**

**The following instructions are for developing Holochain Core or the HDK itself**

There are two components needed currently to run Holochain applications, the core (what's in this repo) and also [the networking engine](https://github.com/holochain/n3h). You can install and work on core using the built-in mock network following the instructions below, but if you want to actually test out your apps using the real networking, you will have to install [the networking component](https://github.com/holochain/n3h) following the instructions in the README there. (Note: please see the instructions in the guide book for [`hc`](https://developer.holochain.org/guide/latest/hc_configuring_networking.html) or the [production Conductor](https://developer.holochain.org/guide/latest/conductor_networking.html) for how to configure the tools to use and activate the networking component.

There are three approaches to building and testing Holochain: using `nix-shell`, `make`, `docker`:

### Nix Shell (Supported: Ubuntu, Debian, Mac OS X & Nix OS)

The `nix-shell` command from the nixos team is the preferred way to work with Holochain.

NixOS is an entire operating system but the `nix-shell` is simply a tool to manage dependencies for an individual shell session.

To install `nix-shell`:

```shell
# basic deps needed on ubuntu/debian
apt-get update && apt-get install -y curl bzip2

# this installs on all (non-windows) systems
curl https://nixos.org/nix/install | sh
```

Follow any further instructions output to the terminal during installation.

[The website](https://nixos.org/nix/download.html) has more details.

Running the `nix-shell` command from inside the root of the repository will detect and use the `shell.nix` file.

The `nix-shell` approach offers unique benefits:

- Dependencies are injected into a single shell session only
- Minimal modifications to the host environment
- No need to maintain/rerun/troubleshoot installation scripts
- Further isolation from host environment can be achieved with `nix-shell --pure`
- Dependencies are hashed
- "Dependency hell" is avoided
- Nice parallels with the hashed zomes model
- Security + reliability benefits
- Dependencies can be garbage collected with the `nix-collect-garbage` command
- Single "package manager" across most operating systems
- Ability to ship utility scripts in the `shell.nix` file
- Access to the nix functional programming language for dependencies/script management
- NixOS runs on HoloPorts so `nix-shell` provides similar behaviour/environment

If you have a nix friendly system, this is the fastest and most reliable way to develop and test.

Once in a `nix-shell` the `hc-*` prefixed bash commands support tab completion.

Note: The `hc-test-all` command builds and tests _everything_ in core.

Note: The `hc-install-*` commands may write to the current user's home directory.
Other commands that call `cargo` and `npm` may also write to the home directory.
This is how `cargo` and `npm` work unfortunately.
`hc-**-flush` commands delete relevant development artifacts.

#### Troubleshooting

Default `nix-shell` behaviour preserves some of the user's environment, simply
_adding_ to it rather than _isolating_ from it.

This can cause problems if your user has cruft that conflicts with what nix is
doing, e.g. existing `cargo` or `npm` installations/environment variables.

If you are seeing an issue in `nix-shell` that others are not seeing, try using
our isolation script `./scripts/nix/pod.sh` to debug the command.

For example:

```shell
./scripts/nix/pod.sh 'hc-build-wasm && hc-test'
```

or even:

```shell
./scripts/nix/pod.sh hc-test-all
```

#### Future deployments
## Application Developer

In the future we plan to distribute binaries through nixpkgs.
This would to enable the following:
Setup a Development Environment to create Holochain Application:

```shell
# doesn't work yet... watch this space!
nix-shell -p holochain --run holochain ...
```
https://developer.holochain.org/start.html

### Make (Supported: Ubuntu, Debian & Mac OS X)
## Core Developer

For Linux/OSX you can install the prerequisites directly into the host environment with:
Setup a Core Development Environment to work on Holochain itself:

``` shell
cd path/to/holochain
./scripts/install/auto.sh
```
[Core Developer Setup](./doc/CoreDevSetup.md)

**Note**: the script will install [homebrew](https://brew.sh/) on mac os x
**Note**: the script will install dependencies with `apt-get` on linux

After the install script completes successfully, you can start local development using `make`

Running the `make` command will:

1. install (or update to) the correct version of rust
2. build all the rust libraries from the source code in this repository.
3. build and install the command-line tools.

**Note**: it's very important to use the rust version specified in the Makefile! Since we are using nightly rust builds, the language is changing rapidly and sometimes introduces breaking changes that we haven't adapted to yet. Don't just use the latest nightly.

**Note**: The installation script evolves over time alongside core.
The installation script is idempotent.
Rerun the script after each upgrade/downgrade.

### Docker (Supported: Ubuntu, Debian, Mac OS X, Nix OS, Windows)

We support [docker](https://www.docker.com/).
The `docker` folder contains scripts to build and run docker images.

The `holochain/holochain-rust:latest` docker image is an alpine NixOS rebuilt nightly.
The build process warms nix and incrementally compiles cargo/wasm/neon for faster feedback.

### Windows

You will need to install rust manually.

Rustup `https://rustup.rs/#` is likely the best option.

The rust language moves very fast on the nightly channel.

It is very important to be using the correct nightly version.

Currently this is:

`nightly-2019-01-24-x86_64-pc-windows-msvc`

The nightly version we test/develop against can always be found in the .travis.yml file.

#### Running tests

Run:

```shell
. docker/run-test
```
or

``` shell
make test
```

or

``` shell
nix-shell --run hc-test
```

Note that there are also make commands for running the tests of just core, or the command-line line tools or app_spec separately:

``` shell
make test_cli
make test_holochain
make test_app_spec
make build_nodejs_conductor
```

### Building for Android
Note there is an article written on how to build Holochain for Android, read it [here](doc/holochain_101/src/building_for_android.md).

## Upgrading

Upgrading to a new tagged release of Holochain may include new/changed system dependencies.

__If not using `nix-shell` we strongly recommend rerunning `./scripts/install/auto.sh` when upgrading core.__
## Documentation: The Book on Holochain
There is a work-in-progress book of documentation being written about `holochain-rust`. See the published version at the associated GitHub Pages for this repo, [https://developer.holochain.org/guide/latest](https://developer.holochain.org/guide/latest). See instructions for how to contribute to the book at [doc/holochain_101/src/how_to_contribute.md](./doc/holochain_101/src/how_to_contribute.md).

The script is designed to be idempotent. This means there is no harm re-running it.

## Contribute
Holochain is an open source project. We welcome all sorts of participation and are actively working on increasing surface area to accept it. Please see our [contributing guidelines](/CONTRIBUTING.md) for our general practices and protocols on participating in the community, as well as specific expectations around things like code formatting, testing practices, continuous integration, etc.
Expand Down
2 changes: 1 addition & 1 deletion app_spec/zomes/blog/code/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "code"
version = "0.0.10-alpha2"
version = "0.0.11-alpha1"
authors = ["Holochain Core Dev Team <devcore@holochain.org>"]

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion app_spec/zomes/summer/code/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "code"
version = "0.0.10-alpha2"
version = "0.0.11-alpha1"
authors = ["Holochain Core Dev Team <devcore@holochain.org>"]

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "benchmarks"
version = "0.0.10-alpha2"
version = "0.0.11-alpha1"
authors = ["Holochain Core Dev Team <devcore@holochain.org>"]

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion cas_implementations/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "holochain_cas_implementations"
version = "0.0.10-alpha2"
version = "0.0.11-alpha1"
authors = ["Holochain Core Dev Team <devcore@holochain.org>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hc"
version = "0.0.10-alpha2"
version = "0.0.11-alpha1"
authors = ["Holochain Core Dev Team <devcore@holochain.org>"]

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ $ cargo install hc --force --git https://github.com/holochain/holochain-rust.git

To install the latest released version of the Holochain conductor, run the following command in a terminal
```shell
$ cargo install hc --force --git https://github.com/holochain/holochain-rust.git --tag v0.0.10-alpha2
$ cargo install hc --force --git https://github.com/holochain/holochain-rust.git --tag v0.0.11-alpha1
```

The command line tools are now available in your command line using the `hc` command.
Expand Down
2 changes: 1 addition & 1 deletion cli/src/cli/js-tests-scaffold/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"dependencies": {
"@holochain/holochain-nodejs": "0.4.9-alpha2",
"@holochain/holochain-nodejs": "0.4.10-alpha1",
"json3": "*",
"tape": "^4.9.1"
}
Expand Down
11 changes: 6 additions & 5 deletions cli/src/cli/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use std::{
fs::{self, File},
io::{Read, Write},
path::PathBuf,
sync::Arc,
};

pub const CODE_DIR_NAME: &str = "code";
Expand Down Expand Up @@ -153,15 +154,15 @@ impl Packager {
meta_tree.insert(file_name.clone(), META_DIR_ID.into());

let build = Build::from_file(dir_with_code.join(BUILD_CONFIG_FILE_NAME))?;

let wasm = build.run(&dir_with_code)?;

let wasm_binary = base64::decode(&wasm)?;
let wasm_binary = Arc::new(base64::decode(&wasm)?);

let json_string = run_dna(
wasm_binary,
Some("{}".as_bytes().to_vec()),
WasmCallData::DirectCall("__hdk_get_json_definition".to_string()),
WasmCallData::DirectCall(
"__hdk_get_json_definition".to_string(),
wasm_binary.clone(),
),
)?;

let json_from_wasm: Map<String, Value> =
Expand Down
2 changes: 1 addition & 1 deletion cli/src/cli/scaffold/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ fn generate_cargo_toml(name: &str, contents: &str) -> DefaultResult<String> {
let version_default = if maybe_version.is_some() {
maybe_version.unwrap()
} else {
String::from("tag = \"v0.0.10-alpha2\"")
String::from("tag = \"v0.0.11-alpha1\"")
};
let maybe_package = config.get("package");

Expand Down
2 changes: 1 addition & 1 deletion cli/src/cli/scaffold/rust/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use hdk::holochain_core_types::{
validation::EntryValidationData
};

// see https://developer.holochain.org/api/0.0.10-alpha2/hdk/ for info on using the hdk library
// see https://developer.holochain.org/api/0.0.11-alpha1/hdk/ for info on using the hdk library

// This is a sample zome that defines an entry type "MyEntry" that can be committed to the
// agent's chain via the exposed function create_my_entry
Expand Down
2 changes: 1 addition & 1 deletion common/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "holochain_common"
version = "0.0.10-alpha2"
version = "0.0.11-alpha1"
authors = ["Holochain Core Dev Team <devcore@holochain.org>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion conductor/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "holochain"
version = "0.0.10-alpha2"
version = "0.0.11-alpha1"
authors = ["Holochain Core Dev Team <devcore@holochain.org>"]

[dependencies]
Expand Down
2 changes: 1 addition & 1 deletion conductor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ $ cargo install holochain --force --git https://github.com/holochain/holochain-r

To install the latest released version of the Holochain conductor, run the following command in a terminal
```shell
$ cargo install holochain --force --git https://github.com/holochain/holochain-rust.git --tag v0.0.10-alpha2
$ cargo install holochain --force --git https://github.com/holochain/holochain-rust.git --tag v0.0.11-alpha1
```

The Conductor should then be available from your command line using the `holochain` command.
Expand Down
6 changes: 4 additions & 2 deletions conductor/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use holochain_conductor_api::{
config::{self, load_configuration, Configuration},
};
use holochain_core_types::error::HolochainError;
use std::{fs::File, io::prelude::*, path::PathBuf};
use std::{fs::File, io::prelude::*, path::PathBuf, thread::sleep, time::Duration};
use structopt::StructOpt;

#[derive(StructOpt, Debug)]
Expand Down Expand Up @@ -66,7 +66,9 @@ fn main() {
.start_all_static_servers()
.expect("Could not start UI servers!");
}
loop {}
loop {
sleep(Duration::from_secs(1))
}
}
Err(error) => println!("Error while trying to boot from config: {:?}", error),
};
Expand Down
2 changes: 1 addition & 1 deletion conductor_api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "holochain_conductor_api"
version = "0.0.10-alpha2"
version = "0.0.11-alpha1"
authors = ["Holochain Core Dev Team <devcore@holochain.org>"]

[dependencies]
Expand Down
Loading

0 comments on commit ab6983d

Please sign in to comment.