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

Run the pnpm service in the background #960

Closed
zkochan opened this issue Dec 9, 2017 · 10 comments · Fixed by #995
Closed

Run the pnpm service in the background #960

zkochan opened this issue Dec 9, 2017 · 10 comments · Fixed by #995
Assignees

Comments

@zkochan
Copy link
Member

zkochan commented Dec 9, 2017

Once #832 is done, we'd like an option to run the service in the background, automatically.

Possibly the https://github.com/IonicaBizau/diable can be used to achieve this

@zkochan
Copy link
Member Author

zkochan commented Jan 15, 2018

So I tried the diable by Ionica Bizau and it works like a charm!

The only issue is that once the server runs in the background, there is no easy way to stop it.

There will be a new command: pnpm server stop for stopping the store server.

pnpm server will be renamed to pnpm server start.

pnpm server will print help for the server commands.

zkochan added a commit that referenced this issue Jan 15, 2018
zkochan added a commit to pnpm/server that referenced this issue Jan 15, 2018
@etamponi
Copy link
Member

etamponi commented Jan 15, 2018 via email

@zkochan
Copy link
Member Author

zkochan commented Jan 15, 2018

I think pnpm server start will still run it in the foreground by default. There will be a flag to run a background server on pnpm install. And another flag for pnpm server, something like pnpm server start --background

@etamponi
Copy link
Member

Cool. Another important thing: if the server is running in the foreground, pnpm server stop should not do anything, or at least I need a flag to disable it. Otherwise, in Glitch, any user can stop the pnpm server globally for everyone 😨

@zkochan
Copy link
Member Author

zkochan commented Jan 15, 2018

Interesting, maybe we can have something like pnpm server start --unstoppable

zkochan added a commit to pnpm/server that referenced this issue Jan 15, 2018
zkochan added a commit to pnpm/server that referenced this issue Jan 15, 2018
zkochan added a commit that referenced this issue Jan 15, 2018
zkochan added a commit that referenced this issue Jan 15, 2018
zkochan added a commit to pnpm/server that referenced this issue Jan 16, 2018
zkochan added a commit that referenced this issue Jan 16, 2018
* feat(server): add stop command

ref #960

* feat(server): `pnpm server` becomes `pnpm server start`

SEMI-BREAKING CHANGE:

`pnpm server` doesn't start a server but only prints help

`pnpm server start` starts a store server

* refactor: rename unstoppable to ignore-stop-requests
zkochan added a commit that referenced this issue Jan 16, 2018
zkochan added a commit that referenced this issue Jan 16, 2018
@vjpr
Copy link
Contributor

vjpr commented Jan 18, 2018

Running pnpm server while an existing server is running shows this:

pnpm server
 WARN  The store server is an experimental feature. Breaking changes may happen in non-major versions.
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE /Users/Vaughan/.pnpm-store/2/socket
    at Object._errnoException (util.js:1024:11)
    at _exceptionWithHostPort (util.js:1046:20)
    at Server.setupListenHandle [as _listen2] (net.js:1334:19)
    at listenInCluster (net.js:1392:12)
    at Server.listen (net.js:1487:5)
    at Object.default_1 [as createServer] (/Users/Vaughan/nvm/versions/node/v8.9.0/pnpm-global/1/node_modules/.registry.npmjs.org/@pnpm/server/0.6.2/@pnpm!logger@1.0.0/node_modules/@pnpm/server/lib/createServer.js:109:27)
    at Object.<anonymous> (/Users/Vaughan/nvm/versions/node/v8.9.0/pnpm-global/1/node_modules/.registry.npmjs.org/pnpm/1.29.1/node_modules/pnpm/lib/cmd/server.js:42:29)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/Vaughan/nvm/versions/node/v8.9.0/pnpm-global/1/node_modules/.registry.npmjs.org/pnpm/1.29.1/node_modules/pnpm/lib/cmd/server.js:4:58)
    at <anonymous>

A more helpful error would be better.

@vjpr
Copy link
Contributor

vjpr commented Jan 18, 2018

Also, is there anyway to see that the server is being used? Some kind of log messages?

My expectation would be that running pnpm server status would bring stdout to foreground, and it would show me a message when the server is running an install.

@zkochan
Copy link
Member Author

zkochan commented Jan 18, 2018

I think pnpm server status can print some info about the server. Like whether it runs or not, what port it uses, etc.

pnpm server attach can bring the server to the foreground (similarly as docker attach)

zkochan added a commit that referenced this issue Jan 18, 2018
* feat: running server in the background

close #960

* feat: store server can run in the background

* fix: update diable to version 4.0.1

* feat(help): add server start/stop to commands list

* feat: better info messages about server start
@zkochan
Copy link
Member Author

zkochan commented Jan 19, 2018

🚢 published with pnpm@1.30.0

@zkochan
Copy link
Member Author

zkochan commented Jan 19, 2018

Created follow-up issues: #997, #998

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants