This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var nowjs = require("now"), | |
express = require('express'), | |
auth = require('basic-auth'); | |
// create server | |
var server = express.createServer(); | |
server.configure(function () { | |
server.use(express.logger()); | |
server.use(auth.basicAuth); | |
server.use(express.bodyParser()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "node.js server-now" | |
start on started mountall | |
stop on shutdown | |
respawn | |
respawn limit 99 5 | |
script | |
exec node <<APP_PATH>>/application/servers/server-now.js >> /var/log/node-resize.log 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
description "resize image worker gearman" | |
start on started mountall | |
stop on shutdown | |
respawn | |
respawn limit 99 5 | |
script | |
exec php <<project_path>>/application/workers/resize_image_worker.php >> /var/log/resize-image-job.log 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php #if (!defined('BASEPATH')) { exit('No direct script access allowed'); } | |
class Notifier { | |
private $CI; | |
public function __construct() | |
{ | |
$this->CI =& get_instance(); | |
$this->CI->load->spark('restclient/2.0.0'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include_once dirname(__FILE__) . '/worker_helper.php'; | |
$gmw = new GearmanWorker(); | |
$gmw->addServer(); | |
$gmw->addFunction("resize_image", "resize_image"); | |
# waiting for job | |
while($gmw->work()){ | |
if($gmw->returnCode() != GEARMAN_SUCCESS) break; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
# load stack codeigniter | |
include_once dirname(__FILE__) . '/../third_party/CIUnit/bootstrap_phpunit.php'; | |
require_default_class_job_this_worker(); | |
function require_default_class_job_this_worker() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php #if (!defined('BASEPATH')) { exit('No direct script access allowed'); } | |
include_once dirname(__FILE__) . '/notifier.php'; | |
class ResizeImageJob { | |
private $CI; | |
private $params; | |
private $notifier; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include_once dirname(__FILE__) . '/spec_helper.php'; | |
include_once APPPATH . '/workers/resize_image_job.php'; | |
require_once 'PHPSpec/Mocks/Functions.php'; | |
use \Mockery as m; | |
class DescribeResizeImageJob extends \PHPSpec\Context | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include_once dirname(__FILE__) . '/../application/third_party/CIUnit/bootstrap_phpunit.php'; | |
require_once 'Mockery/Loader.php'; | |
require_once 'Hamcrest/hamcrest.php'; | |
$loader = new \Mockery\Loader; | |
$loader->register(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php echo form_open_multipart('jobs/upload');?> | |
<input type="file" name="userfile" size="20" /> <br /> | |
<input type="submit" value="upload" /> | |
</form> |