Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents

For a complete, working app based on these notes, see https://github.com/apache/infrastructure-testapp/

Pipservices

Pipservices is a term Infra uses to refer to single packages of services, or "apps", that are installed and run independently of each other within a larger package, like Gitbox. Pipservices tie into our configuration management system, and Infra can enable, manage and disable a specific pipservice quickly and as demand dictates. Having app components at this level of granularity simplifies day-to-day workflows, allows to much easier assessment of resource consumption, and aids debugging by separating both processes and security environments.

Creating a pipservice

  1. Create a new git repository for your service with a name in the style of infrastructure-$NAME (e.g. infrastructure-testapp)
    1. your entire service script and config examples will live here
  2. Create a requirements.txt file listing all required python libraries
  3. Create a systemd unit file called pipservice-$NAME.service: (e.g., pipservice-testapp.service)

    Code Block
    languageyml
    titleSample systemd script
    [Unit]
    Description=Test Application
    
    [Service]
    Type=simple
    WorkingDirectory=/opt/$NAME
    User=$OWNER
    Group=$GROUP
    ExecStart=$RUNCMD
    Restart=on-failure
    
    [Install]
    WantedBy=multi-user.target


    1. If $OWNER and/or $GROUP are not supplied, these values will default to 'root' and 'root'.
    2. A valid $RUNCMD for python3 would be

      /usr/local/bin/pipenv run python3 testapp.py 


See Pipservices-invoking and managing for how to use an existing pipservice.