class Deployer

This class implements a service that performs the deployment of files from a new simulator or modified simulator to all front-end servers described in the entry 'deployment of parameters.yml.

Properties

private KernelInterface $kernel
private TranslatorInterface $translator
private Lock $lock
private array $deployed
private array $output
private array $importedCSS

Methods

void
__construct(KernelInterface $kernel, TranslatorInterface $translator)

Constructor of class Deployer

void
doDeploy(string $localRootDir, string $localFile, string $remoteFile, string $command)

Realizes the deployment

string
unixify(string $rootDir)

Transforms a Windows path in a Unix path for a 'rsync' command

void
loadDeployed(string $deployedFile)

Loads the list of already deployed data sources

void
addDeployedDatasource(string $datasource, string $server)

Adds a datasource to the list of deployed data sources

void
saveDeployed(string $deployedFile)

Saves the list of deployed data sources

void
saveDataSources(string $server, string $databasesDir)

Saves DataSources.xml for a server

DOMElement|null
getDOMElementItem(DOMNodeList $nodes, int $index)

Retuns the DOMElement at position $index of the DOMNodeList

array
getImportedCSS(string $cssFileName)

Retrieves imported css in a css file.

array
deploy(Simulator $simu)

Entry point of the service

Details

at line 105
void __construct(KernelInterface $kernel, TranslatorInterface $translator)

Constructor of class Deployer

Parameters

KernelInterface $kernel The Symfony kernel interface
TranslatorInterface $translator The translator interface

Return Value

void

at line 121
private void doDeploy(string $localRootDir, string $localFile, string $remoteFile, string $command)

Realizes the deployment

Parameters

string $localRootDir
string $localFile
string $remoteFile
string $command

Return Value

void

at line 148
private string unixify(string $rootDir)

Transforms a Windows path in a Unix path for a 'rsync' command

Parameters

string $rootDir The transformed path

Return Value

string

at line 167
private void loadDeployed(string $deployedFile)

Loads the list of already deployed data sources

Parameters

string $deployedFile The name of the file containing this list.

Return Value

void

at line 198
private void addDeployedDatasource(string $datasource, string $server)

Adds a datasource to the list of deployed data sources

Parameters

string $datasource The name of the deployed datasource
string $server The virtual name of the server on which the datasource is deployed

Return Value

void

at line 229
private void saveDeployed(string $deployedFile)

Saves the list of deployed data sources

Parameters

string $deployedFile The name of the file containing this list.

Return Value

void

at line 251
private void saveDataSources(string $server, string $databasesDir)

Saves DataSources.xml for a server

Parameters

string $server The name of the file containing this list.
string $databasesDir The databases directory.

Return Value

void

at line 307
private DOMElement|null getDOMElementItem(DOMNodeList $nodes, int $index)

Retuns the DOMElement at position $index of the DOMNodeList

Parameters

DOMNodeList $nodes The DOMNodeList
int $index The position in the DOMNodeList

Return Value

DOMElement|null The DOMElement.

at line 323
private array getImportedCSS(string $cssFileName)

Retrieves imported css in a css file.

Parameters

string $cssFileName The name of the css file.

Return Value

array The imported css file names.

at line 370
array deploy(Simulator $simu)

Entry point of the service

Reads the 'deployment' parameter from the parameters.yml file and starts the deployment on all the servers listed under this parameter?

The 'deployment' parameter contains one child parameter by server with the following syntax:

:

The deployment command must contain the placeholder variables:

  • {local.rootdir}
  • {local.file}
  • {remote.dir} or {remote.file}

{local.rootdir} is the directory where this instance of G6K is installed

{local.file} is the path relative to {local.rootdir} and the file name of a file to be deployed

{remote.dir} is the path (without the file name) relative to the install directory of G6K in remote server of a file to be deployed

{remote.file} is the path relative to the install directory of G6K in remote server of a file to be deployed

Some examples :

  • front1: rsync -utlgo {local.rootdir}/{local.file} foo@bar:/var/www/html/simulator/{remote.file}
  • front2: rcp {local.rootdir}/{local.file} foo@bar:/var/www/html/simulator/{remote.dir}/
  • localhost: cp -f {local.rootdir}/{local.file} /var/www/html/simulator/{remote.dir}/

Parameters

Simulator $simu The simulator to deploy

Return Value

array The result of the deployment