mautic のソースコード를 WSL2에서 실행
PS > wsl -l -v
NAME STATE VERSION
* Ubuntu-18.04 Running 2
とりあえず 클론 가능.
PS > git clone [email protected]:mautic/mautic.git
ddev で動作させる
루트에
.ddev/
があるので、そちらに乗ってみる.Installing Mautic using DDEV | Grav
ddev config
は記事通りに全部 デフォルトで.~/git/mautic$ ddev config
You are reconfiguring the project at /home/dan/git/mautic.
The existing configuration will be updated and replaced.
Project name (mautic):
The docroot is the directory from which your site is served.
This is a relative path from your project root at /home/dan/git/mautic
You may leave this value blank if your site files are in the project root
Docroot Location (current directory):
Found a php codebase at /home/dan/git/mautic.
Project Type [backdrop, drupal6, drupal7, drupal8, drupal9, laravel, magento, magento2, php, shopware6, typo3, wordpress] (php):
Project type has no settings paths configured, so not creating settings file.
Configuration complete. You may now run 'ddev start'.
.ddev/config.yaml
は以下を変更.-router_http_port: "80"
-router_https_port: "443"
+router_http_port: "8081"
+router_https_port: "4431"
+timezone: Asia/Tokyo
composer_version: "2"
ってのがそのままでいいのか気になりましたが、데포르트가 feature
브런치다 たので、もう 4系になってるからだと.$ ddev start
略
================
Install complete
================
[2021-06-17 07:53:31]
[2021-06-17 07:53:31] // Warming up the cache for the dev environment with debug true
[2021-06-17 07:53:31]
[2021-06-17 07:53:31]
[2021-06-17 07:53:31] [OK] Cache for the "dev" environment (debug=true) was successfully warmed.
[2021-06-17 07:53:31]
[2021-06-17 07:53:31]
Enabling plugins...
13 new plugins were installed and 0 updated.
All done! Here's some useful information:
・ The default login is admin/mautic
・ To open the Mautic instance, go to https://mautic.ddev.site in your browser.
・ To open PHPMyAdmin for managing the database, go to https://mautic.ddev.site:8037 in your browser.
・ To open MailHog for seeing all emails that Mautic sent, go to https://mautic.ddev.site:8026 in your browser.
・ Run "ddev exec composer test" to run PHPUnit tests.
・ Run "ddev exec bin/console COMMAND" (like mautic:segments:update) to use the Mautic CLI. For an overview of all available CLI commands, go to https://mau.tc/cli
・ If you want to stop the instance, simply run "ddev stop".
Successfully started mautic
Project can be reached at https://mautic.ddev.site:4431 https://127.0.0.1:55445
記事には以下の記述があるので実行しておきます.
If you cloned Mautic from GitHub, there is one final step: You need to connect to the running DDEV container and then have Composer install all of the Mautic dependencies. This is done by first running
ddev ssh
to connect to the container, and then from the project root (which DDEV by default connects you to), runcomposer install
to install all dependencies.
実行はしてみたものの、
Nothing to install
なので実行は不要だったのかも./var/www/html$ composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Nothing to install, update or remove
Package misd/phone-number-bundle is abandoned, you should avoid using it. Use odolbeau/phone-number-bundle instead.
Package symfony/inflector is abandoned, you should avoid using it. Use use `EnglishInflector` from the String component instead instead.
Package rector/rector-prefixed is abandoned, you should avoid using it. Use rector/rector instead.
Generating autoload files
composer/package-versions-deprecated: Generating version class...
composer/package-versions-deprecated: ...done generating version class
129 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Symfony recipes are disabled: "symfony/flex" not found in the root composer.json
Executing script php -r "if(file_exists('./.git')&&file_exists('./build/hooks/pre-commit'.(PHP_OS=='WINNT'?'.win':''))){copy('./build/hooks/pre-commit'.(PHP_OS=='WINNT'?'.win':''),'./.git/hooks/pre-commit');} if(file_exists('./.git')&&file_exists('./build/hooks/post-checkout')){copy('./build/hooks/post-checkout','./.git/hooks/post-checkout');}" [OK]
Executing script php -r "if(file_exists('./.git/hooks/pre-commit')&&(PHP_OS!='WINNT')){chmod('./.git/hooks/pre-commit',0755);} if(file_exists('./.git/hooks/post-checkout')&&(PHP_OS!='WINNT')){chmod('./.git/hooks/post-checkout',0755);}" [OK]
> find . -mindepth 2 -type d -name .git | xargs rm -rf
開いてみる
https://mautic.ddev.site:4431
アカウントは先程のlogにあったとおり
admin/mautic
でloginできます.他のInstorruApri
$ ddev describe
NAME TYPE LOCATION URL STATUS
mautic php ~/git/mautic https://mautic.ddev.site:4431 running
Project Information
-------------------
PHP version: 7.4
NFS mount enabled: false
Database type: mariadb
MariaDB version: 10.3
URLs
----
https://mautic.ddev.site:4431
https://127.0.0.1:55445
http://mautic.ddev.site:8081
http://127.0.0.1:55446
MySQL/MariaDB Credentials
------------------------------
Username: "db", Password: "db", Default database: "db"
or use root credentials when needed: Username: "root", Password: "root"
Database hostname and port INSIDE container: db:3306
To connect to db server inside container or in project settings files:
mysql --host=db --user=db --password=db --database=db
Database hostname and port from HOST: 127.0.0.1:55433
To connect to mysql from your host machine,
mysql --host=127.0.0.1 --port=55433 --user=db --password=db --database=db
Other Services
-------------------
MailHog (https): https://mautic.ddev.site:8026
MailHog: http://mautic.ddev.site:8025
phpMyAdmin (https): https://mautic.ddev.site:8037
phpMyAdmin: http://mautic.ddev.site:8036
DDEV ROUTER STATUS: healthy
ssh-auth status: healthy
実はinstor 時に
8025
が衝突して一度失敗したんですが、なるほどこちらでも MailHog
をinstor してたんですね.上記の URL で問題なくアクセスできました.
PhpStorm을 사용하려면
JetBrains プロダクトが今年あたりから WSL2 に対応しており、これまで VS Code でやっていたものが一気に便利になりました.(これまでも Windows 側にマウントしたディレクトリに配置していれば開けましたが、たまに変なことになるので待望でした.)
今回だ와
\\wsl$\Ubuntu-18.04\home\dan\git\mautic
みたいなパスで開くことができます.(IDE 側で勝手に WSL 側も含めてエクスプローラー開いてくれるので直打ちする ことはないです)ddev の PHP を使う
WSL2는 PHP를 사용하지 않는데, IDE에서 PHP 인타프리타를 사용하려면 ddev를 사용하는 것이 좋습니다.
docker ps
すると、ddev で立ち上がっているkontenanaが分かります.PHP が入っているのは ddrud/ddev-werbserver
コンテナなのでそれを使います.$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS
NAMES
f1b717ae4601 drud/ddev-router:v1.17.3 "/app/docker-entrypo…" 11 minutes ago Up 11 minutes (healthy) 127.0.0.1:4431->4431/tcp, 127.0.0.1:8025-8026->8025-8026/tcp, 127.0.0.1:8036-8037->8 036-8037/tcp, 80/tcp, 127.0.0.1:8081->8081/tcp ddev-router
b4e107b098cf drud/ddev-webserver:v1.17.4-mautic-built "/start.sh" 11 minutes ago Up 11 minutes (healthy) 8025/tcp, 127.0.0.1:55446->80/tcp, 127.0.0.1:55445->443/tcp
ddev-mautic-web
f61027027880 phpmyadmin:5 "/docker-entrypoint.…" 11 minutes ago Up 11 minutes 0.0.0.0:55444->80/tcp
ddev-mautic-dba
3a8e051f958e drud/ddev-dbserver-mariadb-10.3:v1.17.3-mautic-built "/docker-entrypoint.…" 11 minutes ago Up 11 minutes (healthy) 127.0.0.1:55433->3306/tcp
ddev-mautic-db
上記のように設定すれば利用できます.今回は
Docker
で選びましたが, docker-compose
も選べたのでそちらの方がいいのかもしれません.
Reference
이 문제에 관하여(mautic のソースコード를 WSL2에서 실행), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/dany1468/mautic-wsl2-14ln텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)