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

Services API #146

Closed
3 of 7 tasks
acburdine opened this issue Feb 6, 2017 · 0 comments
Closed
3 of 7 tasks

Services API #146

acburdine opened this issue Feb 6, 2017 · 0 comments

Comments

@acburdine
Copy link
Member

acburdine commented Feb 6, 2017

Within Ghost-CLI there are currently several "concepts":

  • commands - full commands that have arguments and options
    • e.g. ghost install, ghost start etc.
  • tasks - self-contained functions reused between commands
  • process managers - ways of running ghost

These concepts work for most of the usages of the CLI, however there are several things the CLI still needs to do that don't fit into a particular category. The main ones (listed in #64) are setting up nginx and ssl. Both of these things are not super complex, but still need things done at specific times during various commands.

So, to encapsulate & abstract some of the operations and setup of nginx and ssl (and whatever else may come or be needed), there is going to be an additional concept added to the CLI: Services


Design

  • Hooks
    • Services should be able to hook into various CLI commands to do various things
      • example: during ghost setup an nginx/ssl service should be able to set up various config files
  • Commands
    • while adding commands to the root of ghost might be tricky due to the need to resolve external commands, so we should potentially add a ghost service command which could handle installation of external services (ghost service install) as well as any custom commands that a provider might define
      • example: ghost service ssl for an ssl provider might call the letsencrypt renew function. This could be set as a cron task to run every so often.

Resolution

Because services would be installed globally, there needs to be a resolution process that is able to reliably find all of the globally installed services and load them. This is not a trivial process - Yeoman accomplishes it using a sort of "guess and check" method (see this file for how it's done). With the introduction of Yarn, however, there can be now be multiple places that globally installed modules are actually installed. (yarn installs all of its global modules in a different location than that of npm by default)

So, here's the thought for resolution: ghost service install would install a service globally using yarn. Instead of installing it to yarn's default global node_modules folder, it would instead place it inside a folder in the user's HOME directory, as well as adding the service to a config file in the same folder. That way, there is one place that all the providers are installed, making the resolution process much less of a guess, and therefore (hopefully) much faster.

This resolution process would be extended to process managers as well, in a sense making them a special type of service, in a sense.


TODOs

  • Short-term
    • build out initial api in the CLI itself
    • Add nginx and ssl service so that they are present in every install of the CLI (pr - [WIP] Nginx #159)
  • Long-term
    • extract base service into a separate NPM module
    • move nginx and ssl service into separate npm modules - still required by Ghost-CLI though
    • build out resolution process
@acburdine acburdine changed the title Providers API Services API Feb 16, 2017
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Feb 17, 2017
refs TryGhost#146
- add ServiceManager and Service base classes
- convert ProcessManager classes and related utilities to use the
ServiceManager
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Feb 17, 2017
refs TryGhost#146
- add ServiceManager and Service base classes
- convert ProcessManager classes and related utilities to use the
ServiceManager
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Feb 17, 2017
refs TryGhost#146
- add ServiceManager and Service base classes
- convert ProcessManager classes and related utilities to use the
ServiceManager
- move process manager default to advanced config options
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Feb 17, 2017
refs TryGhost#146
- add ServiceManager and Service base classes
- convert ProcessManager classes and related utilities to use the
ServiceManager
- move process manager default to advanced config options
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Feb 17, 2017
refs TryGhost#146
- add ServiceManager and Service base classes
- convert ProcessManager classes and related utilities to use the
ServiceManager
- move process manager default to advanced config options
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Feb 18, 2017
refs TryGhost#146
- add ServiceManager and Service base classes
- convert ProcessManager classes and related utilities to use the
ServiceManager
- move process manager default to advanced config options
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Feb 18, 2017
refs TryGhost#146
- add ServiceManager and Service base classes
- convert ProcessManager classes and related utilities to use the
ServiceManager
- move process manager default to advanced config options
acburdine added a commit that referenced this issue Feb 18, 2017
refs #146
- add ServiceManager and Service base classes
- convert ProcessManager classes and related utilities to use the
ServiceManager
- move process manager default to advanced config options
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Feb 28, 2017
refs TryGhost#146
- add registerCommand utilities as well as "ghost service <name>"
command
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Feb 28, 2017
refs TryGhost#146
- add registerCommand utilities as well as "ghost service <name>"
command
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Mar 1, 2017
refs TryGhost#146
- add registerCommand utilities as well as "ghost service <name>"
command
acburdine added a commit that referenced this issue Mar 2, 2017
refs #146
- add registerCommand utilities as well as "ghost service <name>"
command
@acburdine acburdine mentioned this issue Jun 27, 2017
3 tasks
acburdine added a commit to acburdine/Ghost-CLI that referenced this issue Jun 29, 2017
closes TryGhost#146
- add new Extensions API
- refactor setup command to be less of a piece of crap
- cleanup lots of things
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants