Skip to content

Instantly share code, notes, and snippets.

@revsbech
Last active May 9, 2016 14:37
Show Gist options
  • Save revsbech/a34c132882b11f570f1d338af065704c to your computer and use it in GitHub Desktop.
Save revsbech/a34c132882b11f570f1d338af065704c to your computer and use it in GitHub Desktop.
Example of writing Neos configuration from from PCO settings json file
#
#
# The build, release and restart targets are defined in the app, and are run at different stages of the build.
# The build and release are done on the build-server (pubhub), whereas the restart are run on each webnode
#
# Notice that the pco.json conf file is not present during the build phase, but it present during release
#
build: composer rmResourcesDir
release: createSettings migrate publishResources
restart: flushCache warmupCache
#
# These are the general targets used for most Neos/Flow deployments
#
#
# Since the Resource dir is a shared folder, we need to remove it before the ng-deployment can make a shared folder. If
# the folder already exists, the folder wil not be shared.
#
rmResourcesDir:
rm -rf Web/_Resources
#
# The settings and Cache files are based on the existence of the pco.json file
#
createSettings:
php Build/WriteSettingsFromEnvironment.php > Configuration/Settings.yaml
php Build/WriteCacheSettingsFromEnvironment.php > Configuration/Caches.yaml
composer:
composer install --no-dev
flushCache:
php flow flow:cache:flush
warmupCache:
php flow flow:cache:warmup
nodeRepair:
php flow node:repair
clearResources:
php flow ng:cleanresources
publishResources:
php flow resource:publish
migrate: createSettings
php flow doctrine:migrate
showSetupPassword:
cat Data/SetupPassword.txt
pruneSite:
php flow site:prune
importSite:
php flow site:import --package-key TYPO3.NeosDemoTypo3Org
listSites:
php flow site:list
listUsers:
php flow user:list
showSettingsConfiguration:
./flow configuration:show --type Settings
showCacheConfiguration:
./flow configuration:show --type Caches
#
# Various helper targets for debugging
#
listStorageFiles:
ls -alph files/Resources/
listFiles:
ls -alph
listSharedFiles:
ls -alph files
listWebFiles:
ls -alph Web
<?php
$json_path = dirname(__FILE__) . '/../pco.json';
$json = file_get_contents($json_path);
$pco_settings = json_decode($json);
#
#Moc_Varnish_Site_Token,
# We should just change the cachedir
#This cache is being set after the Caches files is loaded...
#TYPO3_TYPO3CR_FullNodeTypeConfiguration
$cacheIdentifierToEnameRedisCache = 'Flow_Security_Cryptography_RSAWallet,Flow_Security_Cryptography_HashService,TYPO3_Media_ImageSize,TYPO3_Neos_TypoScript,Flow_Session_Storage,Flow_Session_MetaData,TYPO3_TypoScript_Content,Flow_Mvc_Routing_Resolve,Flow_Mvc_Routing_Route';
$settings = '';
foreach (explode(',', $cacheIdentifierToEnameRedisCache) as $cacheIdentifier) {
$settings .= $cacheIdentifier . ':
backend: PCO\Ng\Cache\Backend\RedisBackend
backendOptions:
hostname: \''. $pco_settings->neos->redis->host .'\'
port: '. $pco_settings->neos->redis->port .'
prefix: \''. $pco_settings->neos->redis->prefix .'\'
';
}
print $settings;
<?php
$json_path = dirname(__FILE__) . '/../pco.json';
$json = file_get_contents($json_path);
$pco_settings = json_decode($json);
$settings = 'TYPO3:
Flow:
persistence:
backendOptions:
dbname: \'' . $pco_settings->neos->db->master->name . '\'
user: \''. $pco_settings->neos->db->master->user .'\'
password: \''. $pco_settings->neos->db->master->password .'\'
host: \''. $pco_settings->neos->db->master->host .'\'
port: \''. $pco_settings->neos->db->master->port .'\'
resource:
storages:
defaultPersistentResourcesStorage:
storageOptions:
path: \''. $pco_settings->neos->storage->path .'/Resources/\'
log:
systemLogger:
backendOptions:
identifier: \'syslog\'
configuration:
handler:
sysloghandler: \'sysloghandler\'
TYPO3CR:
Search:
elasticSearch:
indexName: \''. $pco_settings->elasticsearch->prefix .'\'
MOC:
Varnish:
varnishUrl: \'http://'. $pco_settings->varnish->eradicator->host . ':' . $pco_settings->varnish->eradicator->port . '\'
Flowpack:
ElasticSearch:
clients:
# default bundle that will be used if no more specific bundle name was supplied.
default:
0:
host: \''. $pco_settings->elasticsearch->host .'\'
port: '. $pco_settings->elasticsearch->port .'
Monolog:
handler:
sysloghandler:
className: \'Monolog\Handler\SyslogHandler\'
position: 50
arguments:
0: \''. $pco_settings->syslog->identity .'\' #identity
1: \''. $pco_settings->syslog->facility .'\' #facility
';
print $settings;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment