Symfony 3.x Demo Deploy Project
This is the demo project we will use to simulate a working Symfony 3.4 web application.
This is based on the official Symfony demo project.
This build replicates a Symfony 2.x and 3.x project structure. Note that this is different from Symfony 4 directory structure.
The reason for keeping a different project to the official demo project is that the official demo is configured for SQLite by default.
We will be using MySQL, and this fork of the project pre-configures that for us.
To begin, clone the project:
git clone https://github.com/codereviewvideos/symfony-3-demo-app.git symfony-deploy-test-site
Once cloned, we will need to composer install
all the third party dependencies for this project. We must do this locally at this stage.
cd symfony-deploy-test-site
SYMFONY_ENV=prod composer install --no-dev --optimize-autoloader
Note here that because we are deploying, we don't need any development dependencies. This would be libraries like PHPUnit, or Behat, or code inspection libraries, and so on.
If you miss off the SYMFONY_ENV=prod
then you will receive a runtime exception regarding development dependencies.
Here's the stuff that's skipped in this project:
# composer.json
"require-dev": {
"dama/doctrine-test-bundle" : "^3.0",
"friendsofphp/php-cs-fixer" : "^2.0",
"sensio/generator-bundle" : "^3.0",
"symfony/phpunit-bridge" : "^3.0"
},
What this means is that we won't be able to do certain things with our production build that we can in our local dev environment.
At the end of this process you will be asked to fill in the parameters for your parameters.yml
file.
If you have followed either the LEMP or LAMP stack setup tutorials, and kept the default values, then you can safely accept all defaults here.
If not, please update accordingly.
MySQL Issue
Note this demo project contains SQL that may not be valid for you.
This has been logged as a ticket.
And this is the fix that we will use.
From your server:
vim /etc/mysql/my.cnf
The shortcut here is:
shift + g
To jump to the end of the file.
Then i to get into -- INSERT --
mode.
We need the following:
[mysqld]
sql-mode=""
Once in insert mode, then right click > paste that snippet in.
Then esc, and type in :wq!
to write and quit.
Cool.
Now, best restart MySQL:
service mysql restart
Jolly good.