Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(daemon) ipfs daemon --initialized #355

Merged
merged 27 commits into from
Nov 18, 2014
Merged

feat(daemon) ipfs daemon --initialized #355

merged 27 commits into from
Nov 18, 2014

Conversation

btc
Copy link
Contributor

@btc btc commented Nov 16, 2014

With this PR, users can fetch and run ipfs in one command.

docker run -d -p 4001:4001 -p 5001:5001 jbenet/go-ipfs daemon --initialized

Magic.

nb: needs ipfs/go-datastore#9

@btc btc added the status/in-progress In progress label Nov 16, 2014
@btc btc force-pushed the feat/daemon-init branch 2 times, most recently from af3be64 to 68613ee Compare November 16, 2014 21:51
@whyrusleeping
Copy link
Member

👍 ❤️

@whyrusleeping
Copy link
Member

is this PR accidentally mixed with your other logging PR?

@btc
Copy link
Contributor Author

btc commented Nov 17, 2014

@whyrusleeping Good observation. No, it's not an accident.

Out of productivity concerns, both for me and the reviewers involved, I'm experimenting with a more fluid approach to PRs. I intend to include minor, general improvements--so long as they don't significantly harm readability or detract from the focus of the change set. Pulling out weeds as I go along, you know?


EXPOSE 4001

ENTRYPOINT ["ipfs"]
ENTRYPOINT ["ipfs2"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's make a note of changing this back to cmd/ipfs and add it to the milestone once this PR is done.

Brian Tiger Chow added 7 commits November 17, 2014 00:43
This commit updates go-datastore in order to access new LevelDb Close()
method

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
@mappum @jbenet LGTU?

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
allow framework to add level to log so level can be applied when using
text formatter

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
@jbenet @whyrusleeping @mappum

If we permit initialization in `ipfs daemon`, then we must ensure that
the node instantiated in `ipfs init` (to create the welcome file) shuts
down and releases resources.

Kept running into "resource temporarily unavailable". Discovered that it
was our cousins Jeff and Sanjay over at LevelDB Ave.

go-datastore doesn't expose Close() so I extended the TsDs interface and
submitted a patch.

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>

Signed-off-by: Brian Tiger Chow <brian.holderchow@gmail.com>
initCmd: cmdDetails{doesNotUseConfigAsInput: true, cannotRunOnDaemon: true, doesNotUseRepo: true},

// daemonCmd allows user to initialize the config. Thus, it may be called
// without using the config as input
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for listing here the reasoning behind each option. it's important to track that somewhere. we got sloppy in the rush

@jbenet
Copy link
Member

jbenet commented Nov 17, 2014

@maybebtc cool PR! Some comments above.

Here's a checklist to make sure to address:

  • dockerfile ipfs2 -> ipfs milestone note
  • re-vendor new datastore (already merged)
  • fork logrus?
  • --initialized -> --init
  • clear errors confusion
  • fix ContextCloser close func

@btc
Copy link
Contributor Author

btc commented Nov 17, 2014

I'd like to propose that we make a conscious decision to use our errors package as errors. The errors are helpful enough that the practice may pay off in a big way (in terms of ease of development) if we can get religious about using them (internally) instead of the standard error.

Previously, they were debugerror, but this was a bit long.

reverting to debugerror. makes sense.

@jbenet
Copy link
Member

jbenet commented Nov 17, 2014

@maybebtc i can get behind using our own errors package. Just note there is a cost in naming it the same thing: it confuses outsiders. Agree that debugerror is too long. maybe ierr, ierrors, iperrs, dbgerr? (and it doesnt matter what you name the directory itself. the beauty of explicit imports :) )

@btc
Copy link
Contributor Author

btc commented Nov 17, 2014

I'd prefer to stick to generic names for the generic, generally-applicable packages. Keeps us honest as we try to break apart these generic libraries and make them available for use outside of the project. With that in mind, I'm open to any name we choose.

