holochain / holochain-proto

Holographic storage for distributed applications -- a validating monotonic DHT "backed" by authoritative hashchains for data provenance (a Ceptr sub-project)
http://holochain.org
GNU General Public License v3.0
876 stars 143 forks source link

holochain/bin #204

Closed christopherreay closed 7 years ago

christopherreay commented 7 years ago

basic end user docs for this issue: https://github.com/metacurrency/holochain/wiki/Install-Holochain-on-nix

At the moment, the holochain bin scripts are inside the metacurrency/holochain github repo. Once that repo is cloned onto the host machine, the scripts should allow the user to easily "install" holochain on the host system, and then manage their Holochain Core (on docker) installation, and manage their Holochain App development process

This will be implemented as bash scripts, and with reference also to https://github.com/metacurrency/holochain/wiki/Holochain-Development-Introduction

part of #174

basically be like:

1. git clone metacurrency/holochain hc
2. hc/bin/holochain.system.install
3. source ~/.bin/.bashrc
4. cd /myHolochainApp
5. holochain.app.init
6. holochain.app.testScenario [tab tab]
7. nice
christopherreay commented 7 years ago

holochain.system.install holochain.system.uninstall

d5103dfb63c44b6ed40b0ed0a16b1e46fc9f0403

900a14eac41de0bb3a6ebf4895284090fc1f3811

Bibliography:

christopherreay commented 7 years ago

holochain.app.init

921f5bdcec39046637aa160c3957d0246ff8e64e

9149af1acae7e67b4afad792caa19cd3aea9a860

Bibliography

christopherreay commented 7 years ago

holochain.app.testScenario

run multiNode testing in the current Holochain App

start moving scripts over from the "top down" e7f960708a45f50a9bb2bbdc055c30a11652be9e d5df0ceff15c0a699e0e7ff5629e5389642b95d4

add runCluster and configuration for logging etc 349af60a7edafa5d9eea9298e1665249e2be8e49

docker-compose is being called with correct arguments 903faaa1351ddcea90e5479e65d1c3b6c1539da4

make all the Dockerfile's available to the docker compose 2605bc4ea3f027987e84946bf29e9243a83fbc44

copy the container scripts over to metacurrency/holochain 0a058866fe0f4ae441fa4392b4f65357bd5a9486 check the commit message for instructions on the next bit

Bibliography

timotree3 commented 7 years ago

I'm a bit unclear on what this issue is implementing. Are you working on creating an easy packaging system for installing holochain apps?

If so I have a few thoughts, but I'll save them for if you say yes.

christopherreay commented 7 years ago

Ive updated the description. Is it clearer now? @timotree3 please check out #174 for the package management stuff

timotree3 commented 7 years ago

Not really. 😐

christopherreay commented 7 years ago

@timotree3 Im sorry. You're right. ive added a bit more description all through. Full end user docs comming tomorrow

christopherreay commented 7 years ago

holochain.system.bashCompletion

called by .bashrc to add holochain bash completion to shell

3697d8e1987e45388a052ffec8d1dcd35a131e54 810e40305d2997a577e0cf60ca80c2f6569abbd4

christopherreay commented 7 years ago

TODO: add to .gitignore on holochain.app.init

christopherreay commented 7 years ago

@zippy merged and basic documentation here https://github.com/metacurrency/holochain/wiki/Install-Holochain-on-nix

zippy commented 7 years ago

I merged the stuff in install-Holochain-on-nix into https://github.com/metacurrency/holochain/wiki/Holochain-App-Development-Introduction

zippy commented 7 years ago

Convert these bash scripts to their own go program

zippy commented 7 years ago

So I woke up this morning thinking that to go program should be hcdev and we should move the seed and testcommands from the regular hc into it too..

zippy commented 7 years ago

work on this (hcdev) happening in: https://github.com/metacurrency/holochain/tree/204-hcdev-cmd

christopherreay commented 7 years ago

RIght, so I am starting to implment calls to scripts in hcdev

First thing is a script for Core development that allows people to easliy compile and build the local source onto their system

christopherreay commented 7 years ago

