Search code examples
environmentproductionsylius

How to run production environment in Sylius?


I would like to know if the same steps, to run sylius' prod env on initial versions of sylius, must be followed to run also the production environment in versions 1.5 and 1.6. If not, could someone tell me, exactly, what are the steps to achieve it? I will be very grateful for the help.

I found some information, about production environment, here. It is about running prod env on initial versions of Sylius.


Solution

  • After doing some searching and researching I've got it!!!
    
    ===== On Ubuntu WSL under Windows 10 ver.1903 (build 18362. 356) =====
    
    Running sylius project in prod. env. (Sylius 1.5.1/symfony 4.2.9/php 7.2.19/Apache 2.4.41)
    ------------------------------------------------------------------------------------------
    
    If your sylius project was installed at /home/your_username/your_sylius_project
    
        1. Open Ubuntu WSL console and run:
               sudo gedit /home/your_username/your_sylius_project/.env
                    note: you could use Windows' atom as well to edit the file.
    
        2. Edit .env file by commenting the following 3 lines:
               #APP_ENV=dev
               #APP_DEBUG=1
               #APP_SECRET=EDITME
    
        3. Add these new 3 lines
               APP_ENV=prod
               APP_DEBUG=0
               APP_SECRET=EDITMEXYZ
    
        4. Close gedit and then run:
                symfony serve
                [running symfony server][1]
                [1]: https://i.sstatic.net/c3NaA.jpg
    
        5. Open browser
                127.0.0.1:8000 -->frontend
                127.0.0.1:8000/admin/login -->backend
    
    everything seems to be working nice!!!
    
    
    Some notes
    ----------
    
         1. I did migrate my sylius project from a Windows directory to another one,
            located in the Ubuntu WSL directory, and had some read file permissions issues, so
            I did run:
                 sudo chmod -R 757 /home/your_username/your_sylius_project/ 
    
         2. In case you get some trouble with file reading permissions while trying to
            run "yarn install", run the following:
                 sudo chmod -R 777 /home/your_username/.yarn/
    
         3. Change file permissions to /var/cache/ and var/log/ directories.
            run the following:
                 sudo chmod -R 777 /home/your_username/your_sylius_project/var/cache/
                 sudo chmod -R 777 /home/your_username/your_sylius_project/var/log/
    
         4. I had some read file permission with /home/your_username/.symfony/php/
            directory, so I did run:
                 sudo chmod -R 777 /home/your_username/.symfony/php/