roadrunner-server / roadrunner-plugins

📦 Home for the roadrunner plugins
MIT License
25 stars 9 forks source link

feat(server): `on_init` config option #133

Closed rustatian closed 2 years ago

rustatian commented 2 years ago

Reason for This PR

closes: #57

Description of Changes

Config:

# Application server settings (docs: https://roadrunner.dev/docs/php-worker)
server:
  on_init:
    # Command to execute before the main server's command
    #
    # This option is required if using on_init
    command: "any php or script here"

    # Script execute timeout
    #
    # Default: 60s [60m, 60h], if used w/o units its means - NANOSECONDS.
    exec_timeout: 20s

    # Environment variables for the worker processes.
    #
    # Default: <empty map>
    env:
      - SOME_KEY: "SOME_VALUE"
      - SOME_KEY2: "SOME_VALUE2" 

  # Worker starting command, with any required arguments.
  #
  # This option is required.
  command: "php psr-worker.php"

  # Username (not UID) for the worker processes. An empty value means to use the RR process user.
  #
  # Default: ""
  user: ""

  # Group name (not GID) for the worker processes. An empty value means to use the RR process user.
  #
  # Default: ""
  group: ""

  # Environment variables for the worker processes.
  #
  # Default: <empty map>
  env:
    - SOME_KEY: "SOME_VALUE"
    - SOME_KEY2: "SOME_VALUE2"

  # Worker relay can be: "pipes", TCP (eg.: tcp://127.0.0.1:6002), or socket (eg.: unix:///var/run/rr.sock).
  #
  # Default: "pipes"
  relay: pipes

  # Timeout for relay connection establishing (only for socket and TCP port relay).
  #
  # Default: 60s
  relay_timeout: 60s

License Acceptance

By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.

PR Checklist

[Author TODO: Meet these criteria.] [Reviewer TODO: Verify that these criteria are met. Request changes if not]

codecov[bot] commented 2 years ago

Codecov Report

Merging #133 (dda4909) into master (7f2a4ac) will decrease coverage by 0.09%. The diff coverage is 68.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #133      +/-   ##
==========================================
- Coverage   65.23%   65.13%   -0.10%     
==========================================
  Files         137      138       +1     
  Lines       10912    10984      +72     
==========================================
+ Hits         7118     7154      +36     
- Misses       3082     3107      +25     
- Partials      712      723      +11     
Impacted Files Coverage Δ
rpc/config.go 100.00% <ø> (ø)
server/plugin.go 68.57% <59.61%> (-3.43%) :arrow_down:
server/config.go 66.66% <62.50%> (-33.34%) :arrow_down:
server/oninit.go 80.43% <80.43%> (ø)
tcp/handler/handler.go 51.35% <0.00%> (-6.09%) :arrow_down:
boltdb/boltjobs/listener.go 58.49% <0.00%> (-2.84%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 7f2a4ac...dda4909. Read the comment docs.