SlideShare a Scribd company logo
1 of 45
Download to read offline
Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev 11
Beispiel Projekt
Ziel: PHP Anwendung mit Zugriff auf
ElasticSearch
22Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
Verzeichnis
.
├── composer.json
└── index.php
33Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
Minimale
composer.json
{
"name": "muench-dev/example-project",
"description": "ddev Example Project",
"type": "project",
"license": "MIT",
"authors": [
{
"name": "Christian Münch",
"email": "christian@muench-worms.de"
}
],
"require": {
"elasticsearch/elasticsearch": "^7.9"
}
44
index.php
<?php
require_once 'vendor/autoload.php';
phpinfo();
55Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
Let's go!
ddev config --project-name=example-project --php-version=7.4 --project
ddev start
66Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
❯ ddev start
Starting example-project...
Pushed mkcert rootca certs to ddev-global-cache/mkcert
Running Command=ip address show dev docker0
Building db
Building web
Creating ddev-example-project-db ... done
Creating ddev-example-project-web ... done
Creating ddev-example-project-dba ... done
Creating ddev-router ... done
Successfully started example-project
Project can be reached at https://example-project.ddev.site https://127.0.0.1:32786
77Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
PHP Projekt
ddev composer install
88Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
❯ ddev composer install
No lock file found. Updating dependencies instead of installing from lo
Loading composer repositories with package information
Updating dependencies
Lock file operations: 5 installs, 0 updates, 0 removals
- Locking elasticsearch/elasticsearch (v7.9.1)
- Locking ezimuel/guzzlestreams (3.0.1)
- Locking ezimuel/ringphp (1.1.2)
- Locking psr/log (1.1.3)
- Locking react/promise (v2.8.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 5 installs, 0 updates, 0 removals
- Installing psr/log (1.1.3): Extracting archive
- Installing react/promise (v2.8.0): Extracting archive
- Installing ezimuel/guzzlestreams (3.0.1): Extracting archive
- Installing ezimuel/ringphp (1.1.2): Extracting archive
- Installing elasticsearch/elasticsearch (v7.9.1): Extracting archive
1 package suggestions were added by new dependencies, use `composer sug
Generating autoload files 99
1010
1111
Mac Performance
ddev config --nfs-mount-enabled=true
1212Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
NFS ist für jeden
angeschaltet!
1313Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
Lösung
anlegen einer lokalen Config
Dateien /config.*.y*ml sind per .gitignore
ausgeschlossen.
1414Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
Beispiel
config.local.yaml
nfs_mount_enabled: false
1515Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
Tipp: Bash Alias
ddev-disable-nfs-mount-locally='echo "nfs_mount_enabled: false" >> .ddev/config.local.yaml'
1616Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
NFS Problematiken
NFS muss installiert sein -> Sonst kommen komische
Fehlermeldungen
NFS Installation je Betriebssystem unter schiedlich
Unterschiedliche Partitionierung
Unterschiedliche Benutzer-IDs
Keine Inotify Events (Watch-Tasks z.B. grunt, webpack,
Magento Cache Clean)
1717Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
Inotify Proxy
Diverse Lösungen erhältlich
Bekanntes NPM Paket ist nur ein Wrapper für eine C-Lib
und benötigt installierte Build-Tools.
Kleiner, schneller, golang
https://github.com/cmuench/inotify-proxy
ddev Command:
https://github.com/cmuench/inotify-proxy/wiki/ddev-
inotify-Command
1818Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
Homeadditions
.ddev/homeadditions
~/.ddev/homeadditions
.
└── homeadditions
   ├── bash_aliases.example
   └── .bashrc
1919Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
Beispiel .bashrc
export PS1="[e[32m][[e[m][e[36m][e[m][e[32m]h[e[m]:
alias ls='ls --color=auto'
alias ll='ls -la'
alias cd-root="cd /var/www/html"
2020Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
2121
Verzeichnisse
.
├── commands
│   ├── db
│   ├── host
│   ├── solr
│   └── web
2222Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
Host Commands
Beispiel: ~/.ddev/commands/host/ide
2323Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
!/bin/bash
#ddev-generated
## Description: Open project in IDE
## Usage: ide
## Example: "ddev ide"
/opt/intellij-idea-ultimate-edition/bin/idea.sh ${DDEV_APPROOT} 
> /dev/null 2>&1 &
2424Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
Container Commands
2525Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
Magento Kommando
#!/bin/bash
#ddev-generated
## Description: Run magento CLI inside the web container
## Usage: magento [flags] [args]
## Example: "ddev magento list" or "ddev magento maintenance:enable"
## ProjectTypes: magento2
bin/magento "$@"
2626Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
2727
docker-compose
Konfiguration
docker-compose up -d
docker-compose -f docker-compose.yaml up -d
docker-compose -f foo.yaml -f bar.yaml -f zoz.yaml up -d
2828Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
Verzeichnisstruktur
.ddev
├── .ddev-docker-compose-base.yaml
├── .ddev-docker-compose-full.yaml
├── config.yaml
├── db-build
│   └── Dockerfile.example
└── web-build
└── Dockerfile.example
2929Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
Beispiel ElasticSearch
...
3030Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
version: '3.6'
services:
elasticsearch:
container_name: 'ddev-${DDEV_SITENAME}-elasticsearch'
hostname: '${DDEV_SITENAME}-elasticsearch'
image: elasticsearch:7.6.2
ports:
- '9200'
- '9300'
environment:
- VIRTUAL_HOST=elasticsearch-$DDEV_HOSTNAME
- HTTP_EXPOSE=9200
- discovery.type=single-node
labels:
com.ddev.site-name: '${DDEV_SITENAME}'
com.ddev.approot: $DDEV_APPROOT
volumes:
- 'elasticsearch:/usr/share/elasticsearch/data'
3131
version: '3.6'
services:
elasticsearch:
...
web:
depends_on:
- elasticsearch
links:
- 'elasticsearch:elasticsearch'
volumes:
elasticsearch:
name: '${DDEV_SITENAME}-elasticsearch'
3232Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
❯ ddev start
Starting example-project...
Running Command=ip address show dev docker0
Creating volume "example-project-elasticsearch" with default driver
Building db
Building web
Creating ddev-example-project-elasticsearch ... done
Recreating ddev-example-project-db ... done
Recreating ddev-example-project-dba ... done
Recreating ddev-example-project-web ... done
3333Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
ddev describe
$> ddev describe
...
Other Services
--------------
MailHog (https): https://example-project.ddev.site:8026
MailHog: http://example-project.ddev.site:8025
phpMyAdmin (https): https://example-project.ddev.site:8037
phpMyAdmin: http://example-project.ddev.site:8036
elasticsearch: http://example-project.ddev.site:9200
...
3434Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
❯ ddev exec "curl http://elasticsearch:9200"
{
"name" : "example-project-elasticsearch",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "fX7_HMTxRiC_1KL4nbTqAg",
"version" : {
"number" : "7.6.2",
"build_flavor" : "default",
"build_type" : "docker",
"build_hash" : "ef48eb35cf30adf4db14086e8aabd07ef6fb113f",
"build_date" : "2020-03-26T06:34:37.794943Z",
"build_snapshot" : false,
"lucene_version" : "8.4.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
3535Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
<?php
require_once 'vendor/autoload.php';
use ElasticsearchClientBuilder;
$params = [
'hosts' => [
'elasticsearch:9200'
]
];
try {
$client = ClientBuilder::fromConfig($params);
$client->ping();
echo "ElasticSearch connection established";
} catch (Exception $exception) {
echo $exception->getMessage();
exit(1);
} 3636Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev 3737
3838
Command Hooks
pre-<command>
post-<command>
Beispiel:
pre-start
post-import-db
post-composer
3939Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
Tasks
exec -> Im Container (genormte Umgebung)
exec_host -> Auf dem Host (Achtung!)
composer -> Führt ein Composer Kommando aus
4040Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
config.yaml Anpassung
hooks:
post-start:
- composer: install
4141Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
❯ ddev start
Starting example-project...
...
Executing post-start hook...
=== Running task: Composer command 'install' in web container, output below
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Nothing to install, update or remove
Generating autoload files
...
Successfully started example-project
4242
Shell Scripte
hooks:
post-start:
- exec: bash .ddev/step1_install_special_tools.sh
- exec: bash .ddev/step2_setup_myapplication.sh
# other container
- exec: bash .ddev/do_some_db_stuff.sh
service: db
- exec: bin/elasticsearch-plugin install analysis-icu
service: elasticsearch
4343Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
=== Running task: Exec command 'bin/elasticsearch-plugin
install analysis-icu' in container/service 'elasticsearch', output below
-> Installing analysis-icu
-> Downloading analysis-icu from elastic
[=================================================] 100%??
-> Installed analysis-icu
Successfully started example-project
4444Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
Vielen Dank!
Fragen oder Livedemo?
4545Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev

More Related Content

What's hot

Anwendungsfälle für Elasticsearch JavaLand 2015
Anwendungsfälle für Elasticsearch JavaLand 2015Anwendungsfälle für Elasticsearch JavaLand 2015
Anwendungsfälle für Elasticsearch JavaLand 2015Florian Hopf
 
Docker remote-api
Docker remote-apiDocker remote-api
Docker remote-apiEric Ahn
 
Hiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret SauceHiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret SauceJesse Vincent
 
Gr8conf EU 2018 - Bring you infrastructure under control with Infrastructor
Gr8conf EU 2018 - Bring you infrastructure under control with InfrastructorGr8conf EU 2018 - Bring you infrastructure under control with Infrastructor
Gr8conf EU 2018 - Bring you infrastructure under control with InfrastructorStanislav Tiurikov
 
Profiling and optimizing go programs
Profiling and optimizing go programsProfiling and optimizing go programs
Profiling and optimizing go programsBadoo Development
 
2017-07-22 Common Workflow Language Viewer
2017-07-22 Common Workflow Language Viewer2017-07-22 Common Workflow Language Viewer
2017-07-22 Common Workflow Language ViewerStian Soiland-Reyes
 
X64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newX64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newYiwei Ma
 
Installing Python on Mac
Installing Python on MacInstalling Python on Mac
Installing Python on MacWei-Wen Hsu
 
GroovyFX - groove JavaFX Gr8Conf EU 2017
GroovyFX - groove JavaFX Gr8Conf EU 2017GroovyFX - groove JavaFX Gr8Conf EU 2017
GroovyFX - groove JavaFX Gr8Conf EU 2017sascha_klein
 
Docker deploy
Docker deployDocker deploy
Docker deployEric Ahn
 
Docker command
Docker commandDocker command
Docker commandEric Ahn
 
Anwendungsfälle für Elasticsearch JAX 2015
Anwendungsfälle für Elasticsearch JAX 2015Anwendungsfälle für Elasticsearch JAX 2015
Anwendungsfälle für Elasticsearch JAX 2015Florian Hopf
 
Groovy on the shell
Groovy on the shellGroovy on the shell
Groovy on the shellsascha_klein
 
nix-processmgmt: An experimental Nix-based process manager-agnostic framework
nix-processmgmt: An experimental Nix-based process manager-agnostic frameworknix-processmgmt: An experimental Nix-based process manager-agnostic framework
nix-processmgmt: An experimental Nix-based process manager-agnostic frameworkSander van der Burg
 
Infrastructure as code - Python Saati #36
Infrastructure as code - Python Saati #36Infrastructure as code - Python Saati #36
Infrastructure as code - Python Saati #36Halil Kaya
 
Websockets - DevFestX May 19, 2012
Websockets - DevFestX May 19, 2012Websockets - DevFestX May 19, 2012
Websockets - DevFestX May 19, 2012Sameer Segal
 

What's hot (20)

Anwendungsfälle für Elasticsearch JavaLand 2015
Anwendungsfälle für Elasticsearch JavaLand 2015Anwendungsfälle für Elasticsearch JavaLand 2015
Anwendungsfälle für Elasticsearch JavaLand 2015
 
Grooscript and Grails 3
Grooscript and Grails 3Grooscript and Grails 3
Grooscript and Grails 3
 
Implementing New Web
Implementing New WebImplementing New Web
Implementing New Web
 
Docker remote-api
Docker remote-apiDocker remote-api
Docker remote-api
 
Hiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret SauceHiveminder - Everything but the Secret Sauce
Hiveminder - Everything but the Secret Sauce
 
Gr8conf EU 2018 - Bring you infrastructure under control with Infrastructor
Gr8conf EU 2018 - Bring you infrastructure under control with InfrastructorGr8conf EU 2018 - Bring you infrastructure under control with Infrastructor
Gr8conf EU 2018 - Bring you infrastructure under control with Infrastructor
 
Xdebug from a to x
Xdebug from a to xXdebug from a to x
Xdebug from a to x
 
Profiling and optimizing go programs
Profiling and optimizing go programsProfiling and optimizing go programs
Profiling and optimizing go programs
 
2017-07-22 Common Workflow Language Viewer
2017-07-22 Common Workflow Language Viewer2017-07-22 Common Workflow Language Viewer
2017-07-22 Common Workflow Language Viewer
 
X64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 newX64服务器 lnmp服务器部署标准 new
X64服务器 lnmp服务器部署标准 new
 
Installing Python on Mac
Installing Python on MacInstalling Python on Mac
Installing Python on Mac
 
GroovyFX - groove JavaFX Gr8Conf EU 2017
GroovyFX - groove JavaFX Gr8Conf EU 2017GroovyFX - groove JavaFX Gr8Conf EU 2017
GroovyFX - groove JavaFX Gr8Conf EU 2017
 
Docker deploy
Docker deployDocker deploy
Docker deploy
 
Docker command
Docker commandDocker command
Docker command
 
Ferrara Linux Day 2011
Ferrara Linux Day 2011Ferrara Linux Day 2011
Ferrara Linux Day 2011
 
Anwendungsfälle für Elasticsearch JAX 2015
Anwendungsfälle für Elasticsearch JAX 2015Anwendungsfälle für Elasticsearch JAX 2015
Anwendungsfälle für Elasticsearch JAX 2015
 
Groovy on the shell
Groovy on the shellGroovy on the shell
Groovy on the shell
 
nix-processmgmt: An experimental Nix-based process manager-agnostic framework
nix-processmgmt: An experimental Nix-based process manager-agnostic frameworknix-processmgmt: An experimental Nix-based process manager-agnostic framework
nix-processmgmt: An experimental Nix-based process manager-agnostic framework
 
Infrastructure as code - Python Saati #36
Infrastructure as code - Python Saati #36Infrastructure as code - Python Saati #36
Infrastructure as code - Python Saati #36
 
Websockets - DevFestX May 19, 2012
Websockets - DevFestX May 19, 2012Websockets - DevFestX May 19, 2012
Websockets - DevFestX May 19, 2012
 

Similar to PHP Project with ElasticSearch Access

Magento 2 Development
Magento 2 DevelopmentMagento 2 Development
Magento 2 DevelopmentDuke Dao
 
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agentsPVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agentsAndrey Karpov
 
Development Setup of B-Translator
Development Setup of B-TranslatorDevelopment Setup of B-Translator
Development Setup of B-TranslatorDashamir Hoxha
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushPantheon
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Ben Hall
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient waySylvain Rayé
 
Deploying configurable frontend web application containers
Deploying configurable frontend web application containersDeploying configurable frontend web application containers
Deploying configurable frontend web application containersJosé Moreira
 
MeaNstack on Docker
MeaNstack on DockerMeaNstack on Docker
MeaNstack on DockerDaniel Ku
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleStein Inge Morisbak
 
Using Composer with Drupal and Drush
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Using Composer with Drupal and DrushPantheon
 
Kubernetes laravel and kubernetes
Kubernetes   laravel and kubernetesKubernetes   laravel and kubernetes
Kubernetes laravel and kubernetesWilliam Stewart
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slidesDocker, Inc.
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environmentSumedt Jitpukdebodin
 
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016Zabbix
 
Testing Distributed Micro Services. Agile Testing Days 2017
Testing Distributed Micro Services. Agile Testing Days 2017Testing Distributed Micro Services. Agile Testing Days 2017
Testing Distributed Micro Services. Agile Testing Days 2017Carlos Sanchez
 
Kubernetes for the PHP developer
Kubernetes for the PHP developerKubernetes for the PHP developer
Kubernetes for the PHP developerPaul Czarkowski
 
How containers helped a SaaS startup be developed and go live
How containers helped a SaaS startup be developed and go liveHow containers helped a SaaS startup be developed and go live
How containers helped a SaaS startup be developed and go liveRamon Navarro
 

Similar to PHP Project with ElasticSearch Access (20)

Magento 2 Development
Magento 2 DevelopmentMagento 2 Development
Magento 2 Development
 
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agentsPVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents
PVS-Studio: analyzing pull requests in Azure DevOps using self-hosted agents
 
Development Setup of B-Translator
Development Setup of B-TranslatorDevelopment Setup of B-Translator
Development Setup of B-Translator
 
Lean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and DrushLean Drupal Repositories with Composer and Drush
Lean Drupal Repositories with Composer and Drush
 
Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)Running Docker in Development & Production (#ndcoslo 2015)
Running Docker in Development & Production (#ndcoslo 2015)
 
Capistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient wayCapistrano deploy Magento project in an efficient way
Capistrano deploy Magento project in an efficient way
 
Deploying configurable frontend web application containers
Deploying configurable frontend web application containersDeploying configurable frontend web application containers
Deploying configurable frontend web application containers
 
ABCs of docker
ABCs of dockerABCs of docker
ABCs of docker
 
MeaNstack on Docker
MeaNstack on DockerMeaNstack on Docker
MeaNstack on Docker
 
Zero Downtime Deployment with Ansible
Zero Downtime Deployment with AnsibleZero Downtime Deployment with Ansible
Zero Downtime Deployment with Ansible
 
Ddev workshop t3dd18
Ddev workshop t3dd18Ddev workshop t3dd18
Ddev workshop t3dd18
 
Using Composer with Drupal and Drush
Using Composer with Drupal and DrushUsing Composer with Drupal and Drush
Using Composer with Drupal and Drush
 
Kubernetes laravel and kubernetes
Kubernetes   laravel and kubernetesKubernetes   laravel and kubernetes
Kubernetes laravel and kubernetes
 
Docker Security workshop slides
Docker Security workshop slidesDocker Security workshop slides
Docker Security workshop slides
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environment
 
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
Erik Skytthe - Monitoring Mesos, Docker, Containers with Zabbix | ZabConf2016
 
Testing Distributed Micro Services. Agile Testing Days 2017
Testing Distributed Micro Services. Agile Testing Days 2017Testing Distributed Micro Services. Agile Testing Days 2017
Testing Distributed Micro Services. Agile Testing Days 2017
 
Kubernetes for the PHP developer
Kubernetes for the PHP developerKubernetes for the PHP developer
Kubernetes for the PHP developer
 
How containers helped a SaaS startup be developed and go live
How containers helped a SaaS startup be developed and go liveHow containers helped a SaaS startup be developed and go live
How containers helped a SaaS startup be developed and go live
 
CI and CD
CI and CDCI and CD
CI and CD
 

More from Christian Münch

n98-magerun2 - Presentation 2020
n98-magerun2 - Presentation 2020n98-magerun2 - Presentation 2020
n98-magerun2 - Presentation 2020Christian Münch
 
Magento 2 Zertifizierung - Wissenswertes und ein paar Tipps
Magento 2 Zertifizierung - Wissenswertes und ein paar TippsMagento 2 Zertifizierung - Wissenswertes und ein paar Tipps
Magento 2 Zertifizierung - Wissenswertes und ein paar TippsChristian Münch
 
Jenkins to Gitlab - Intelligent Build-Pipelines
Jenkins to Gitlab - Intelligent Build-PipelinesJenkins to Gitlab - Intelligent Build-Pipelines
Jenkins to Gitlab - Intelligent Build-PipelinesChristian Münch
 
Magento Headless - Stammtisch Rhein-Main
Magento Headless - Stammtisch Rhein-MainMagento Headless - Stammtisch Rhein-Main
Magento Headless - Stammtisch Rhein-MainChristian Münch
 
Continous Integration in einem Open Source Projekt
Continous Integration in einem Open Source ProjektContinous Integration in einem Open Source Projekt
Continous Integration in einem Open Source ProjektChristian Münch
 
Magento auf der Kommandozeile: n98-magerun, ein netz98 Tool
Magento auf der Kommandozeile: n98-magerun, ein netz98 ToolMagento auf der Kommandozeile: n98-magerun, ein netz98 Tool
Magento auf der Kommandozeile: n98-magerun, ein netz98 ToolChristian Münch
 
Abläufe mit PHP und Phing automatisieren
Abläufe mit PHP und Phing automatisierenAbläufe mit PHP und Phing automatisieren
Abläufe mit PHP und Phing automatisierenChristian Münch
 
TV App Development - Überblick und Einblick
TV App Development - Überblick und EinblickTV App Development - Überblick und Einblick
TV App Development - Überblick und EinblickChristian Münch
 
Abläufe mit Phing automatisieren
Abläufe mit Phing automatisierenAbläufe mit Phing automatisieren
Abläufe mit Phing automatisierenChristian Münch
 
Caching in PHP - Status Quo
Caching in PHP - Status QuoCaching in PHP - Status Quo
Caching in PHP - Status QuoChristian Münch
 
INMON CMS Entwicklung / Funktionen
INMON CMS Entwicklung / FunktionenINMON CMS Entwicklung / Funktionen
INMON CMS Entwicklung / FunktionenChristian Münch
 

More from Christian Münch (13)

n98-magerun2 - Presentation 2020
n98-magerun2 - Presentation 2020n98-magerun2 - Presentation 2020
n98-magerun2 - Presentation 2020
 
Magento 2 Zertifizierung - Wissenswertes und ein paar Tipps
Magento 2 Zertifizierung - Wissenswertes und ein paar TippsMagento 2 Zertifizierung - Wissenswertes und ein paar Tipps
Magento 2 Zertifizierung - Wissenswertes und ein paar Tipps
 
12 Factor Apps with PHP
12 Factor Apps with PHP12 Factor Apps with PHP
12 Factor Apps with PHP
 
Jenkins to Gitlab - Intelligent Build-Pipelines
Jenkins to Gitlab - Intelligent Build-PipelinesJenkins to Gitlab - Intelligent Build-Pipelines
Jenkins to Gitlab - Intelligent Build-Pipelines
 
Magento Headless - Stammtisch Rhein-Main
Magento Headless - Stammtisch Rhein-MainMagento Headless - Stammtisch Rhein-Main
Magento Headless - Stammtisch Rhein-Main
 
Continous Integration in einem Open Source Projekt
Continous Integration in einem Open Source ProjektContinous Integration in einem Open Source Projekt
Continous Integration in einem Open Source Projekt
 
Magento auf der Kommandozeile: n98-magerun, ein netz98 Tool
Magento auf der Kommandozeile: n98-magerun, ein netz98 ToolMagento auf der Kommandozeile: n98-magerun, ein netz98 Tool
Magento auf der Kommandozeile: n98-magerun, ein netz98 Tool
 
Abläufe mit PHP und Phing automatisieren
Abläufe mit PHP und Phing automatisierenAbläufe mit PHP und Phing automatisieren
Abläufe mit PHP und Phing automatisieren
 
TV App Development - Überblick und Einblick
TV App Development - Überblick und EinblickTV App Development - Überblick und Einblick
TV App Development - Überblick und Einblick
 
Abläufe mit Phing automatisieren
Abläufe mit Phing automatisierenAbläufe mit Phing automatisieren
Abläufe mit Phing automatisieren
 
Caching in PHP - Status Quo
Caching in PHP - Status QuoCaching in PHP - Status Quo
Caching in PHP - Status Quo
 
INMON CMS Entwicklung / Funktionen
INMON CMS Entwicklung / FunktionenINMON CMS Entwicklung / Funktionen
INMON CMS Entwicklung / Funktionen
 
Php Schulung
Php SchulungPhp Schulung
Php Schulung
 

Recently uploaded

Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
WomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneWomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneUiPathCommunity
 
Transport in Open Pits______SM_MI10415MI
Transport in Open Pits______SM_MI10415MITransport in Open Pits______SM_MI10415MI
Transport in Open Pits______SM_MI10415MIRomil Mishra
 
Deliver Latency Free Customer Experience
Deliver Latency Free Customer ExperienceDeliver Latency Free Customer Experience
Deliver Latency Free Customer ExperienceOpsTree solutions
 
Dynamical Context introduction word sensibility orientation
Dynamical Context introduction word sensibility orientationDynamical Context introduction word sensibility orientation
Dynamical Context introduction word sensibility orientationBuild Intuit
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesBernd Ruecker
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Jeffrey Haguewood
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentMahmoud Rabie
 
Why Agile? - A handbook behind Agile Evolution
Why Agile? - A handbook behind Agile EvolutionWhy Agile? - A handbook behind Agile Evolution
Why Agile? - A handbook behind Agile EvolutionDEEPRAJ PATHAK
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
full stack practical assignment msc cs.pdf
full stack practical assignment msc cs.pdffull stack practical assignment msc cs.pdf
full stack practical assignment msc cs.pdfHulkTheDevil
 
Which standard is best for your content?
Which standard is best for your content?Which standard is best for your content?
Which standard is best for your content?Rustici Software
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Software Security in the Real World w/Kelsey Hightower
Software Security in the Real World w/Kelsey HightowerSoftware Security in the Real World w/Kelsey Hightower
Software Security in the Real World w/Kelsey HightowerAnchore
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...Karmanjay Verma
 
Transcript: Green paths: Learning from publishers’ sustainability journeys - ...
Transcript: Green paths: Learning from publishers’ sustainability journeys - ...Transcript: Green paths: Learning from publishers’ sustainability journeys - ...
Transcript: Green paths: Learning from publishers’ sustainability journeys - ...BookNet Canada
 
The Critical Role of Spatial Data in Today's Data Ecosystem
The Critical Role of Spatial Data in Today's Data EcosystemThe Critical Role of Spatial Data in Today's Data Ecosystem
The Critical Role of Spatial Data in Today's Data EcosystemSafe Software
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 

Recently uploaded (20)

Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
WomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneWomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyone
 
Transport in Open Pits______SM_MI10415MI
Transport in Open Pits______SM_MI10415MITransport in Open Pits______SM_MI10415MI
Transport in Open Pits______SM_MI10415MI
 
Deliver Latency Free Customer Experience
Deliver Latency Free Customer ExperienceDeliver Latency Free Customer Experience
Deliver Latency Free Customer Experience
 
Dynamical Context introduction word sensibility orientation
Dynamical Context introduction word sensibility orientationDynamical Context introduction word sensibility orientation
Dynamical Context introduction word sensibility orientation
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
QCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architecturesQCon London: Mastering long-running processes in modern architectures
QCon London: Mastering long-running processes in modern architectures
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career Development
 
Why Agile? - A handbook behind Agile Evolution
Why Agile? - A handbook behind Agile EvolutionWhy Agile? - A handbook behind Agile Evolution
Why Agile? - A handbook behind Agile Evolution
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
full stack practical assignment msc cs.pdf
full stack practical assignment msc cs.pdffull stack practical assignment msc cs.pdf
full stack practical assignment msc cs.pdf
 
Which standard is best for your content?
Which standard is best for your content?Which standard is best for your content?
Which standard is best for your content?
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Software Security in the Real World w/Kelsey Hightower
Software Security in the Real World w/Kelsey HightowerSoftware Security in the Real World w/Kelsey Hightower
Software Security in the Real World w/Kelsey Hightower
 
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...React JS; all concepts. Contains React Features, JSX, functional & Class comp...
React JS; all concepts. Contains React Features, JSX, functional & Class comp...
 
Transcript: Green paths: Learning from publishers’ sustainability journeys - ...
Transcript: Green paths: Learning from publishers’ sustainability journeys - ...Transcript: Green paths: Learning from publishers’ sustainability journeys - ...
Transcript: Green paths: Learning from publishers’ sustainability journeys - ...
 
The Critical Role of Spatial Data in Today's Data Ecosystem
The Critical Role of Spatial Data in Today's Data EcosystemThe Critical Role of Spatial Data in Today's Data Ecosystem
The Critical Role of Spatial Data in Today's Data Ecosystem
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 

PHP Project with ElasticSearch Access

  • 1. Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev 11
  • 2. Beispiel Projekt Ziel: PHP Anwendung mit Zugriff auf ElasticSearch 22Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 3. Verzeichnis . ├── composer.json └── index.php 33Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 4. Minimale composer.json { "name": "muench-dev/example-project", "description": "ddev Example Project", "type": "project", "license": "MIT", "authors": [ { "name": "Christian Münch", "email": "christian@muench-worms.de" } ], "require": { "elasticsearch/elasticsearch": "^7.9" } 44
  • 5. index.php <?php require_once 'vendor/autoload.php'; phpinfo(); 55Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 6. Let's go! ddev config --project-name=example-project --php-version=7.4 --project ddev start 66Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 7. ❯ ddev start Starting example-project... Pushed mkcert rootca certs to ddev-global-cache/mkcert Running Command=ip address show dev docker0 Building db Building web Creating ddev-example-project-db ... done Creating ddev-example-project-web ... done Creating ddev-example-project-dba ... done Creating ddev-router ... done Successfully started example-project Project can be reached at https://example-project.ddev.site https://127.0.0.1:32786 77Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 8. PHP Projekt ddev composer install 88Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 9. ❯ ddev composer install No lock file found. Updating dependencies instead of installing from lo Loading composer repositories with package information Updating dependencies Lock file operations: 5 installs, 0 updates, 0 removals - Locking elasticsearch/elasticsearch (v7.9.1) - Locking ezimuel/guzzlestreams (3.0.1) - Locking ezimuel/ringphp (1.1.2) - Locking psr/log (1.1.3) - Locking react/promise (v2.8.0) Writing lock file Installing dependencies from lock file (including require-dev) Package operations: 5 installs, 0 updates, 0 removals - Installing psr/log (1.1.3): Extracting archive - Installing react/promise (v2.8.0): Extracting archive - Installing ezimuel/guzzlestreams (3.0.1): Extracting archive - Installing ezimuel/ringphp (1.1.2): Extracting archive - Installing elasticsearch/elasticsearch (v7.9.1): Extracting archive 1 package suggestions were added by new dependencies, use `composer sug Generating autoload files 99
  • 10. 1010
  • 11. 1111
  • 12. Mac Performance ddev config --nfs-mount-enabled=true 1212Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 13. NFS ist für jeden angeschaltet! 1313Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 14. Lösung anlegen einer lokalen Config Dateien /config.*.y*ml sind per .gitignore ausgeschlossen. 1414Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 15. Beispiel config.local.yaml nfs_mount_enabled: false 1515Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 16. Tipp: Bash Alias ddev-disable-nfs-mount-locally='echo "nfs_mount_enabled: false" >> .ddev/config.local.yaml' 1616Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 17. NFS Problematiken NFS muss installiert sein -> Sonst kommen komische Fehlermeldungen NFS Installation je Betriebssystem unter schiedlich Unterschiedliche Partitionierung Unterschiedliche Benutzer-IDs Keine Inotify Events (Watch-Tasks z.B. grunt, webpack, Magento Cache Clean) 1717Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 18. Inotify Proxy Diverse Lösungen erhältlich Bekanntes NPM Paket ist nur ein Wrapper für eine C-Lib und benötigt installierte Build-Tools. Kleiner, schneller, golang https://github.com/cmuench/inotify-proxy ddev Command: https://github.com/cmuench/inotify-proxy/wiki/ddev- inotify-Command 1818Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 19. Homeadditions .ddev/homeadditions ~/.ddev/homeadditions . └── homeadditions    ├── bash_aliases.example    └── .bashrc 1919Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 20. Beispiel .bashrc export PS1="[e[32m][[e[m][e[36m][e[m][e[32m]h[e[m]: alias ls='ls --color=auto' alias ll='ls -la' alias cd-root="cd /var/www/html" 2020Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 21. 2121
  • 22. Verzeichnisse . ├── commands │   ├── db │   ├── host │   ├── solr │   └── web 2222Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 23. Host Commands Beispiel: ~/.ddev/commands/host/ide 2323Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 24. !/bin/bash #ddev-generated ## Description: Open project in IDE ## Usage: ide ## Example: "ddev ide" /opt/intellij-idea-ultimate-edition/bin/idea.sh ${DDEV_APPROOT} > /dev/null 2>&1 & 2424Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 25. Container Commands 2525Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 26. Magento Kommando #!/bin/bash #ddev-generated ## Description: Run magento CLI inside the web container ## Usage: magento [flags] [args] ## Example: "ddev magento list" or "ddev magento maintenance:enable" ## ProjectTypes: magento2 bin/magento "$@" 2626Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 27. 2727
  • 28. docker-compose Konfiguration docker-compose up -d docker-compose -f docker-compose.yaml up -d docker-compose -f foo.yaml -f bar.yaml -f zoz.yaml up -d 2828Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 29. Verzeichnisstruktur .ddev ├── .ddev-docker-compose-base.yaml ├── .ddev-docker-compose-full.yaml ├── config.yaml ├── db-build │   └── Dockerfile.example └── web-build └── Dockerfile.example 2929Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 30. Beispiel ElasticSearch ... 3030Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 31. version: '3.6' services: elasticsearch: container_name: 'ddev-${DDEV_SITENAME}-elasticsearch' hostname: '${DDEV_SITENAME}-elasticsearch' image: elasticsearch:7.6.2 ports: - '9200' - '9300' environment: - VIRTUAL_HOST=elasticsearch-$DDEV_HOSTNAME - HTTP_EXPOSE=9200 - discovery.type=single-node labels: com.ddev.site-name: '${DDEV_SITENAME}' com.ddev.approot: $DDEV_APPROOT volumes: - 'elasticsearch:/usr/share/elasticsearch/data' 3131
  • 32. version: '3.6' services: elasticsearch: ... web: depends_on: - elasticsearch links: - 'elasticsearch:elasticsearch' volumes: elasticsearch: name: '${DDEV_SITENAME}-elasticsearch' 3232Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 33. ❯ ddev start Starting example-project... Running Command=ip address show dev docker0 Creating volume "example-project-elasticsearch" with default driver Building db Building web Creating ddev-example-project-elasticsearch ... done Recreating ddev-example-project-db ... done Recreating ddev-example-project-dba ... done Recreating ddev-example-project-web ... done 3333Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 34. ddev describe $> ddev describe ... Other Services -------------- MailHog (https): https://example-project.ddev.site:8026 MailHog: http://example-project.ddev.site:8025 phpMyAdmin (https): https://example-project.ddev.site:8037 phpMyAdmin: http://example-project.ddev.site:8036 elasticsearch: http://example-project.ddev.site:9200 ... 3434Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 35. ❯ ddev exec "curl http://elasticsearch:9200" { "name" : "example-project-elasticsearch", "cluster_name" : "docker-cluster", "cluster_uuid" : "fX7_HMTxRiC_1KL4nbTqAg", "version" : { "number" : "7.6.2", "build_flavor" : "default", "build_type" : "docker", "build_hash" : "ef48eb35cf30adf4db14086e8aabd07ef6fb113f", "build_date" : "2020-03-26T06:34:37.794943Z", "build_snapshot" : false, "lucene_version" : "8.4.0", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search" } 3535Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 36. <?php require_once 'vendor/autoload.php'; use ElasticsearchClientBuilder; $params = [ 'hosts' => [ 'elasticsearch:9200' ] ]; try { $client = ClientBuilder::fromConfig($params); $client->ping(); echo "ElasticSearch connection established"; } catch (Exception $exception) { echo $exception->getMessage(); exit(1); } 3636Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 37. Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev 3737
  • 38. 3838
  • 40. Tasks exec -> Im Container (genormte Umgebung) exec_host -> Auf dem Host (Achtung!) composer -> Führt ein Composer Kommando aus 4040Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 41. config.yaml Anpassung hooks: post-start: - composer: install 4141Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 42. ❯ ddev start Starting example-project... ... Executing post-start hook... === Running task: Composer command 'install' in web container, output below Installing dependencies from lock file (including require-dev) Verifying lock file contents can be installed on current platform. Nothing to install, update or remove Generating autoload files ... Successfully started example-project 4242
  • 43. Shell Scripte hooks: post-start: - exec: bash .ddev/step1_install_special_tools.sh - exec: bash .ddev/step2_setup_myapplication.sh # other container - exec: bash .ddev/do_some_db_stuff.sh service: db - exec: bin/elasticsearch-plugin install analysis-icu service: elasticsearch 4343Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 44. === Running task: Exec command 'bin/elasticsearch-plugin install analysis-icu' in container/service 'elasticsearch', output below -> Installing analysis-icu -> Downloading analysis-icu from elastic [=================================================] 100%?? -> Installed analysis-icu Successfully started example-project 4444Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev
  • 45. Vielen Dank! Fragen oder Livedemo? 4545Christian Münch / @cmuench / muench.devChristian Münch / @cmuench / muench.dev