Spin up your development background processes with ease

Content Protection by DMCA.com

Developing software requires a lot of attention to detail, and running background services can often be a hassle. However, that’s where Porter comes in. Porter is a command line tool that makes it easy to run background services with only a few configuration lines. With Porter, you can spin up your development background processes with ease, allowing you to focus on developing your software without worrying about the underlying infrastructure.

Porter is designed to be simple to use and set up. You can install Porter with a single command, and you can start running your background services with just a few lines of configuration. Porter uses a YAML file to specify the services you want to run and how they should be configured. This YAML file acts as a blueprint for your services, and Porter takes care of the rest.

I. Install Porter

Requirements

To use Porter you must install supervisord:

  • macOS: brew install supervisor
  • Linux: apt install supervisor

If you want to use the watch feature to restart services when files change you will also need to install:

  • chokidar: npm install --global chokidar

Installation

To install Porter, you can use composer or download the build manually from this repository.

composer global require anystack-sh/porter

II. Porter Uses Example

One of the great features of Porter is its flexibility. Porter can run any type of service, from web servers to databases, and it supports multiple platforms, including Linux, macOS, and Windows. This means that you can use Porter to run your services on any development machine, regardless of the operating system you are using.

Here’s an example from the project’s readme, which makes it convenient to share a porter.yml file with your team with version control:

services:
  - name: Queue
    command: php artisan horizon
    restart:
        watch:
            - app/Jobs
            - app/Mail/WelcomeEmail.php
 
  - name: Vite
    command: npm run dev
 
  - name: Octane
    command: php artisan octane:start --port=8000 --no-interaction
 
  - name: Stripe
    command: stripe listen --forward-to localhost:8000/webhooks/stripe
    restart:
      minutes: 5

To get started, you can initialize a porter.yml file in your project using the porter init command. From there, you can stop, start, add, restart, tail processes, and get process statuses with porter:

# Tail one or more background services
porter tail
 
# Get the status of all configured services
porter status
 
# Start, stop, and restart all services
porter start
porter stop
porter restart

Conclusion

Porter is a powerful and flexible tool that makes it easy to run background services for your development projects. With its simple setup and configuration process, you can focus on developing your software and let Porter handle the underlying infrastructure. Whether you are developing a web application, a mobile app, or any other type of software, Porter can help you spin up your development background processes with ease.

You can learn more about this package, get full installation instructions, and view the source code on GitHub.

Content Protection by DMCA.com