Skip to content

Commit

Permalink
0_o
Browse files Browse the repository at this point in the history
  • Loading branch information
rhift committed May 2, 2018
2 parents 7421221 + 739ec83 commit 4d1d013
Show file tree
Hide file tree
Showing 582 changed files with 8,923 additions and 7,482 deletions.
5 changes: 3 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ARG PROJECT_NAME=jobs

# COMPOSER_TOKEN can also be passed via the COMPOSER_GITHUB_TOKEN file
ARG COMPOSER_TOKEN=placeholder_token_you_must_replace_via_args_in_compose_file
ARG INSTALL_XDEBUG=false
ARG INSTALL_XDEBUG=true
ARG COMPOSER_INSTALL=true

ENV PROJECT_DIR=/var/www/html/${PROJECT_NAME}.neighborhoods.com
Expand All @@ -17,12 +17,13 @@ COPY . $PROJECT_DIR

# Copy xdebug configration for remote debugging
COPY docker/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini
COPY docker/bwilson.ini /usr/local/etc/php/conf.d/bwilson.ini

RUN bash docker/build.sh \
--composer-token ${COMPOSER_TOKEN} \
--xdebug ${INSTALL_XDEBUG} \
--composer-install ${COMPOSER_INSTALL}

CMD ["php-fpm"]
#CMD ["php-fpm"]

EXPOSE 9000
28 changes: 13 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# nhds/jobs
A Distributed Task Manager
# ⚡ Neighborhoods Kōjō ⚡
# 工場
A distributed task manager.

* Including `NHDS\Jobs` with your project with composer
```bash
$ composer require nhds/jobs
```

* Running the `NHDS\Jobs` service
```bash
$ vendor/bin/jobs process:pool:server:start $PWD/PATH/TO/services.yaml
```
### `Kōjō` is a collection of the following components:
* Distributed task management.
* Distributed, cooperative, process-aware semaphores and mutex's.
* Static cron scheduling.
* Multi-process model.
* Status system.
* Distributed IPC.

* Running an exmaple
### Example usage
```bash
$ vendor/bin/phpunit --filter Foreman
$ vendor/bin/jobs process:pool:server:start $PWD/example/config/root.yaml
```
$ bin/kojo process:pool:server:start $PWD/example
```
55 changes: 55 additions & 0 deletions bin/kojo
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env php
<?php
declare(strict_types=1);
ini_set('assert.exception', '1');
error_reporting(E_ALL);

use Neighborhoods\Kojo\Console\Command\Process\Pool\Server\Start;
use Neighborhoods\Pylon\DependencyInjection\ContainerBuilder\Facade;
use Symfony\Component\Finder\Finder;

if (PHP_SAPI !== 'cli') {
echo 'bin/kojo must be run as a CLI application';
exit(1);
}
try{
foreach ([
__DIR__ . '/../../../autoload.php',
__DIR__ . '/../vendor/autoload.php',
] as $autoLoaderFilePathCandidate) {
if (file_exists($autoLoaderFilePathCandidate)) {
require_once $autoLoaderFilePathCandidate;
break;
}
}
}catch(\Exception $exception){
echo 'Autoload error: ' . $exception->getMessage();
exit(1);
}
$containerBuilderFacade = new Facade();
$discoverableDirectories[] = __DIR__ . '/../src';
$finder = new Finder();
$finder->name('*.yml');
if (isset($argv[2]) && is_string($argv[2]) && is_dir($argv[2])) {
$discoverableDirectories[] = $argv[2];
}elseif (isset($argv[1]) && is_string($argv[1]) && $argv[1] === Start::OPT_RUN_SERVER) {
foreach ($argv as $argument) {
if (strstr($argument, Start::OPT_YSDP) !== false) {
$ymlServicesFilePath = explode(Start::OPT_YSDP, $argument);
$discoverableDirectories[] = $ymlServicesFilePath[1];
}
}
$finder->files()->in($discoverableDirectories);
$containerBuilderFacade->addFinder($finder);
$server = $containerBuilderFacade->getContainerBuilder()->get('process.pool.server');
$server->setParentProcessPath('');
$server->start();
exit();
}
$finder->files()->in($discoverableDirectories);
$containerBuilderFacade->addFinder($finder);
$containerBuilder = $containerBuilderFacade->getContainerBuilder();
$consoleApplication = $containerBuilder->get('neighborhoods.kojo.symfony.component.console.application');
$consoleApplication->run();

return;
44 changes: 25 additions & 19 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "nhds/jobs",
"name": "neighborhoods/kojo",
"type": "library",
"description": "NHDS Jobs is meant to solve the problem of easily writing distributed, fast, fault tolerant tasks.",
"description": "Neighborhoods Kōjō is a distributed task manager.",
"license": "proprietary",
"keywords": [],
"authors": [
Expand All @@ -10,38 +10,44 @@
"email": "[email protected]"
}
],
"repositories": [
{
"type": "composer",
"url": "https://satis.neighborhoods.com"
}
],
"require": {
"php": ">=7.1",
"symfony/filesystem": "^4.0",
"symfony/config": "^4.0",
"symfony/yaml": "^4.0",
"symfony/dependency-injection": "^4.0",
"symfony/expression-language": "^4.0",
"symfony/cache": "^4.0",
"symfony/console": "^4.0",
"symfony/finder": "^4.0",
"zendframework/zend-db": "^2.8",
"dragonmantank/cron-expression": "^2.0",
"symfony/filesystem": "~4.0.3",
"symfony/config": "~4.0.3",
"symfony/yaml": "~4.0.3",
"symfony/dependency-injection": "~4.0.3",
"symfony/expression-language": "~4.0.3",
"symfony/cache": "~4.0.3",
"symfony/console": "~4.0.3"
"ocramius/proxy-manager": "^2.1",
"neighborhoods/pylon": "dev-master"
},
"require-dev": {
"phpunit/phpunit": "^6.4",
"phpunit/dbunit": "^3.0",
"symfony/finder": "^4.0"
"phpunit/phpunit": "^7.0",
"phpunit/dbunit": "^4.0",
"neighborhoods/scaffolding": "dev-master"
},
"bin": [
"src/bin/jobs",
"src/bin/server"
"bin/kojo"
],
"autoload": {
"psr-4": {
"NHDS\\Jobs\\": "src",
"NHDS\\Toolkit\\": "nhdstoolkitsrc"
"Neighborhoods\\Kojo\\": "src"
}
},
"autoload-dev": {
"psr-4": {
"NHDS\\Jobs\\Test\\": "tests",
"NHDS\\Watch\\": "nhdswatchsrc",
"NHDS\\Jobs\\Example\\": "example"
"Neighborhoods\\Kojo\\Test\\": "tests",
"Neighborhoods\\Kojo\\Example\\": "example"
}
}
}
Loading

0 comments on commit 4d1d013

Please sign in to comment.