Finish adding redis cache/session support
This commit is contained in:
parent
640f33514c
commit
4087c70ec8
|
@ -7,6 +7,7 @@ class AppKernel extends Kernel
|
||||||
{
|
{
|
||||||
public function registerBundles()
|
public function registerBundles()
|
||||||
{
|
{
|
||||||
|
|
||||||
$bundles = [
|
$bundles = [
|
||||||
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
|
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
|
||||||
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
|
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
|
||||||
|
@ -14,7 +15,9 @@ class AppKernel extends Kernel
|
||||||
new Symfony\Bundle\MonologBundle\MonologBundle(),
|
new Symfony\Bundle\MonologBundle\MonologBundle(),
|
||||||
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
|
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
|
||||||
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
|
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
|
||||||
|
new Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(),
|
||||||
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
|
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
|
||||||
|
new \Snc\RedisBundle\SncRedisBundle(),
|
||||||
new Sikofitt\DoughnutWeddingBundle\SikofittDoughnutWeddingBundle(),
|
new Sikofitt\DoughnutWeddingBundle\SikofittDoughnutWeddingBundle(),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ imports:
|
||||||
- { resource: parameters.yml }
|
- { resource: parameters.yml }
|
||||||
- { resource: security.yml }
|
- { resource: security.yml }
|
||||||
- { resource: services.yml }
|
- { resource: services.yml }
|
||||||
|
- { resource: snc_redis.yml }
|
||||||
|
|
||||||
# Put parameters here that don't need to change on each machine where the app is deployed
|
# Put parameters here that don't need to change on each machine where the app is deployed
|
||||||
# http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
|
# http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
|
||||||
|
@ -11,8 +12,13 @@ parameters:
|
||||||
locale: en
|
locale: en
|
||||||
|
|
||||||
framework:
|
framework:
|
||||||
|
cache:
|
||||||
|
app: cache.adapter.redis
|
||||||
|
system: cache.adapter.redis
|
||||||
|
default_redis_provider: "redis://redis"
|
||||||
#esi: ~
|
#esi: ~
|
||||||
#translator: { fallbacks: ['%locale%'] }
|
translator: { fallbacks: ['%locale%'] }
|
||||||
|
|
||||||
secret: '%secret%'
|
secret: '%secret%'
|
||||||
router:
|
router:
|
||||||
resource: '%kernel.root_dir%/config/routing.yml'
|
resource: '%kernel.root_dir%/config/routing.yml'
|
||||||
|
@ -28,8 +34,9 @@ framework:
|
||||||
trusted_proxies: ~
|
trusted_proxies: ~
|
||||||
session:
|
session:
|
||||||
# http://symfony.com/doc/current/reference/configuration/framework.html#handler-id
|
# http://symfony.com/doc/current/reference/configuration/framework.html#handler-id
|
||||||
handler_id: session.handler.native_file
|
handler_id: snc_redis.session.handler
|
||||||
save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%"
|
#handler_id: session.handler.native_file
|
||||||
|
#save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%"
|
||||||
fragments: ~
|
fragments: ~
|
||||||
http_method_override: true
|
http_method_override: true
|
||||||
assets: ~
|
assets: ~
|
||||||
|
@ -59,10 +66,54 @@ doctrine:
|
||||||
#path: '%database_path%'
|
#path: '%database_path%'
|
||||||
|
|
||||||
orm:
|
orm:
|
||||||
|
query_cache_driver:
|
||||||
|
type: predis
|
||||||
|
host: ~
|
||||||
|
port: ~
|
||||||
|
instance_class: ~
|
||||||
|
class: ~
|
||||||
|
id: ~
|
||||||
|
namespace: doughnut_query_cache
|
||||||
|
cache_provider: 'predis'
|
||||||
|
metadata_cache_driver:
|
||||||
|
type: predis
|
||||||
|
host: ~
|
||||||
|
port: ~
|
||||||
|
instance_class: ~
|
||||||
|
class: ~
|
||||||
|
id: ~
|
||||||
|
namespace: doughnut_metadata_cache
|
||||||
|
cache_provider: 'predis'
|
||||||
|
result_cache_driver:
|
||||||
|
type: predis
|
||||||
|
host: ~
|
||||||
|
port: ~
|
||||||
|
instance_class: ~
|
||||||
|
class: ~
|
||||||
|
id: ~
|
||||||
|
namespace: doughnut_result_cache
|
||||||
|
cache_provider: 'predis'
|
||||||
|
second_level_cache:
|
||||||
|
region_cache_driver:
|
||||||
|
type: predis
|
||||||
|
host: ~
|
||||||
|
port: ~
|
||||||
|
instance_class: ~
|
||||||
|
class: ~
|
||||||
|
id: ~
|
||||||
|
namespace: doughnut_region_cache
|
||||||
|
cache_provider: 'predis'
|
||||||
|
|
||||||
auto_generate_proxy_classes: '%kernel.debug%'
|
auto_generate_proxy_classes: '%kernel.debug%'
|
||||||
naming_strategy: doctrine.orm.naming_strategy.underscore
|
naming_strategy: doctrine.orm.naming_strategy.underscore
|
||||||
auto_mapping: true
|
auto_mapping: true
|
||||||
|
|
||||||
|
doctrine_cache:
|
||||||
|
providers:
|
||||||
|
predis:
|
||||||
|
type: predis
|
||||||
|
namespace: doughnut_doctrine
|
||||||
|
|
||||||
# Swiftmailer Configuration
|
# Swiftmailer Configuration
|
||||||
swiftmailer:
|
swiftmailer:
|
||||||
transport: '%mailer_transport%'
|
transport: '%mailer_transport%'
|
||||||
|
|
|
@ -18,9 +18,16 @@ monolog:
|
||||||
path: '%kernel.logs_dir%/%kernel.environment%.log'
|
path: '%kernel.logs_dir%/%kernel.environment%.log'
|
||||||
level: debug
|
level: debug
|
||||||
channels: ['!event']
|
channels: ['!event']
|
||||||
|
formatter: colored_line_formatter
|
||||||
console:
|
console:
|
||||||
type: console
|
type: console
|
||||||
channels: ['!event', '!doctrine']
|
channels: ['!event', '!doctrine']
|
||||||
|
redis_logger:
|
||||||
|
type: service
|
||||||
|
id: snc_redis.monolog.handler
|
||||||
|
level: debug
|
||||||
|
|
||||||
|
|
||||||
# uncomment to get logging in your browser
|
# uncomment to get logging in your browser
|
||||||
# you may have to allow bigger header sizes in your Web server configuration
|
# you may have to allow bigger header sizes in your Web server configuration
|
||||||
#firephp:
|
#firephp:
|
||||||
|
|
|
@ -1,21 +1,15 @@
|
||||||
imports:
|
imports:
|
||||||
- { resource: config.yml }
|
- { resource: config.yml }
|
||||||
|
|
||||||
#doctrine:
|
|
||||||
# orm:
|
|
||||||
# metadata_cache_driver: apc
|
|
||||||
# result_cache_driver: apc
|
|
||||||
# query_cache_driver: apc
|
|
||||||
|
|
||||||
monolog:
|
monolog:
|
||||||
handlers:
|
handlers:
|
||||||
main:
|
main:
|
||||||
type: fingers_crossed
|
type: fingers_crossed
|
||||||
action_level: error
|
action_level: error
|
||||||
handler: nested
|
handler: redis
|
||||||
nested:
|
|
||||||
type: stream
|
|
||||||
path: '%kernel.logs_dir%/%kernel.environment%.log'
|
|
||||||
level: debug
|
|
||||||
console:
|
console:
|
||||||
type: console
|
type: console
|
||||||
|
redis:
|
||||||
|
type: service
|
||||||
|
id: snc_redis.monolog.handler
|
||||||
|
level: debug
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
# Learn more about services, parameters and containers at
|
# Learn more about services, parameters and containers at
|
||||||
# http://symfony.com/doc/current/service_container.html
|
# http://symfony.com/doc/current/service_container.html
|
||||||
parameters:
|
parameters:
|
||||||
#parameter_name: value
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
#service_name:
|
colored_line_formatter:
|
||||||
# class: AppBundle\Directory\ClassName
|
class: Bramus\Monolog\Formatter\ColoredLineFormatter
|
||||||
# arguments: ['@another_service_name', 'plain_value', '%parameter_name%']
|
tags:
|
||||||
|
- { name: 'monolog.logger' }
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
snc_redis:
|
||||||
|
clients:
|
||||||
|
default:
|
||||||
|
type: predis
|
||||||
|
alias: default
|
||||||
|
dsn: redis://redis
|
||||||
|
logging: '%kernel.debug%'
|
||||||
|
monolog:
|
||||||
|
type: predis
|
||||||
|
alias: monolog
|
||||||
|
dsn: redis://redis/5
|
||||||
|
logging: false
|
||||||
|
options:
|
||||||
|
connection_persistent: true
|
||||||
|
cache:
|
||||||
|
type: predis
|
||||||
|
alias: cache
|
||||||
|
dsn: redis://redis/3
|
||||||
|
options:
|
||||||
|
profile: 2.2
|
||||||
|
connection_timeout: 10
|
||||||
|
read_write_timeout: 30
|
||||||
|
profiler_storage:
|
||||||
|
type: predis
|
||||||
|
alias: profiler_storage
|
||||||
|
dsn: redis://redis/10
|
||||||
|
session:
|
||||||
|
type: predis
|
||||||
|
alias: session
|
||||||
|
dsn: redis://redis/4
|
||||||
|
logging: true
|
||||||
|
session:
|
||||||
|
client: session
|
||||||
|
prefix: 'doughnut:session:'
|
||||||
|
monolog:
|
||||||
|
client: monolog
|
||||||
|
key: monolog
|
||||||
|
formatter: colored_line_formatter
|
||||||
|
profiler_storage:
|
||||||
|
client: profiler_storage
|
||||||
|
ttl: 3600
|
||||||
|
doctrine:
|
||||||
|
metadata_cache:
|
||||||
|
client: cache
|
||||||
|
entity_manager: default
|
||||||
|
document_manager: default
|
||||||
|
namespace: 'doughnut:doctrine:metadata:'
|
||||||
|
result_cache:
|
||||||
|
client: cache
|
||||||
|
entity_manager: default
|
||||||
|
document_manager: default
|
||||||
|
namespace: 'doughnut:doctrine:result:'
|
||||||
|
query_cache:
|
||||||
|
client: cache
|
||||||
|
entity_manager: default
|
||||||
|
namespace: 'doughnut:doctrine:query:'
|
||||||
|
second_level_cache:
|
||||||
|
client: cache
|
||||||
|
entity_manager: default
|
||||||
|
namespace: 'doughnut:doctrine:second_level:'
|
||||||
|
swiftmailer:
|
||||||
|
client: default
|
||||||
|
key: swiftmailer
|
|
@ -15,7 +15,7 @@
|
||||||
"php": ">=7.1",
|
"php": ">=7.1",
|
||||||
"bramus/monolog-colored-line-formatter": "^2.0",
|
"bramus/monolog-colored-line-formatter": "^2.0",
|
||||||
"doctrine/doctrine-bundle": "^1.6",
|
"doctrine/doctrine-bundle": "^1.6",
|
||||||
"doctrine/doctrine-cache-bundle": "^1.2",
|
"doctrine/doctrine-cache-bundle": "^1.3",
|
||||||
"doctrine/orm": "^2.5",
|
"doctrine/orm": "^2.5",
|
||||||
"egulias/email-validator": "^2.1",
|
"egulias/email-validator": "^2.1",
|
||||||
"google/recaptcha": "^1.1",
|
"google/recaptcha": "^1.1",
|
||||||
|
@ -37,6 +37,7 @@
|
||||||
"ravenberg/uikit-bundle": "^1.0",
|
"ravenberg/uikit-bundle": "^1.0",
|
||||||
"sensio/distribution-bundle": "^5.0",
|
"sensio/distribution-bundle": "^5.0",
|
||||||
"sensio/framework-extra-bundle": "^3.0.2",
|
"sensio/framework-extra-bundle": "^3.0.2",
|
||||||
|
"snc/redis-bundle": "^2.0",
|
||||||
"symfony/monolog-bundle": "^3.0.2",
|
"symfony/monolog-bundle": "^3.0.2",
|
||||||
"symfony/polyfill-apcu": "^1.0",
|
"symfony/polyfill-apcu": "^1.0",
|
||||||
"symfony/security": "^3.2",
|
"symfony/security": "^3.2",
|
||||||
|
@ -46,6 +47,7 @@
|
||||||
"symfony/swiftmailer-bundle": "^2.3.10",
|
"symfony/swiftmailer-bundle": "^2.3.10",
|
||||||
"symfony/symfony": "3.2.*",
|
"symfony/symfony": "3.2.*",
|
||||||
"tedivm/stash": "^0.14.1",
|
"tedivm/stash": "^0.14.1",
|
||||||
|
"tedivm/stash-bundle": "^0.6.2",
|
||||||
"twig/extensions": "^1.4",
|
"twig/extensions": "^1.4",
|
||||||
"twig/twig": "^1.0||^2.0"
|
"twig/twig": "^1.0||^2.0"
|
||||||
},
|
},
|
||||||
|
|
|
@ -21,6 +21,8 @@ services:
|
||||||
volumes:
|
volumes:
|
||||||
- ./:/var/www
|
- ./:/var/www
|
||||||
- ./web:/var/www/html
|
- ./web:/var/www/html
|
||||||
|
links:
|
||||||
|
- redis
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
- "APP_ENV=development"
|
- "APP_ENV=development"
|
||||||
|
|
|
@ -13,9 +13,9 @@
|
||||||
if (!isset($_SERVER['HTTP_HOST'])) {
|
if (!isset($_SERVER['HTTP_HOST'])) {
|
||||||
exit('This script cannot be run from the CLI. Run it from a browser.');
|
exit('This script cannot be run from the CLI. Run it from a browser.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
|
if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
|
||||||
'127.0.0.1',
|
'127.0.0.1',
|
||||||
'172.19.0.1',
|
|
||||||
'::1',
|
'::1',
|
||||||
))) {
|
))) {
|
||||||
header('HTTP/1.0 403 Forbidden');
|
header('HTTP/1.0 403 Forbidden');
|
||||||
|
@ -417,7 +417,6 @@ $hasMinorProblems = (bool) count($minorProblems);
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="version">Symfony Standard Edition</div>
|
<div class="version">Symfony Standard Edition</div>
|
||||||
<?php phpinfo(); ?>
|
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue