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()
|
||||
{
|
||||
|
||||
$bundles = [
|
||||
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
|
||||
new Symfony\Bundle\SecurityBundle\SecurityBundle(),
|
||||
|
@ -14,7 +15,9 @@ class AppKernel extends Kernel
|
|||
new Symfony\Bundle\MonologBundle\MonologBundle(),
|
||||
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
|
||||
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
|
||||
new Doctrine\Bundle\DoctrineCacheBundle\DoctrineCacheBundle(),
|
||||
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
|
||||
new \Snc\RedisBundle\SncRedisBundle(),
|
||||
new Sikofitt\DoughnutWeddingBundle\SikofittDoughnutWeddingBundle(),
|
||||
];
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ imports:
|
|||
- { resource: parameters.yml }
|
||||
- { resource: security.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
|
||||
# http://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
|
||||
|
@ -11,8 +12,13 @@ parameters:
|
|||
locale: en
|
||||
|
||||
framework:
|
||||
cache:
|
||||
app: cache.adapter.redis
|
||||
system: cache.adapter.redis
|
||||
default_redis_provider: "redis://redis"
|
||||
#esi: ~
|
||||
#translator: { fallbacks: ['%locale%'] }
|
||||
translator: { fallbacks: ['%locale%'] }
|
||||
|
||||
secret: '%secret%'
|
||||
router:
|
||||
resource: '%kernel.root_dir%/config/routing.yml'
|
||||
|
@ -28,8 +34,9 @@ framework:
|
|||
trusted_proxies: ~
|
||||
session:
|
||||
# http://symfony.com/doc/current/reference/configuration/framework.html#handler-id
|
||||
handler_id: session.handler.native_file
|
||||
save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%"
|
||||
handler_id: snc_redis.session.handler
|
||||
#handler_id: session.handler.native_file
|
||||
#save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%"
|
||||
fragments: ~
|
||||
http_method_override: true
|
||||
assets: ~
|
||||
|
@ -59,10 +66,54 @@ doctrine:
|
|||
#path: '%database_path%'
|
||||
|
||||
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%'
|
||||
naming_strategy: doctrine.orm.naming_strategy.underscore
|
||||
auto_mapping: true
|
||||
|
||||
doctrine_cache:
|
||||
providers:
|
||||
predis:
|
||||
type: predis
|
||||
namespace: doughnut_doctrine
|
||||
|
||||
# Swiftmailer Configuration
|
||||
swiftmailer:
|
||||
transport: '%mailer_transport%'
|
||||
|
|
|
@ -18,9 +18,16 @@ monolog:
|
|||
path: '%kernel.logs_dir%/%kernel.environment%.log'
|
||||
level: debug
|
||||
channels: ['!event']
|
||||
formatter: colored_line_formatter
|
||||
console:
|
||||
type: console
|
||||
channels: ['!event', '!doctrine']
|
||||
redis_logger:
|
||||
type: service
|
||||
id: snc_redis.monolog.handler
|
||||
level: debug
|
||||
|
||||
|
||||
# uncomment to get logging in your browser
|
||||
# you may have to allow bigger header sizes in your Web server configuration
|
||||
#firephp:
|
||||
|
|
|
@ -1,21 +1,15 @@
|
|||
imports:
|
||||
- { resource: config.yml }
|
||||
|
||||
#doctrine:
|
||||
# orm:
|
||||
# metadata_cache_driver: apc
|
||||
# result_cache_driver: apc
|
||||
# query_cache_driver: apc
|
||||
|
||||
monolog:
|
||||
handlers:
|
||||
main:
|
||||
type: fingers_crossed
|
||||
action_level: error
|
||||
handler: nested
|
||||
nested:
|
||||
type: stream
|
||||
path: '%kernel.logs_dir%/%kernel.environment%.log'
|
||||
level: debug
|
||||
handler: redis
|
||||
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
|
||||
# http://symfony.com/doc/current/service_container.html
|
||||
parameters:
|
||||
#parameter_name: value
|
||||
|
||||
services:
|
||||
#service_name:
|
||||
# class: AppBundle\Directory\ClassName
|
||||
# arguments: ['@another_service_name', 'plain_value', '%parameter_name%']
|
||||
colored_line_formatter:
|
||||
class: Bramus\Monolog\Formatter\ColoredLineFormatter
|
||||
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",
|
||||
"bramus/monolog-colored-line-formatter": "^2.0",
|
||||
"doctrine/doctrine-bundle": "^1.6",
|
||||
"doctrine/doctrine-cache-bundle": "^1.2",
|
||||
"doctrine/doctrine-cache-bundle": "^1.3",
|
||||
"doctrine/orm": "^2.5",
|
||||
"egulias/email-validator": "^2.1",
|
||||
"google/recaptcha": "^1.1",
|
||||
|
@ -37,6 +37,7 @@
|
|||
"ravenberg/uikit-bundle": "^1.0",
|
||||
"sensio/distribution-bundle": "^5.0",
|
||||
"sensio/framework-extra-bundle": "^3.0.2",
|
||||
"snc/redis-bundle": "^2.0",
|
||||
"symfony/monolog-bundle": "^3.0.2",
|
||||
"symfony/polyfill-apcu": "^1.0",
|
||||
"symfony/security": "^3.2",
|
||||
|
@ -46,6 +47,7 @@
|
|||
"symfony/swiftmailer-bundle": "^2.3.10",
|
||||
"symfony/symfony": "3.2.*",
|
||||
"tedivm/stash": "^0.14.1",
|
||||
"tedivm/stash-bundle": "^0.6.2",
|
||||
"twig/extensions": "^1.4",
|
||||
"twig/twig": "^1.0||^2.0"
|
||||
},
|
||||
|
|
|
@ -21,6 +21,8 @@ services:
|
|||
volumes:
|
||||
- ./:/var/www
|
||||
- ./web:/var/www/html
|
||||
links:
|
||||
- redis
|
||||
restart: always
|
||||
environment:
|
||||
- "APP_ENV=development"
|
||||
|
|
|
@ -13,9 +13,9 @@
|
|||
if (!isset($_SERVER['HTTP_HOST'])) {
|
||||
exit('This script cannot be run from the CLI. Run it from a browser.');
|
||||
}
|
||||
|
||||
if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
|
||||
'127.0.0.1',
|
||||
'172.19.0.1',
|
||||
'::1',
|
||||
))) {
|
||||
header('HTTP/1.0 403 Forbidden');
|
||||
|
@ -417,7 +417,6 @@ $hasMinorProblems = (bool) count($minorProblems);
|
|||
</div>
|
||||
</div>
|
||||
<div class="version">Symfony Standard Edition</div>
|
||||
<?php phpinfo(); ?>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in New Issue