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

Offline daemon mode #2696

Merged
merged 8 commits into from
May 31, 2016
Merged

Offline daemon mode #2696

merged 8 commits into from
May 31, 2016

Conversation

Kubuxu
Copy link
Member

@Kubuxu Kubuxu commented May 15, 2016

Resolves #2393

@@ -136,6 +137,7 @@ future version, along with this notice. Please move to setting the HTTP Headers.
cmds.BoolOption(unencryptTransportKwd, "Disable transport encryption (for debugging protocols)"),
cmds.BoolOption(enableGCKwd, "Enable automatic periodic repo garbage collection"),
cmds.BoolOption(adjustFDLimitKwd, "Check and raise file descriptor limits if needed"),
cmds.BoolOption(offlineKwd, "Run in offline. Do not connect with rest of the network but provide local API.").Default(false),
Copy link

Choose a reason for hiding this comment

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

Does it also still provide the gateway?

Copy link
Member Author

@Kubuxu Kubuxu May 15, 2016

Choose a reason for hiding this comment

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

Yes it does. Finalizing sharness tests for it.

@Kubuxu Kubuxu added the need/review Needs a review label May 15, 2016
@@ -416,6 +419,10 @@ func serveHTTPApi(req cmds.Request) (error, <-chan error) {

// printSwarmAddrs prints the addresses of the host
func printSwarmAddrs(node *core.IpfsNode) {
if !node.OnlineMode() {
fmt.Print("Swarm not listening, running in offline mode.\n")
Copy link
Member

Choose a reason for hiding this comment

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

i prefer using fmt.Println and omitting the trailing newline from the string

@Kubuxu Kubuxu force-pushed the feature/Offline-2393 branch 2 times, most recently from 6c817de to e400df0 Compare May 15, 2016 19:16
@whyrusleeping
Copy link
Member

we probably want to add a few more tests for various bits of the functionality. maybe at the end of t0040-add-and-cat.sh we can do test_launch_daemon --offline; test_Add_cat_file; test_kill_ipfs_daemon or similar

@Kubuxu
Copy link
Member Author

Kubuxu commented May 15, 2016

Good that you requested this test as problem looks harder that it was.
I am pushing the test now but I will fix it tomorrow.

@Kubuxu Kubuxu removed the need/review Needs a review label May 15, 2016
@Kubuxu Kubuxu added the need/author-input Needs input from the original author label May 17, 2016
@Kubuxu Kubuxu self-assigned this May 23, 2016
@Kubuxu Kubuxu added need/review Needs a review and removed need/author-input Needs input from the original author labels May 23, 2016
@Kubuxu
Copy link
Member Author

Kubuxu commented May 23, 2016

Yey, tests are passing. Awaiting review, if it is successful I will squash everything later.

@@ -136,6 +137,7 @@ future version, along with this notice. Please move to setting the HTTP Headers.
cmds.BoolOption(unencryptTransportKwd, "Disable transport encryption (for debugging protocols)").Default(false),
cmds.BoolOption(enableGCKwd, "Enable automatic periodic repo garbage collection").Default(false),
cmds.BoolOption(adjustFDLimitKwd, "Check and raise file descriptor limits if needed").Default(false),
cmds.BoolOption(offlineKwd, "Run offline. Do not connect with rest of the network but provide local API.").Default(false),
Copy link
Member Author

Choose a reason for hiding this comment

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

@RichardLitt I don't know if the wording is good and clear enough, it would be great if you could take a look.

Copy link
Member

Choose a reason for hiding this comment

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

"Run offline. Do not connect to the rest of the network, but provide only the local API." 👍

Resolves #2393

License: MIT
Signed-off-by: Jakub Sztandera <[email protected]>
License: MIT
Signed-off-by: Jakub Sztandera <[email protected]>
License: MIT
Signed-off-by: Jakub Sztandera <[email protected]>
License: MIT
Signed-off-by: Jakub Sztandera <[email protected]>
License: MIT
Signed-off-by: Jakub Sztandera <[email protected]>
License: MIT
Signed-off-by: Jakub Sztandera <[email protected]>
License: MIT
Signed-off-by: Jakub Sztandera <[email protected]>
@Kubuxu Kubuxu removed their assignment May 25, 2016
@Kubuxu
Copy link
Member Author

Kubuxu commented May 29, 2016

I think it might be worth introducing separate mode of operation as currently Ephemeral == Offline.

@@ -136,6 +137,7 @@ future version, along with this notice. Please move to setting the HTTP Headers.
cmds.BoolOption(unencryptTransportKwd, "Disable transport encryption (for debugging protocols)").Default(false),
cmds.BoolOption(enableGCKwd, "Enable automatic periodic repo garbage collection").Default(false),
cmds.BoolOption(adjustFDLimitKwd, "Check and raise file descriptor limits if needed").Default(false),
cmds.BoolOption(offlineKwd, "Run offline. Do not connect to the rest of the network but provide local API.").Default(false),
Copy link
Member

Choose a reason for hiding this comment

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

provide the local API, maybe?

@whyrusleeping
Copy link
Member

It makes me quite happy how small these changes are. This LGTM, thanks!

@whyrusleeping whyrusleeping merged commit 6a894d6 into master May 31, 2016
@whyrusleeping whyrusleeping deleted the feature/Offline-2393 branch May 31, 2016 16:12
@Kubuxu
Copy link
Member Author

Kubuxu commented May 31, 2016

They are small but were pain to get right. 😄

@hackergrrl
Copy link
Contributor

hackergrrl commented May 31, 2016

Great work @Kubuxu 🎉

@@ -159,7 +159,12 @@ func (i *gatewayHandler) getOrHeadHandler(w http.ResponseWriter, r *http.Request
}

nd, err := core.Resolve(ctx, i.node, path.Path(urlPath))
if err != nil {
// If node is in offline mode the error code and message should be different
if err == core.ErrNoNamesys && !i.node.OnlineMode() {
Copy link
Member

Choose a reason for hiding this comment

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

i think there's other errors here to check alongside !i.node.OnlineMode(). for example, if a /ipfs/... path fails to resolve, it's likely because of no network.

@jbenet
Copy link
Member

jbenet commented Aug 26, 2016

👍 great to have offline mode

hacdias pushed a commit to ipfs/boxo that referenced this pull request Jan 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need/review Needs a review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants