From d51fa92206813da16b5766ae7333e29b30a27551 Mon Sep 17 00:00:00 2001 From: iglocska Date: Fri, 12 Sep 2014 13:29:30 +0200 Subject: [PATCH 1/2] Changes to CakeResque installation fixes #287 - CakeResque's installation instructions changed --- .gitignore | 2 ++ .gitmodules | 3 --- INSTALL/INSTALL.SH | 8 +++++--- INSTALL/INSTALL.txt | 19 ++++++++++++++----- INSTALL/UPGRADE.SH | 6 +++++- INSTALL/UPGRADE.txt | 1 + INSTALL/setup/config.php | 21 +++------------------ app/Config/core.default.php | 2 ++ 8 files changed, 32 insertions(+), 30 deletions(-) diff --git a/.gitignore b/.gitignore index e83c4920b..8445cc55b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ /vendors +/app/Vendor +/app/composer* /lib /.project /.settings diff --git a/.gitmodules b/.gitmodules index ef7897f77..c3db514d7 100755 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "app/Plugin/CakeResque"] - path = app/Plugin/CakeResque - url = https://github.com/kamisama/Cake-Resque.git [submodule "app/Lib/cakephp"] path = app/Lib/cakephp url = https://github.com/cakephp/cakephp.git diff --git a/INSTALL/INSTALL.SH b/INSTALL/INSTALL.SH index 4d673fc2c..770bdad4c 100755 --- a/INSTALL/INSTALL.SH +++ b/INSTALL/INSTALL.SH @@ -36,9 +36,11 @@ git config core.filemode false cd "$MISP_PATH" git submodule init git submodule update -cd "$MISP_PATH/app/Plugin/CakeResque" -curl -s https://getcomposer.org/installer | php -php composer.phar install +cd "$MISP_PATH/app" +chown -R www-data:www-data "$MISP_PATH" +chmod -R 750 "$MISP_PATH" +chmod -R g+ws "$MISP_PATH/app/tmp" +chmod -R g+ws "$MISP_PATH/app/files" cd "$MISP_PATH" chown -R www-data:www-data "$MISP_PATH" chmod -R 750 "$MISP_PATH" diff --git a/INSTALL/INSTALL.txt b/INSTALL/INSTALL.txt index c5c748066..fac681e41 100755 --- a/INSTALL/INSTALL.txt +++ b/INSTALL/INSTALL.txt @@ -45,18 +45,28 @@ git clone https://github.com/MISP/MISP.git cd /var/www/MISP git config core.filemode false -4/ CakePHP (and CakeResque) +4/ CakePHP ----------- # CakePHP is now included as a submodule of MISP, execute the following commands to let git fetch it: git submodule init git submodule update -# Once done, install the dependencies of CakeResque if you intend to use the built in background jobs: -cd /var/www/MISP/app/Plugin/CakeResque +# Once done, install CakeResque along with its dependencies if you intend to use the built in background jobs: +cd /var/www/MISP/app curl -s https://getcomposer.org/installer | php +php composer.phar require --no-update kamisama/cake-resque:4.1.0 +php composer.phar config vendor-dir Vendor php composer.phar install +# Once CakeResque is installed, make sure to enable it by uncommenting the following lines: +# in Core.php (if you have just recently updated MISP, just add this line at the end of the file): +# require_once dirname(__DIR__) . '/Vendor/autoload.php'; + +# in bootstrap.php uncomment the following line (at the end of the file): +# CakePlugin::loadAll(array('CakeResque' => array('bootstrap' => true))); +# set Configure::write('MISP.background_jobs', false); to Configure::write('MISP.background_jobs', true); + # CakeResque normally uses phpredis to connect to redis, but it has a (buggy) fallback connector through Redisent. It is highly advised to install phpredis pecl install redis # After installing it, enable it in your php.ini file @@ -146,8 +156,7 @@ sudo -u www-data gpg --homedir /var/www/MISP/.gnupg --gen-key sudo -u www-data gpg --homedir /var/www/MISP/.gnupg --export --armor YOUR-EMAIL > /var/www/MISP/app/webroot/gpg.asc # Start the workers to enable background jobs -cd /var/www/MISP/app/Console/worker/ -./start.sh +/var/www/MISP/app/Console/worker/start.sh # To make the background workers start on boot chmod +x /var/www/MISP/app/Console/worker/start.sh diff --git a/INSTALL/UPGRADE.SH b/INSTALL/UPGRADE.SH index 71fab54a3..7d7baeaf6 100755 --- a/INSTALL/UPGRADE.SH +++ b/INSTALL/UPGRADE.SH @@ -49,9 +49,13 @@ else echo "Error, you need either apt-get, yum or brew to install Redis using this script. Please install it manually."; fi -cd "$MISP_PATH/app/Plugin/CakeResque" +cd "$MISP_PATH/app" + curl -s https://getcomposer.org/installer | php +php composer.phar require --no-update kamisama/cake-resque:4.1.0 +php composer.phar config vendor-dir Vendor php composer.phar install + cd "$MISP_PATH" chown -R www-data:www-data "$MISP_PATH" chmod -R 750 "$MISP_PATH" diff --git a/INSTALL/UPGRADE.txt b/INSTALL/UPGRADE.txt index 12ec7bf9d..28ff07948 100755 --- a/INSTALL/UPGRADE.txt +++ b/INSTALL/UPGRADE.txt @@ -22,6 +22,7 @@ Enabling background jobs via CakeResque - vim /var/www/MISP/app/Config/bootstrap.php - set Configure::write('MISP.background_jobs', false); to Configure::write('MISP.background_jobs', true); - uncomment CakePlugin::load('CakeResque', array('bootstrap' => true)); + - in Core.php (if you have just recently updated MISP, just add this line at the end of the file): require_once dirname(__DIR__) . '/Vendor/autoload.php'; - start the background workers - cd /var/www/MISP/app/Console/worker/ diff --git a/INSTALL/setup/config.php b/INSTALL/setup/config.php index eb4334c49..ca7364c1d 100644 --- a/INSTALL/setup/config.php +++ b/INSTALL/setup/config.php @@ -69,7 +69,8 @@ $config['CakeResque'] = array( 'host' => 'localhost', // Redis server hostname 'port' => 6379, // Redis server port 'database' => 0, // Redis database number - 'namespace' => 'resque' // Redis keys namespace + 'namespace' => 'resque', // Redis keys namespace + 'password' => null // Redis password ), 'Worker' => array( @@ -98,7 +99,7 @@ $config['CakeResque'] = array( // // You can also define per-job tracking by passing true/false when calling // CakeResque::enqueue(), CakeResque::enqueueAt() or CakeResque::enqueueIn() - 'track' => true + 'track' => false ), /* 'Queues' => array( @@ -113,16 +114,6 @@ $config['CakeResque'] = array( ) */ 'Resque' => array( - - // Path to the php-resque library - // - // Relative or absolute path to the php-resque library - // If you are using Composer to install dependencies, - // this is the name of the vendor library - // Path is relative to the CakeResque/vendor - // Don't add trailing slash to path - 'lib' => 'kamisama/php-resque-ex', - // Path to the directory containing the worker PID files 'tmpdir' => App::pluginPath('CakeResque') . 'tmp' . DS ), @@ -184,8 +175,6 @@ $config['CakeResque'] = array( // Enable or disable delayed job 'enabled' => true, - // Path to the php-resque-ex-scheduler's library - 'lib' => 'kamisama/php-resque-ex-scheduler', // Path to the log file 'log' => TMP . 'logs' . DS . 'resque-scheduler-error.log', @@ -207,9 +196,5 @@ $config['CakeResque'] = array( 'handler' => 'RotatingFile', 'target' => TMP . 'logs' . DS . 'resque-scheduler.log' ) - ), - 'Status' => array( - // Path to the resque-status library - 'lib' => 'kamisama/resque-status', ) ); diff --git a/app/Config/core.default.php b/app/Config/core.default.php index f5cd5dd75..102b159ef 100644 --- a/app/Config/core.default.php +++ b/app/Config/core.default.php @@ -277,3 +277,5 @@ Cache::config('_cake_model_', array( 'serialize' => ($engine === 'File'), 'duration' => $duration )); + +//require_once dirname(__DIR__) . '/Vendor/autoload.php'; \ No newline at end of file From f8557f631634fcdad7613324e6049bd6a824b45e Mon Sep 17 00:00:00 2001 From: iglocska Date: Fri, 12 Sep 2014 13:33:01 +0200 Subject: [PATCH 2/2] Copy pasta fail --- INSTALL/INSTALL.SH | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/INSTALL/INSTALL.SH b/INSTALL/INSTALL.SH index 770bdad4c..4e81e3a11 100755 --- a/INSTALL/INSTALL.SH +++ b/INSTALL/INSTALL.SH @@ -37,10 +37,10 @@ cd "$MISP_PATH" git submodule init git submodule update cd "$MISP_PATH/app" -chown -R www-data:www-data "$MISP_PATH" -chmod -R 750 "$MISP_PATH" -chmod -R g+ws "$MISP_PATH/app/tmp" -chmod -R g+ws "$MISP_PATH/app/files" +curl -s https://getcomposer.org/installer | php +php composer.phar require --no-update kamisama/cake-resque:4.1.0 +php composer.phar config vendor-dir Vendor +php composer.phar install cd "$MISP_PATH" chown -R www-data:www-data "$MISP_PATH" chmod -R 750 "$MISP_PATH"