Ussing
Referance jaynarol.
Packages
- loadbalance use nginx when request assets/* url but other request use apache
- php 5.6 - apache
- nginx
- maysql
- phpmyadmin (http://[host]:8080)
Workspace directory
- Yii Application: app
- MySql Data: database
Install docker-compose
SECTION 1 Install Docker-Compose
This section was built using DigitalOcean Pages
Step 1 — Installing Docker
wget -qO- https://get.docker.com/ | sh
sudo usermod -aG docker $(whoami)
Step 2 — Installing Docker Compose
sudo apt-get -y install python-pip
sudo pip install docker-compose
SECTION 2 Clone repository
Step 1 Change directory to your workspace directory
cd ~/Docker
Step 2 Clone Repository
git clone https://github.com/kuakling/docker-compose-yii-serv.git your-docker-compose-name
Step 3 cd to your-docker-compose-name
cd your-docker-compose-name
Step 4 Update composer.sh
- Create Personal Access Token from github.com and copy it.
- open build/php/composer.sh with any text editor
- Find composer config -g github-oauth.github.com
YOUR GITHUB TOKEN
- Replace your token in to YOUR GITHUB TOKEN and save file
Example: composer config -g github-oauth.github.com 1234567890abcdefghijklmnopqrstuvwxyz
Step 5 Build (long time :clock8:)
docker-compose build
Step 6 Run docker-compose
When run on linux(native) os. Please comment or remove shell command in mysql of docker-compose.yml line 48 and 52
docker-compose up -d
Step 1 Install Yii Framework 2 (basic or advanced template)
long time :clock8:
if cannot install please empty directory /var/www/html on container or app on machine (delete all normal and hidden)
docker-compose run --rm php composer create-project --prefer-dist yiisoft/yii2-app-advanced /var/www/html
Step 2 Change execute mode for ./init and execute it (for advanced template)
docker-compose run --rm php chmod +x ./init
execute ./init
docker-compose run --rm php ./init
Step 3 Migrate (for advanced template)
docker-compose run --rm php ./yii migrate
Step 4 Configs Yii and .htaccess (Dispensable)
This step was built using mickgeek/yii2-advanced-one-domain-config
Screenshot