• Guest
HabraHabr
  • Main
  • Users

  • Development
    • Programming
    • Information Security
    • Website development
    • JavaScript
    • Game development
    • Open source
    • Developed for Android
    • Machine learning
    • Abnormal programming
    • Java
    • Python
    • Development of mobile applications
    • Analysis and design of systems
    • .NET
    • Mathematics
    • Algorithms
    • C#
    • System Programming
    • C++
    • C
    • Go
    • PHP
    • Reverse engineering
    • Assembler
    • Development under Linux
    • Big Data
    • Rust
    • Cryptography
    • Entertaining problems
    • Testing of IT systems
    • Testing Web Services
    • HTML
    • Programming microcontrollers
    • API
    • High performance
    • Developed for iOS
    • CSS
    • Industrial Programming
    • Development under Windows
    • Image processing
    • Compilers
    • FPGA
    • Professional literature
    • OpenStreetMap
    • Google Chrome
    • Data Mining
    • PostgreSQL
    • Development of robotics
    • Visualization of data
    • Angular
    • ReactJS
    • Search technologies
    • Debugging
    • Test mobile applications
    • Browsers
    • Designing and refactoring
    • IT Standards
    • Solidity
    • Node.JS
    • Git
    • LaTeX
    • SQL
    • Haskell
    • Unreal Engine
    • Unity3D
    • Development for the Internet of things
    • Functional Programming
    • Amazon Web Services
    • Google Cloud Platform
    • Development under AR and VR
    • Assembly systems
    • Version control systems
    • Kotlin
    • R
    • CAD/CAM
    • Customer Optimization
    • Development of communication systems
    • Microsoft Azure
    • Perfect code
    • Atlassian
    • Visual Studio
    • NoSQL
    • Yii
    • Mono и Moonlight
    • Parallel Programming
    • Asterisk
    • Yandex API
    • WordPress
    • Sports programming
    • Lua
    • Microsoft SQL Server
    • Payment systems
    • TypeScript
    • Scala
    • Google API
    • Development of data transmission systems
    • XML
    • Regular expressions
    • Development under Tizen
    • Swift
    • MySQL
    • Geoinformation services
    • Global Positioning Systems
    • Qt
    • Dart
    • Django
    • Development for Office 365
    • Erlang/OTP
    • GPGPU
    • Eclipse
    • Maps API
    • Testing games
    • Browser Extensions
    • 1C-Bitrix
    • Development under e-commerce
    • Xamarin
    • Xcode
    • Development under Windows Phone
    • Semantics
    • CMS
    • VueJS
    • GitHub
    • Open data
    • Sphinx
    • Ruby on Rails
    • Ruby
    • Symfony
    • Drupal
    • Messaging Systems
    • CTF
    • SaaS / S+S
    • SharePoint
    • jQuery
    • Puppet
    • Firefox
    • Elm
    • MODX
    • Billing systems
    • Graphical shells
    • Kodobred
    • MongoDB
    • SCADA
    • Hadoop
    • Gradle
    • Clojure
    • F#
    • CoffeeScript
    • Matlab
    • Phalcon
    • Development under Sailfish OS
    • Magento
    • Elixir/Phoenix
    • Microsoft Edge
    • Layout of letters
    • Development for OS X
    • Forth
    • Smalltalk
    • Julia
    • Laravel
    • WebGL
    • Meteor.JS
    • Firebird/Interbase
    • SQLite
    • D
    • Mesh-networks
    • I2P
    • Derby.js
    • Emacs
    • Development under Bada
    • Mercurial
    • UML Design
    • Objective C
    • Fortran
    • Cocoa
    • Cobol
    • Apache Flex
    • Action Script
    • Joomla
    • IIS
    • Twitter API
    • Vkontakte API
    • Facebook API
    • Microsoft Access
    • PDF
    • Prolog
    • GTK+
    • LabVIEW
    • Brainfuck
    • Cubrid
    • Canvas
    • Doctrine ORM
    • Google App Engine
    • Twisted
    • XSLT
    • TDD
    • Small Basic
    • Kohana
    • Development for Java ME
    • LiveStreet
    • MooTools
    • Adobe Flash
    • GreaseMonkey
    • INFOLUST
    • Groovy & Grails
    • Lisp
    • Delphi
    • Zend Framework
    • ExtJS / Sencha Library
    • Internet Explorer
    • CodeIgniter
    • Silverlight
    • Google Web Toolkit
    • CakePHP
    • Safari
    • Opera
    • Microformats
    • Ajax
    • VIM
  • Administration
    • System administration
    • IT Infrastructure
    • *nix
    • Network technologies
    • DevOps
    • Server Administration
    • Cloud computing
    • Configuring Linux
    • Wireless technologies
    • Virtualization
    • Hosting
    • Data storage
    • Decentralized networks
    • Database Administration
    • Data Warehousing
    • Communication standards
    • PowerShell
    • Backup
    • Cisco
    • Nginx
    • Antivirus protection
    • DNS
    • Server Optimization
    • Data recovery
    • Apache
    • Spam and antispam
    • Data Compression
    • SAN
    • IPv6
    • Fidonet
    • IPTV
    • Shells
    • Administering domain names
  • Design
    • Interfaces
    • Web design
    • Working with sound
    • Usability
    • Graphic design
    • Design Games
    • Mobile App Design
    • Working with 3D-graphics
    • Typography
    • Working with video
    • Work with vector graphics
    • Accessibility
    • Prototyping
    • CGI (graphics)
    • Computer Animation
    • Working with icons
  • Control
    • Careers in the IT industry
    • Project management
    • Development Management
    • Personnel Management
    • Product Management
    • Start-up development
    • Managing the community
    • Service Desk
    • GTD
    • IT Terminology
    • Agile
    • Business Models
    • Legislation and IT-business
    • Sales management
    • CRM-systems
    • Product localization
    • ECM / EDS
    • Freelance
    • Venture investments
    • ERP-systems
    • Help Desk Software
    • Media management
    • Patenting
    • E-commerce management
    • Creative Commons
  • Marketing
    • Conferences
    • Promotion of games
    • Internet Marketing
    • Search Engine Optimization
    • Web Analytics
    • Monetize Web services
    • Content marketing
    • Monetization of IT systems
    • Monetize mobile apps
    • Mobile App Analytics
    • Growth Hacking
    • Branding
    • Monetize Games
    • Display ads
    • Contextual advertising
    • Increase Conversion Rate
  • Sundry
    • Reading room
    • Educational process in IT
    • Research and forecasts in IT
    • Finance in IT
    • Hakatonas
    • IT emigration
    • Education abroad
    • Lumber room
    • I'm on my way

