/adherentss3

Writing the RIF adherents's website using new technologies

Primary LanguagePHP

adherentsS3

Project for the Randonneurs Ile De France adherents

  • The target of the project is to convert the actual adherents' web site to the latest technologies
    • Symfony 3.x for the PHP backend
    • React JS for some front end Javascript components
      • JQuery to help for the Dom manipulation the Ajax requests and the most common visual effects
    • Twitter Bootstrap to support responsive design from the ground up !

From local devel to production environment

launching the script:

  • adherentss3/scripts/gitarchive.sh is the script meant for that
    • it download the source code from the master branch of my BitBucket Project
    • it runs the composer.json file at the root of the project
      • to add the symfony's dependent libraries in the vendor directory
      • to run the post-install-command configuration's scripts
        • the script that interests us is "Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::prepareDeploymentTarget" (see underneath)
"scripts": {
        "symfony-scripts": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ],
        "post-install-cmd": [
            "@symfony-scripts"
        ],
        "post-update-cmd": [
            "@symfony-scripts"
        ]
    },
  • it will ask for the mysql database to connect symfony to.
    • That is where will we give the mysql ovh coordinates:
      • (Here I enter my local coordinate for the demo -rif- each time)
jpmena@jpmena-P34 ~/RIF/adherentss3/scripts (master *) $ ./gitarchive.sh
....................................
Generating autoload files
> Incenteev\ParameterHandler\ScriptHandler::buildParameters
Creating the "app/config/parameters.yml" file
Some parameters are missing. Please provide them.
database_host (127.0.0.1):
database_port (null):
database_name (symfony): rif
database_user (root): rif
database_password (null): rif
mailer_transport (smtp):
mailer_host (127.0.0.1):
mailer_user (null):
mailer_password (null):
secret (ThisTokenIsNotSoSecretChangeIt):
.....................................

porting it to the french shared web-hosting OVH:

  • first add a .ovhconfig file at the root of your project (following that OVH's Help Link):
    • I want my Symfony3 website to be run in PHP 7.0 (the non cgi version!!!!)
rifrando:~$ cd dev/jpmena/adherentss3/web/
rifrando:~/dev/jpmena/adherentss3/web$ cat .ovhconfig
app.engine=php
app.engine.version=7.0
http.firewall=none
environment=production
  • I added the following php file at the root of my project:
rifrando:~/dev/jpmena/adherentss3/web$ cat info.php
<?php phpinfo() ?>

nettoyer les caches

  • I embedded a script that calls the cache:clear symfony's console commands
    • in dev and prod modes
    • it sets before and after the corresponding user/groups
      • before because I am the user calling the script and then writing the cache files and directories
      • after because it is Apache who then be writing the cache files and directories
jpmena@jpmena-P34 ~/RIF/adherentss3/scripts/dev (master *) $ ./clearCache.sh 
changing the proprietary/group of ../../var/cache
cleaning the symfony cache for dev mode

 // Clearing the cache for the dev environment with debug true                                                          

                                                                                                                        
 [OK] Cache for the "dev" environment (debug=true) was successfully cleared.                                            
                                                                                                                        

cleaning the symfony cache for prod mode

 // Clearing the cache for the prod environment with debug false                                                        

                                                                                                                        
 [OK] Cache for the "prod" environment (debug=false) was successfully cleared.                                          
                                                                                                                        

changing the proprietary/group of ../../var/cache
  • note that cleaning the only prod version of the cache would impair the apparition of the Debug Bar if app_dev.php were used in the address
    • it would throw an exception in the logs to be found in: adherentss3/var/logs ...

Work in Progress