Revision #42 was created by rackycz on Mar 5, 2021, 1:37:57 AM.
Docker
Content
[...]
- To get PHP version call: "php -version"
- If you are not allowed to run "mysql -v", you can run "mysql -u {username} -p" .. if you know the login
- Current IP: hostname -I
In "scotch/box" I do not use PhpMyAdmin , but [Adminer](https://www.adminer.org/en). It is one simple PHP script and it will run without any installations.
Just copy the adminer.php script to your docroot and access it via browser. Use the same login as in configurafion of Yii. Server will be localhost.
**Running Yii project in Docker (now without xDebug)**
---
*Note: I am showing the advanced application. Basic application will not be too different I think.*
- Download Yii the application template and extract it to any folder
- Open command line and navigate to the project folder
- Run command docker-compose up -d
- Argument -d will run docker on the background as a service
- Advantage is that command line will not be blocked, but you will be able to call more commands
- Run command init to initialize the application
- You can also call composer install using one of following commands:
- docker-compose run --rm frontend composer install
- docker-compose run --rm backend composer install
Now you will be able to open URLs:
- Frontend: http://localhost:20080
- Backend: http://localhost:21080
- ... see docker-compose.yml to understand these port numbers
Open common\config\main-local.php and set following DB connection:
- host=mysql
- dbname=yii2advanced
- username=yii2advanced
- password=secret
- Values are taken from docker-compose.yml
Run migrations ieng one of following commands:
- docker-compose run --rm frontend php yii migrate
- docker-compose run --rm backend php yii migrate
Now go to Frontend and click "signup" in the right upper corner
- This will create a new user and will send an email. It will appear in folder frontend\runtime\mail
- Now you have to activate it. FIrst way is to use the the email
- Open file frontend\runtime\mail\*.eml
- copy whole href which is inside and modify it by changing these substrings: "=3D" "=" "&" "%2F"