git clone https://gitlab.com/slack_lpm/cel2-services.git
In the project root folder, launch the composer install with the following options:
For dev:
composer install
For prod:
APP_ENV=prod composer install --no-dev --optimize-autoloader
The default configuration are located in the .env file at root folder of the project. You have to create an '.env.prod' file to override the environment variables which suit your setup.
The communication with elasticsearch is managed by FOSElasticaBundle.
You can change the ES instance URL in the config/packages/fos_elastica.yaml file.
Configure your database connection:
DATABASE_URL=mysql://db_username:db_paswword@db_server_host:db_server_port/db_name
CORS feature is managed by NelmioCorsBundle.
The configuration file is config/packages/nelmio_cors.yaml. You may want to edit the settings for the '^/api/' path.
Run the sql script located in the 'sql' folder of the project.
Run the data fixture to populate the DB:
php bin/console doctrine:fixtures:load -v
To populate the index by scanning the whole DB, run the following:
php bin/console fos:elastica:populate -v
You can do so by issuing the following command:
php bin/console server:start
Or, if the 80 port is already used:
php bin/console server:start *:8080
Stopping the server is done by issuing:
php bin/console server:stop
You can then follow the symfony manual depending on the server you want to deploy on: https://symfony.com/doc/current/deployment.html
In production, a cleanup script must be executed periodically (crontabed) to delete useless generated temporary files (PDF tags, proxied responses from external Web services, photo archives...). The path where they are stored is given by the "TMP_FOLDER" entry of the .env file. An example of such a script is given below (deletes files older than two days) :
find /path/to/tmp/folder/ -type f -mtime +2 -exec rm {} \;