@zippy so in the branch: testingCoreBranchesScript, Ive now gutted the entire of hcdev and hcdev_test... in the current master, running `go test" in cmd/hcdev/ fails with the output I sent you. Is this "supposed to happen" because of some pathing or something?

Irrespective of that, the Sprintf from this test here isnt functioning from the test in this commit: cdbfd68f72d2c7c95445862dda1f36b89a6c2d4e [ed: yah, since "SPrintf" creates a String, and isnt "Printf", pal)

func TestLocationOfExecutable(t *testing.T) {
  Convey("should print the location of the executable", t, func() {
    location  := LocationOfExecutable()
    fmt.Sprintf("locationOfExecutable: %v", location)
      So(location, ShouldEqual, "something")
  })
}
christopher@holochain:~/dev.bin2hcdcev/cmd/hcdev$ go test
x
Failures:

  * /home/christopher/dev.bin2hcdcev/cmd/hcdev/hcdev_test.go 
  Line 22:
  Expected: 'something'
  Actual:   '/tmp/go-build892150939/_/home/christopher/dev.bin2hcdcev/cmd/hcdev/_test'
  (Should be equal)

1 total assertion

--- FAIL: TestLocationOfExecutable (0.00s)
FAIL
exit status 1
FAIL    _/home/christopher/dev.bin2hcdcev/cmd/hcdev     0.007s
zippy commented 7 years ago

Ok so to be able to use go test you have to first do a gx-go rewrite (or make work which is the same thing) from the base level. Then go test from inside cmd/hc and cmd/hcdev should work.

christopherreay commented 7 years ago

@zippy thanks. Oh yeah. Thats not something that happens in dockerContainers. Cool that make life easier. Aye, because the import names are changed to ipfs hashes init

christopherreay commented 7 years ago

So, hcdev has three commands so far implemented in this branch:

  1. hcdev core branch install
    • this checks that the current directory is at the root of metacurrency/holochain
    • and copies the files over $GOPATH/src/github.com/metacurrency/holochain
    • and then runs make bs, hc, hcdev

      resulting in an installation of the current checked out branch you are sitting in

there should probably be a "reset" command to go back to master And loads of other stuff, but hey. .Its versioning jim

  1. hcdev app ini

    • interactively initialises a diretory to be a Holochain App directory

      end up with .hc directory with an App name in it

  2. hcdev app testScenario --scenario=scenarioName

    • runs the testScenario script we all know and love

      ends up with loads of colorful output on the screen and a file in logs/holochain/

TODO:

zippy commented 7 years ago

looking pretty good. A few things:

christopherreay commented 7 years ago
zippy commented 7 years ago

ok so I just tried this: hcdev core branch install and I got:

HC: core.branch.install: installing from: /home/eric/go/src/github.com/metacurrency/holochain
this will remove the existing content at /home/eric/go/src/github.com/metacurrency/holochain (y/N) y
/home/eric/go/src/github.com/metacurrency/holochain/bin/holochain.core.testing.branch: line 13: /home/eric/go/src/github.com/metacurrency/holochain/bin/holochain.tools.confirm: No such file or directory
HC: exiting

This left things in a bad state because my directory got emptied, but not completely deleted which meant that a go get -d github.com/metacurrency/holochain failed until I manually went and removed the directory!

christopherreay commented 7 years ago
  1. yeah. It doesnt make any sense to run that command from there. Ill put in a check for it.
  2. Also the fact that bin/holochain.system.install isnt installed is on the todo list for stuff that is currently "broken".
    • if bin/holochain.... is installed, it works, with the caveat above
christopherreay commented 7 years ago

Actually the script holochain.core.testing.branch isnt very well written. I was a bit swamped in addressing the go side of it to bother properly with the script.

Ill put as many checks as possible in the go code before runing the scripts. But most of the scripts are very defensively written. I think all of them apart from that one would fail immediately on running

zippy commented 7 years ago

why should you have to run hcdev core branch install from anywhere in particular. It seems like the context is global and singular, so it should just happen to GOPATH no matter where you run that command from. The app parts of the command are contextual so it makes sense that they would assume the current directory as the context (or, perhaps we also add a --path option so you can specify it explicity)

christopherreay commented 7 years ago

why should you have to run hcdev core branch install from anywhere in particular

because it doesnt checkout a branch or anything like that, it just copies the local source files over the GOPATH version of metacurrency/holochain, and runs make etc

. It seems like the context is global singular, so it should just happen to GOPATH no matter where you run that command from.

I dont think that is from the same point of view as that thing is for from my point of view :)

The app parts of the command are contextual so it makes sense that they would assume the current directory as the context (or, perhaps we also add a --path option so you can specify it explicity)

thats exactly how it works now

christopherreay commented 7 years ago

There's no reason why it couldnt just use git to download a branch over the top of $GOPATH and then install. I can do that. Obvs thats what I was thinking, I was just working on the interface between go and the scripts.

Also, it was quite convenient to be able to just compile my current version without going via github, but maybe that can be another command with a better name

zippy commented 7 years ago

ok, got it... yah currently that script does this check:

[ ! -f ./bin/holochain.system.checkInstalled ] && { echo "HC: not in a holochain core directory. exitting" && exit 1 ; }

which I assume is to see if the current directory is a holochain app, and then tries to copy that app into the GOPATH? :-P

zippy commented 7 years ago

regarding: "I just dont like writing things that people can only understand onces they already are part of your ecosystem." I think maybe I just need to be retrained or something, because for me meaning comes from compression. And when things get too long I loose the meaning. I find it much more confusing and hard to work with. I get that verbose stuff is easier to learn about, but I'm interested in what's easiest to work with. And I think I'm not usual in that regard. Fortunately "github.com/urfave/cli" allows for aliases for commands, so maybe we can come up with something that will satisfy both of us...

christopherreay commented 7 years ago

Id also rename hc to holochain and have hcdev as a subcommand so holochain development app testScenario SCENARIONAME or holochain developer app testScenario SCENARIONAME

yah, I imagine we can do that I have a pretty hands off approach to my sensory input, i let it be a little blury

zippy commented 7 years ago

Arg! That would drive me totally nuts!

christopherreay commented 7 years ago

what about hc dapp scenario SCENARIONAME Thats cool

Sadly im half joking. lets just implement them all, I cant think of a reason not to

zippy commented 7 years ago

I don't see the difference between that and:

hcdev scenario SCENARIONAME

they seem totally equivalent.

christopherreay commented 7 years ago

one of them has the word "app" in it, which ties in with all the documentation the otherone clearly shows psychotic, sociopathic and possibly demented tendencies

zippy commented 7 years ago

ah, now I understand. That makes it all so clear!

christopherreay commented 7 years ago

so hc == holochain is the primary namespace dapp and dcore both compile nicely to both

which is nice and scenario in the context of holochain dapp is sufficiently expressive

if you must know :)