@btc
Copy link
Contributor Author

btc commented Nov 18, 2014

ping @jbenet

@jbenet
Copy link
Member

jbenet commented Nov 18, 2014

@maybebtc check it out: 6b2adf8!

@jbenet
Copy link
Member

jbenet commented Nov 18, 2014

@maybebtc LGTM too. sec, i'm figuring out the error

@jbenet
Copy link
Member

jbenet commented Nov 18, 2014

Interesting, the test really broke. ipfs cat without mount is broken-- it only returns 256K of data. wat.

@jbenet
Copy link
Member

jbenet commented Nov 18, 2014

Well, fun:

> random 104857600 42 >bigfile
> ipfs2 add bigfile
added QmWXysX1oysyjTqd5xGM2T1maBaVXnk5svQv4GKo5PsGPo bigfile
> ipfs2 cat QmWXysX1oysyjTqd5xGM2T1maBaVXnk5svQv4GKo5PsGPo > bigfile2
> diff bigfile bigfile2
Binary files bigfile and bigfile2 differ
> du *
100M    bigfile
256K    bigfile2

Brian Tiger Chow and others added 20 commits November 17, 2014 22:36
@jbenet

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>

# TYPES
# feat
# fix
# docs
# style (formatting, missing semi colons, etc; no code change):
# refactor
# test (adding missing tests, refactoring tests; no production code change)
# chore (updating grunt tasks etc; no production code change)

Signed-off-by: Brian Tiger Chow <brian.holderchow@gmail.com>
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>

# TYPES
# feat
# fix
# docs
# style (formatting, missing semi colons, etc; no code change):
# refactor
# test (adding missing tests, refactoring tests; no production code change)
# chore (updating grunt tasks etc; no production code change)

Signed-off-by: Brian Tiger Chow <brian.holderchow@gmail.com>
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>

# TYPES
# feat
# fix
# docs
# style (formatting, missing semi colons, etc; no code change):
# refactor
# test (adding missing tests, refactoring tests; no production code change)
# chore (updating grunt tasks etc; no production code change)

Signed-off-by: Brian Tiger Chow <brian.holderchow@gmail.com>
will support daemon initialization

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>

# TYPES
# feat
# fix
# docs
# style (formatting, missing semi colons, etc; no code change):
# refactor
# test (adding missing tests, refactoring tests; no production code change)
# chore (updating grunt tasks etc; no production code change)

Signed-off-by: Brian Tiger Chow <brian.holderchow@gmail.com>
@jbenet @whyrusleeping @mappum

very helpful for tracking down errors. the stack traces are only
shown when debug mode is visible. They function best when caught at the
source.

I propose we use this errors package as a drop-in replacement for
fmt.Errorf and errors.New in all of our code, and use errors.Wrap for
external errors as they emerge from others' libraries.

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>

Signed-off-by: Brian Tiger Chow <brian.holderchow@gmail.com>
@jbenet

now, ipfs can be built and executed in one step:
```
docker run jbenet/go-ipfs daemon --initialized
```

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
@jbenet

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
@jbenet

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
@jbenet

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
@jbenet

yeah, these are just sane defaults

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
this is silly but whatever

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
looking forward to fixing these again

License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
License: MIT
Signed-off-by: Brian Tiger Chow <brian@perfmode.com>
Warning: during normal execution node teardown must be the
last thing that happens because command requests return
io.Readers, which may still be constructing or processing
their output. The node (and its subservices) is needed for
this. good night and good luck.
jbenet added a commit that referenced this pull request Nov 18, 2014
feat(daemon) `ipfs daemon --initialized`
@jbenet jbenet merged commit 6107612 into master Nov 18, 2014
@jbenet jbenet removed the status/in-progress In progress label Nov 18, 2014
@jbenet jbenet deleted the feat/daemon-init branch November 18, 2014 07:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants