Project Manager.

Project Manager makes it easier to keep track of your micro-services by grouping together related services; stop/start/build and set dependencies.

Article image for: Project Manager

Getting Started.

Getting Started
Working with Services
Setting Config Options
Scripting Setup

Github Print

Getting Started

Project Manager (spm from here), works through a set of config files that are stored in the primary spm config folder. By default this is in ~/.config/spm_projects.d. When you first run spm it will prompt to run: spm init if this folder does not exist.

Note: spm will use XDG_CONFIG_HOME if defined, otherwise will default to ~/.config as per the XDG Base Directory spec. You can update existing configurations by moving the folder to ~/.config/spm_projects.d. The older ~/.spm_projects.d is still supported.

The base folder can be changed by defining the env var: SOMNAMBULIST_PROJECT_MANAGER_DIR. Please note that spm expects all config to still be located within your home folder. Once running SOMNAMBULIST_PROJECTS_CONFIG_DIR is used as the fully qualified path to the spm configuration folder.

By default projects are expected to be organised in ~/Projects/<project_name>. The projects default folder can be changed by editing the project_manager.yaml file and changing the projects_dir.

Please note that this folder should exist within your home folder. spm does not support folders that are not located within your current users home as it relies heavily on the $_ENV['HOME'] variable to determine paths.

The default config file looks like:

    cache_dir: '${SOMNAMBULIST_PROJECTS_CONFIG_DIR}/_cache'
    projects_dir: 'Projects'

            bundle: ~
            client: ~
            library: ~

            data: ''
            logging: ''
            api: ''
            app: ''
            web: 'composer:symfony/skeleton'
            symfony: 'composer:symfony/skeleton'

You can check the current spm setup by using spm check. This will show you all the current configuration locations and if the configuration was initialised properly. Add --debug or -d to output the config and env file contents if they exist.

Terminal and IDE integration

spm includes two helpers to make navigating a project easier: open and goto. open will open an IDE (default PhpStorm) with the specified library and goto will start a new terminal session at the library. If no library (library here being a library or a service) is specified, a list of all options for the project will be presented.

In both cases the script / IDE can be configured by setting the following ENV vars in your .bashrc or .zshrc or shell init file:

  • SOMNAMBULIST_EDITOR=XXXX - to override the PHP IDE. This should support a CLI command: e.g. atom
  • SOMNAMBULIST_TERMINAL_SCRIPT - a script that can open a new terminal at a path

By default, goto expects to work on macOS and uses osascript to launch a new terminal session.