Revision #43 has been created by rackycz on Mar 5, 2021, 1:43:35 AM with the memo:
Docker
« previous (#42) next (#44) »
Changes
Title
unchanged
Yii v2 snippet guide III
Category
unchanged
Tutorials
Yii version
unchanged
2.0
Tags
unchanged
tutorial,yii2,beginer
Content
changed
[...]
**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[...]
- ... see docker-compose.yml to understand these port numbers
Open common\/config
\/main-local.php and set following DB connection:
- host=mysql
- dbname=yii2advanced[...]
- Values are taken from docker-compose.yml
Run migrations ui
eng 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. F
Iirst way is to use the
the email
- Open
the EML file
in frontend
\/runtime
\/mail
\*.eml
- copy whole href which is inside and modify it by changing these substrings: "=3D" "=" "&" "%2F"
- Original format:[...]
- Desired format:
- http://localhost:20080/index.php?r=site/verify-email&token=07tYL8tqNjsyr8eZBoN_mXOgwtq1XqvB_1614901373
- If the link is correct, activation will succeed
Second way is to directly modify table in DB:
- Download adminer - It is a single-file DB client:
[www.adminer.org/en
](www.adminer.org/en)
- Copy Adminer to frontend\web\adminer.php
- Open Adminer using: http://localhost:20080/adminer.php
- If your DB has no password, adminer fill refuse to work. You would have to "crack" it.
- Use following login and go to DB yii2advanced:
-
Sserver=mysql
- username=yii2advanced
- password=secret
- Values are taken from docker-compose.yml
- Set status=10 to your first user[...]