Example #1
0
<?php

use Symfony\Component\HttpFoundation\Request;
use Keboola\Syrup\Debug\Debug;
// If you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
umask(02);
// This check prevents access to debug front controllers that are deployed by accident to production servers.
// Feel free to remove this, extend it, or make something more sophisticated.
define('ROOT_PATH', __DIR__ . '/../');
$loader = (require_once __DIR__ . '/../app/bootstrap.php.cache');
Debug::enable('dev');
require_once __DIR__ . '/../app/AppKernel.php';
$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
Example #2
0
<?php

require_once __DIR__ . '/../vendor/autoload.php';
use Keboola\Syrup\Debug\Debug;
defined('SYRUP_APP_NAME') || define('SYRUP_APP_NAME', getenv('SYRUP_APP_NAME') ? getenv('SYRUP_APP_NAME') : 'syrup-test');
defined('SYRUP_DATABASE_PORT') || define('SYRUP_DATABASE_PORT', getenv('SYRUP_DATABASE_PORT') ? getenv('SYRUP_DATABASE_PORT') : null);
defined('SYRUP_DATABASE_HOST') || define('SYRUP_DATABASE_HOST', getenv('SYRUP_DATABASE_HOST') ? getenv('SYRUP_DATABASE_HOST') : '127.0.0.1');
defined('SYRUP_DATABASE_USER') || define('SYRUP_DATABASE_USER', getenv('SYRUP_DATABASE_USER') ? getenv('SYRUP_DATABASE_USER') : 'syrup');
defined('SYRUP_DATABASE_PASSWORD') || define('SYRUP_DATABASE_PASSWORD', getenv('SYRUP_DATABASE_PASSWORD') ? getenv('SYRUP_DATABASE_PASSWORD') : null);
defined('SYRUP_DATABASE_NAME') || define('SYRUP_DATABASE_NAME', getenv('SYRUP_DATABASE_NAME') ? getenv('SYRUP_DATABASE_NAME') : 'syrup');
defined('SYRUP_AWS_KEY') || define('SYRUP_AWS_KEY', getenv('SYRUP_AWS_KEY') ? getenv('SYRUP_AWS_KEY') : null);
defined('SYRUP_AWS_SECRET') || define('SYRUP_AWS_SECRET', getenv('SYRUP_AWS_SECRET') ? getenv('SYRUP_AWS_SECRET') : null);
defined('SYRUP_AWS_REGION') || define('SYRUP_AWS_REGION', getenv('SYRUP_AWS_REGION') ? getenv('SYRUP_AWS_REGION') : 'us-east-1');
defined('SYRUP_SAPI_TEST_URL') || define('SYRUP_SAPI_TEST_URL', getenv('SYRUP_SAPI_TEST_URL') ? getenv('SYRUP_SAPI_TEST_URL') : null);
defined('SYRUP_SAPI_TEST_TOKEN') || define('SYRUP_SAPI_TEST_TOKEN', getenv('SYRUP_SAPI_TEST_TOKEN') ? getenv('SYRUP_SAPI_TEST_TOKEN') : null);
defined('SYRUP_ELASTICSEARCH_HOST') || define('SYRUP_ELASTICSEARCH_HOST', getenv('SYRUP_ELASTICSEARCH_HOST') ? getenv('SYRUP_ELASTICSEARCH_HOST') : 'http://127.0.0.1:9200');
defined('SYRUP_SQS_URL') || define('SYRUP_SQS_URL', getenv('SYRUP_SQS_URL') ? getenv('SYRUP_SQS_URL') : 'https://sqs.us-east-1.amazonaws.com/[id]/[name]');
defined('SYRUP_S3_BUCKET') || define('SYRUP_S3_BUCKET', getenv('SYRUP_S3_BUCKET') ? getenv('SYRUP_S3_BUCKET') : 'keboola-logs/debug-files');
$paramsYaml = \Symfony\Component\Yaml\Yaml::dump(['parameters' => ['app_name' => SYRUP_APP_NAME, 'secret' => md5(uniqid()), 'encryption_key' => md5(uniqid()), 'database_driver' => 'pdo_mysql', 'database_port' => SYRUP_DATABASE_PORT, 'database_host' => SYRUP_DATABASE_HOST, 'database_user' => SYRUP_DATABASE_USER, 'database_password' => SYRUP_DATABASE_PASSWORD, 'database_name' => SYRUP_DATABASE_NAME, 'syrup.driver' => 'pdo_mysql', 'syrup.port' => SYRUP_DATABASE_PORT, 'syrup.host' => SYRUP_DATABASE_HOST, 'syrup.user' => SYRUP_DATABASE_USER, 'syrup.password' => SYRUP_DATABASE_PASSWORD, 'syrup.name' => SYRUP_DATABASE_NAME, 'locks_db.driver' => 'pdo_mysql', 'locks_db.port' => SYRUP_DATABASE_PORT, 'locks_db.host' => SYRUP_DATABASE_HOST, 'locks_db.user' => SYRUP_DATABASE_USER, 'locks_db.password' => SYRUP_DATABASE_PASSWORD, 'locks_db.name' => SYRUP_DATABASE_NAME, 'doctrine_migrations_dir' => __DIR__ . "/../DoctrineMigrations", 'uploader' => ['aws-access-key' => SYRUP_AWS_KEY, 'aws-secret-key' => SYRUP_AWS_SECRET, 's3-upload-path' => SYRUP_S3_BUCKET, 'aws-region' => SYRUP_AWS_REGION, 'url-prefix' => 'https://connection.keboola.com/admin/utils/logs?file='], 'storage_api.url' => SYRUP_SAPI_TEST_URL, 'storage_api.test.url' => SYRUP_SAPI_TEST_URL, 'storage_api.test.token' => SYRUP_SAPI_TEST_TOKEN, 'elasticsearch' => ['hosts' => [SYRUP_ELASTICSEARCH_HOST]], 'elasticsearch.index_prefix' => 'devel', 'queue' => ['url' => null, 'db_table' => 'queues'], 'components' => []]]);
file_put_contents(__DIR__ . '/../app/config/parameters.yml', $paramsYaml);
touch(__DIR__ . '/../app/config/parameters_shared.yml');
$db = \Doctrine\DBAL\DriverManager::getConnection(['driver' => 'pdo_mysql', 'host' => SYRUP_DATABASE_HOST, 'dbname' => SYRUP_DATABASE_NAME, 'user' => SYRUP_DATABASE_USER, 'password' => SYRUP_DATABASE_PASSWORD, 'port' => SYRUP_DATABASE_PORT]);
$stmt = $db->prepare(file_get_contents(__DIR__ . '/db.sql'));
$stmt->execute();
$stmt->closeCursor();
$db->insert('queues', ['id' => 'default', 'access_key' => SYRUP_AWS_KEY, 'secret_key' => SYRUP_AWS_SECRET, 'region' => SYRUP_AWS_REGION, 'url' => SYRUP_SQS_URL]);
passthru('php vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php ' . 'app vendor');
passthru(sprintf('php "%s/../app/console" cache:clear --env=test', __DIR__));
passthru(sprintf('php "%s/../app/console" syrup:create-index -d  --env=test', __DIR__));
Debug::enable(null, true, 'test');
Example #3
0
<?php

