-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee5b6dc
commit be48145
Showing
8 changed files
with
84 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
DB_USER=docker | ||
DB_PASSWORD=secret | ||
DB_ROOT_PASSWORD=secret | ||
DB_DATABASE=test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
.idea | ||
.env | ||
/vendor | ||
/homestead | ||
/data/mysql/ | ||
.vagrant/ | ||
aliases | ||
aliases |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,41 @@ | ||
--- | ||
# Развернуть Homestead VM при помощи Vagrant и VirtualBox | ||
ip: 192.168.56.56 | ||
ip: "192.168.56.56" | ||
memory: 2048 | ||
cpus: 2 | ||
provider: virtualbox | ||
|
||
authorize: ~/.ssh/id_rsa.pub | ||
|
||
keys: | ||
- ~/.ssh/id_rsa | ||
|
||
folders: # Должна быть поддержка проброса директорий | ||
- | ||
map: ./code/homestead | ||
map: ./../code/homestead | ||
to: /home/vagrant/code | ||
sites: | ||
- | ||
map: application.local # Сайт должен отвечать на доменное имя application.local | ||
to: /home/vagrant/code | ||
|
||
databases: | ||
- homestead | ||
ports: | ||
- send: 80 | ||
to: 8000 | ||
|
||
features: | ||
- mysql: false | ||
- mariadb: true | ||
- postgresql: false | ||
- ohmyzsh: false | ||
- webdriver: false | ||
- influxdb: false | ||
|
||
services: | ||
- | ||
enabled: [mariadb] | ||
name: dz | ||
hostname: dz | ||
- enabled: | ||
- "mariadb" | ||
|
||
ports: | ||
- send: 33060 # MySQL/MariaDB | ||
to: 3306 | ||
- send: 80 | ||
to: 8000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,41 @@ | ||
# PHP_2023 | ||
|
||
https://otus.ru/lessons/razrabotchik-php/?utm_source=github&utm_medium=free&utm_campaign=otus | ||
|
||
## Комментарий к домашнему заданию | ||
|
||
В домашнем задании использутеся подключение к дувум базам данных MySQL (MariaDB): | ||
- Docker-контейнер | ||
- VM Homestead | ||
|
||
|
||
### 1. Запуск docker-контейнеров | ||
```bash | ||
$ cp .env.example .env | ||
$ docker compose up -d | ||
``` | ||
### 2. Установка виртуальной машины Homestead | ||
|
||
```bash | ||
$ git clone https://github.com/laravel/homestead.git ./homestead | ||
$ cd ./homestead/ | ||
$ git checkout release | ||
$ bash init.sh | ||
$ cp ../Homestead.yaml ./ | ||
$ vagrant up | ||
``` | ||
### 3. Проверка работоспособности | ||
**Проверка VM Homestead** | ||
|
||
В браузере по адресу: http://application.local:8000/ | ||
Вывод функции phpinfo() | ||
|
||
**Проверка Docker** | ||
|
||
В браузере по адресу: http://application.local:8080/ | ||
Вывод: | ||
- Версия Redis | ||
- Версия Memcache | ||
- MySQL соединение с Docker-контейнером (весия MariaDB) | ||
- MySQL соединение с VM Homestead (весия MariaDB) | ||
- Вывод функции phpinfo() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM php:8.2-cli | ||
|
||
WORKDIR /app | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
libzip-dev \ | ||
zip \ | ||
&& docker-php-ext-install zip \ | ||
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* # Освобождаем место от мусора | ||
|
||
CMD ["php"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters