shopen-group/satis-hook

dev-develop 2019-06-07 11:41 UTC

This package is not auto-updated.

Last update: 2024-04-07 08:55:06 UTC


README

Build Status

Simple app for rebuilding composer/satis via webhook.

  • No database required

Install

Install composer package

composer require shopen-group/satis-hook dev-develop

Create config

# config.yaml
secret:
  enabled: true # secret token is enabled
  location: param # location of "secret" parameter (param|header)
  value: veslo # secret value
  name: key # secret parameter name

satis:
  php: /usr/bin/php
  bin: ../satis/bin/satis 
  config: ../satis.json 
  output: ../web

Create entrypoint

Our entrypoint will be hook.php which is publicly accessible via HTTP.

ApplicationFactory::createApplication has three parameters. You can customise the first two of them.

  • path to config.yaml
  • path to writable TEMP folder (for storing requests)
<?php declare(strict_types=1);

require_once __DIR__ . '/vendor/autoload.php';

use ShopenGroup\SatisHook\ApplicationFactory;

$application = ApplicationFactory::createApplication(__DIR__ . '/config.yaml', __DIR__ . '/temp', __DIR__ . '/logs', $argc);
$application->run();

Usage

Webhook

The app is accepting GET and POST requests through https://127.0.0.1/hook.php. There is an optional parameter "build-all". If the "build-all" parameter is present in request you can build all packages not necessarily just one particular package (http:/127.0.0.1/hook.php?repository=package/name).

Queue process

There is a second "layer" of application - queue processing. To start processing accepted requests you have to run command below via CLI.

php hook.php satis-hook:build

We use supervisord to keep queue processing up.