Updated readme
This commit is contained in:
parent
faec659fd2
commit
4979ec6ca5
1 changed files with 17 additions and 69 deletions
84
README.md
84
README.md
|
@ -1,78 +1,26 @@
|
||||||
|
|
||||||
# Docker PHP Development Environment
|
# Keycloak WebDav
|
||||||
|
|
||||||
This repository allows you to quickly get a development environment up and running using Docker, including a MySQL database and some debugging tools.
|
This project is meant to be a WebDav Server using Keycloak roles for it's [Principals](https://sabre.io/dav/principals/).
|
||||||
|
|
||||||
This environment includes the latest versions of the following software:
|
## Requirements
|
||||||
|
|
||||||
- `nginx:alpine`
|
- PHP
|
||||||
- `php:8.3-fpm`
|
- Composer
|
||||||
- `mysql:latest`
|
- A running keycloak instance
|
||||||
- `xdebug`
|
- A Client with `Direct access grants` enabled
|
||||||
|
|
||||||
## Prerequisites
|
## Configuration
|
||||||
|
|
||||||
- Docker - https://www.docker.com/products/docker-desktop
|
To configure the server, you just need to create a `.env` file following the example.
|
||||||
- Tested and confirmed working on:
|
|
||||||
- macOS 12.3 (Monterey)
|
|
||||||
- Windows 10 Version 21H1 build 19043.1165
|
|
||||||
|
|
||||||
## Project Setup
|
Do not forget to create the users_path, as well as to not forget to add a final `/` to the path.
|
||||||
|
|
||||||
Run `composer create-project jlucki/docker-php-dev-env "project_name"`
|
## Installation
|
||||||
|
|
||||||
Alternatively, download the files from this repo and copy them to your project directory.
|
In order to start the server, simply run the following commands:
|
||||||
|
|
||||||
## Running the Container
|
```sh
|
||||||
|
composer update
|
||||||
1. Run `docker compose up` from the project directory
|
php -S localhost:8080 index.php
|
||||||
- Note: the above command will only work on versions newer than 3.6. If you are using Docker 3.6 or older, use `docker-compose up`
|
```
|
||||||
2. Visit `localhost` in your browser
|
|
||||||
|
|
||||||
## Setting up Xdebug in Your IDE
|
|
||||||
|
|
||||||
_The following instructions are for PHPStorm._
|
|
||||||
|
|
||||||
1. Click on Run > Edit Configurations
|
|
||||||
2. Click the `+` and add a new PHP Remote Debug configuration
|
|
||||||
3. Give the configuration a name
|
|
||||||
4. Tick _Filter debug connection by IDE key_
|
|
||||||
5. Add `PHPSTORM` in the session id
|
|
||||||
6. Click the `...` next to Server
|
|
||||||
7. Click the `+` to add a new server
|
|
||||||
8. Give the server a name, and set the host to `localhost`
|
|
||||||
9. Tick _Use path mappings_
|
|
||||||
10. Under the `Project files` file/directory, next to your project folder, for the `Absolute path on the server` column add `/var/www/html`
|
|
||||||
11. Hit Apply and OK until you've returned to the IDE
|
|
||||||
12. Click the _Start Listening for PHP Debug Connections_ icon
|
|
||||||
13. Set a breakpoint in your code
|
|
||||||
14. Refresh the page in your browser
|
|
||||||
15. Accept _Incoming Connection From Xdebug_
|
|
||||||
16. Happy debugging!
|
|
||||||
|
|
||||||
See https://xdebug.org/docs/remote for how to enable xdebug sessions.
|
|
||||||
|
|
||||||
## Additional Notes
|
|
||||||
|
|
||||||
For database connections, use `mysql` as the hostname. If you would like a different hostname, change the service name in the `docker-compose.yml` file.
|
|
||||||
|
|
||||||
## Windows 10 Troubleshooting
|
|
||||||
|
|
||||||
If you are having problems and can't seem to fix the issue, try one or both of these fixes:
|
|
||||||
|
|
||||||
### Solution 1
|
|
||||||
Try switching to **Windows containers**:
|
|
||||||
|
|
||||||
Right-click the Docker icon in the system tray and click **Switch to Windows containers** as seen below:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
### Solution 2
|
|
||||||
If the **Use the WSL 2 based engine** setting is checked:
|
|
||||||
|
|
||||||
Uncheck the setting, then enable file sharing located under the **Resources** section, then the **File Sharing** section as seen below:
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
If the **Use the WSL 2 based engine** setting is unchecked:
|
|
||||||
Enable/check the setting (file sharing is automatically configured)
|
|
||||||
|
|
Loading…
Reference in a new issue