Setting up the Docker environment for the yii-framework of the

3r3r1616. In order to quickly raise the working environment there are many ways. One of them is to pick up all the necessary services in the Docker containers. To speed up the creation of new projects on the Yii-framework, I wrote such a small instruction that is used by the developers in our team. 3r3167.
3r3168.  
3r3r1616. At the start you should have docker, docker-compose, php and php-composer. 3r3168.  
Create a folder with a project and a folder in it
docker
. 3r3167. 3r3168.  
mkdir project-dir
cd project-dir && mkdir docker
3r3163. 3r3168.  
3r3r1616. In the folder 3r32323. docker Create a configuration file for our container Dockerfile . 3r3167. 3r3168.  

    # Base image with nginx and php
FROM richarvey /nginx-php-fpm
# We add our web application
ADD app /var /www /app
# Delete the configs of sites that have
there. RUN rm -Rf /etc /nginx /sites-enabled /*
# Add our config
ADD docker /conf /nginx /site.conf /etc/nginx/sites-available/site.conf
# Turn it on
RUN ln -s /etc/nginx/sites-available/site.conf /etc/nginx/sites-enabled/site.conf
3r3163. 3r3168.  
3r3r1616. In the same folder docker we create docker-compose.yml to raise development environment. 3r3167. 3r3168.  
    # The latest version of docker-compose
version: '3'
# Create a common deafult network for all
containers. networks:
default:
driver: bridge
# Create separate containers
services:
# Container with web application
app:
# We collect from Dockerfile
build:
# Root indicate the root of the main project
context: /
dockerfile: ./docker/Dockerfile
# Show outside port 80 3r33333. ports:
- "80:80"
# We connect to a common network with other containers
networks:
- default
# Run only after db
depends_on:
- db
# Link the external source folder inside 3r33332. volumes: 3r33332. - "/app:/var/www/app"
# Also link config for nginx
- "./conf/nginx:/etc/nginx/sites-available"
# A container with a database
db:
image: mysql: latest
# We connect to a common network with other containers
networks:
- default
# Show outside port
ports:
- "3336: 3306"
# Set parameters for initializing the database
environment:
# Password to the database
MYSQL_ROOT_PASSWORD: root
# Created by default DB
MYSQL_DATABASE: yii-template-db
# We link the external folder to store the database
volumes: 3r33332. - "./database:/var/lib/mysql"
3r3163. 3r3168.  
3r3r1616. For nginx create a folder docker /conf /nginx and file 3r3116. site.conf in it. The file may change, depending on how you want to configure nginx on your project. It can be changed locally, since It connects through volume. But do not forget to reboot nginx inside the container: nginx -s reload 3r3167. 3r3168.  
  3r3124. server {3r33333. charset utf-8;
client_max_body_size 128M;
listen 80; ## listen for ipv4
root /var /www /app /frontend /web /;
index index.php;
access_log /var/www/app/log/frontend-access.log;
error_log /var/www/app/log/frontend-error.log;
location /{3r33332. try_files $ uri $ uri //index.php$is_args$args;
}
# uncomment non-existing static files by Yii
#location ~. (js | css | png | jpg | gif | swf | ico | pdf | mov | fla | zip | rar) $ {
# try_files $ uri = 404;
#}
#error_page 404 /404.html;
# deny accessing php files for the /assets directory
location ~ ^ /assets /.*. php $ {
deny all;
}
location ~ .php $ {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $ document_root $ fastcgi_script_name;
fastcgi_pass unix: /var/run/php-fpm.sock;
try_files $ uri = 404;
}
location ~ * /. {
deny all;
}
} 3r3163. 3r3168.  
3r3r1616. All commands are executed from the root folder. 3r3167. 3r3168.  
3r33170.  
We carry out the project creation team composer create-project --prefer-dist yiisoft /yii2-app-advanced app .  
Run the environment. docker-compose -f docker /docker-compose.yml up -d  
Initialize the project. app /init --env = Development --overwrite = All  
Open the file in the editor. app /common /config /main-local.php and fill it with data to connect to the database. In the example we have the root password - root, the database host is db, the database name is yii-template-db.  
Connect to container docker exec -it docker_app_1 bash  
We execute the database migration command php /var /www /app /yii migrate  
Create a folder for logs mkdir /var /www /app /log  
And exit exit  
Braking service docker-compose -f docker /docker-compose.yml down  
We start it again docker-compose -f docker /docker-compose.yml up -d
 
Open
localhost
in the browser and look at the new site.
 
! function (e) {function t (t, n) {if (! (n in e)) {for (var r, a = e.document, i = a.scripts, o = i.length; o-- ;) if (-1! == i[o].src.indexOf (t)) {r = i[o]; break} if (! r) {r = a.createElement ("script"), r.type = "text /jаvascript", r.async =! ? r.defer =! ? r.src = t, r.charset = "UTF-8"; var d = function () {var e = a.getElementsByTagName ("script")[0]; e.parentNode.insertBefore (r, e)}; "[object Opera]" == e.opera? a.addEventListener? a.addEventListener ("DOMContentLoaded", d,! 1): e.attachEvent ("onload", d ): d ()}}} t ("//mediator.mail.ru/script/2820404/"""_mediator") () (); 3r33232.

It may be interesting

  • Comments
  • About article
  • Similar news
This publication has no comments.

weber

Author

3-11-2018, 22:24

Publication Date

DevOps / PHP

Category
  • Comments: 0
  • Views: 461
Another way to use docker-compose is
Configuring the home development
Docker under Windows for development,
Install and configure the OpenVPN
Sending mail from the Docker-container
Crash course on Docker: learn to swim
Write a comment
Name:*
E-Mail:


Comments

Here we introduce our top coupons that will help you for online shopping at discountable prices.Revounts bring you the best deals that slash the bills.If you are intrested in online shopping and want to save your savings then visit our site for best experience.
Today, 08:41

Emma Taylor

Global Dezigns is a Website Development Company in Karachi, Providing services of
website design in karachi
. We are delivering the best partnership across Pakistan. provides a complete range of web development services including web applications, website hosting and maintenance, domain registration, on-page search engine optimization, and website integration with social media platforms such as Facebook, Twitter, LinkedIn, Google Maps, and Google Local Directory. We believe we are well placed to take our knowledge and expertise to the logical next level with the latest web standards.  
  Show/hide text
https://www.globaldezigns.com/



Yesterday, 22:45

mike tomlin

This blog is really great. The information here will surely be of some help to me. Thanks!.mastering physics

Yesterday, 17:57

raymond weber

Coinyspace is the cryptocurrency community and trading forum where members can find any contributors of crypto ecosystem like currencies, exchanges & merchants. Check Out: Bitcoin Merchants
Yesterday, 16:57

noorseo

This is a great high resolution screen which you have shared for the users. Making a website is not an easy task but managing a good website is really a hard work. As far as this website is concerned, I am very happy.https://19216801.1
Yesterday, 16:01

nushra45

Adv
Website for web developers. New scripts, best ideas, programming tips. How to write a script for you here, we have a lot of information about various programming languages. You are a webmaster or a beginner programmer, it does not matter, useful articles will help to make your favorite business faster.

Login

Registration Forgot password