use Keboola\Syrup\Debug\Debug;
use Symfony\Component\HttpFoundation\Request;
umask(02);
define('ROOT_PATH', __DIR__ . '/../');
$loader = (require_once __DIR__ . '/../app/bootstrap.php.cache');
// Use APC for autoloading to improve performance.
// Change 'sf2' to a unique prefix in order to prevent cache key conflicts
// with other applications also using APC.
/*
$loader = new ApcClassLoader('sf2', $loader);
$loader->register(true);
*/
Debug::enable('prod');
require_once __DIR__ . '/../app/AppKernel.php';
//require_once __DIR__.'/../app/AppCache.php';
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
// Because of ELB we need to trust to all incoming requests
Request::setTrustedProxies(array($request->server->get('REMOTE_ADDR')));
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);
Example #4
0
<?php

use Symfony\Component\HttpFoundation\Request;
use Keboola\Syrup\Debug\Debug;
// If you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
umask(02);
// This check prevents access to debug front controllers that are deployed by accident to production servers.
// Feel free to remove this, extend it, or make something more sophisticated.
define('ROOT_PATH', __DIR__ . '/../');
$loader = (require_once __DIR__ . '/../app/bootstrap.php.cache');
Debug::enable(null, true, 'dev');
require_once __DIR__ . '/../app/AppKernel.php';
$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
$request = Request::createFromGlobals();
$response = $kernel->handle($request);
$response->send();
$kernel->terminate($request, $response);