SakuraCommerce - ecommerce platform based on Yii2 PHP Framework
Run: composer install
Do 3 virtual hosts
• 3.1 for frontend -> to the frontend/web
• 3.2 for backend -> to the backend/web
• 3.3 for images -> frontend/web/upload
• The last one is important. Else you can't see your images. The reason is to make fast your site, you can use cdn domain for your images.
• Here is important rule is:
• if you have your domain yourdomain.com, so then your image virtual host must be in this format img.yourdomain.com
• Backend backend.yourdomain.com
Create 3 databases
• 4.1 your_local_db, import sakura.sql here
• 4.2 your_local_db_test - this is for testing, import sakura.sql here too
• 4.3 countries, import countries.sql here
Do changes in this files
• 5.1 common/config/main-local.php to your local databases
• common/config/main.php line 100-112 to your server databases
• 5.2 tests/codeception/config/test-merged.php line 3 instead of sakuracommmerce.com paste here your real domain. It is for to know are you in prod or env
• 5.3 tests/_support/Helper/Unit.php line 20 to read images
• 5.4 tests/codeception/config/test.php line 21-25 • here is your test databases, first is on your server, the second is on your local computer
• 5.5 tests/acceptance.suite.yml line 20, to your local test database
• 5.6 tests/acceptance.suite.yml line 7 and 16, set here your local url for frontend, example http://yourdomain.com
• 6.1 Run: php yii migrate
• It does changes to your_local_db and uploads the images
• Then change common/config/main-local.php to sakura_test db. Run php yii migrate again. It does changes to sakura_test db. Then return back to sakura db in common/config/main-local.php file.
• 7.2 run: php yii fixture ""
• this inserts test data and images
• 7.3 php yii clean – to clean assets files. It may asks sudo permissions.
• 7.4 php yii minify/all – this command is important, to make fast your site, you need to compress all js and css files into all.css and all.js files.
• 7.5 After you have run minify command,
go to frontend/config/main.php – 65 line, comment the line, and uncomment 68 line, it lets AssetManager to use AllAssetBundle, I mean instead of loading a lot of js and css files from assets, there will be only 2 compressed files, all.js and all.css.
Also don't forget going to common/config/main.php – line 294, to make 'forceCopy'=>false, it stop assets refresh assets files.
• sudo chmod -R 777 frontend/web/assets/
Make sure your these directories are writable
If not make them writable
sudo chmod -R 777 frontend/web/assets/*
Open in browser http://yourdomain.com
check your site is working, images are shown, then check backend too http://backend.yourdomain.com, be sure that images are showing
If everything is ok, then check your codeception tests are working too
• 9.1 Unit tests run this: vendor/bin/codecept run unit
• If it is ok, check how acceptance tests working
• 9.2 To check acceptance tests
• Install on your database java.
• Then run this: java -jar project_root/selenium.jar
• You must see this kind of message
14:24:45.925 INFO [GridLauncherV3.launch] - Selenium build info: version: '3.14.0', revision: 'aacccce0'
14:24:45.926 INFO [GridLauncherV3$1.launch] - Launching a standalone Selenium Server on port 4444
2018-10-31 14:24:46.063:INFO::main: Logging initialized @609ms to org.seleniumhq.jetty9.util.log.StdErrLog
14:24:46.332 INFO [SeleniumServer.boot] - Selenium Server is up and running on port 4444
• Be sure it is working. If not,
• a) Install latest version of selenium, https://www.selenium.dev/downloads/
• b) Install latest version of Chrome
• c) Copy project_root/chromedriver to your local computer. Or install latest version of https://chromedriver.chromium.org/downloads, in ubuntu it is /usr/local/bin/chromedriver. Learn it for windows.
• d) Then try again java -jar selenium.jar
• If your selenium works
• Run this:vendor/bin/codecept run acceptance