Skip to content

Commit

Permalink
docs(README.md): update XDebug section
Browse files Browse the repository at this point in the history
  • Loading branch information
Alcides Ramos committed Oct 5, 2024
1 parent 4332c56 commit 7724941
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 37 deletions.
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ down: ## Docker: stops the service <env=[dev|prod]>
.PHONY: logs
logs: ## Docker: exposes the service logs <env=[dev|prod]> <service=[app1|caddy]>
@$(eval env ?= 'dev')
@$(eval service ?= 'caddy')
$(call showInfo,"Exposing service\(s\) logs...")
@$(eval service ?= $(SERVICE_APP))
$(call showInfo,"Exposing service\(s\) logs for [ $(service) ] service...")
@echo ""
@$(DOCKER_COMPOSE) logs -f $(service)
$(call taskDone)
Expand All @@ -168,8 +168,8 @@ shell: ## Docker: establish a shell session into main container

.PHONY: inspect
inspect: ## Docker: inspect the health for specific service <service=[app1|caddy]>
@$(eval service ?= 'caddy')
$(call showInfo,"Inspecting the health for a specific service...")
@$(eval service ?= $(SERVICE_APP))
$(call showInfo,"Inspecting the health for [ $(service) ] service...")
@echo ""
@docker inspect --format "{{json .State.Health}}" $(service) | jq
@echo ""
Expand Down Expand Up @@ -247,3 +247,8 @@ open-website: ## Application: open the application website
@xdg-open $(WEBSITE_URL)
@$(call showAlert,"Press Ctrl+C to resume your session")
$(call taskDone)

.PHONY: init
init: build install-caddy-certificate ## Application: initializes the application
$(call showInfo,"When ready just execute [ make open-website ] to visit the website with your preferred browser")
$(call taskDone)
84 changes: 51 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Dockerized PHP


> A _dockerized_ environment based on Caddy + PHP-FPM running on a Linux Alpine container.
> A _dockerized_ environment based on Caddy + PHP-FPM running on separated Linux Alpine containers.

[TOC]
Expand All @@ -19,10 +19,10 @@ This repository contains a _dockerized_ environment for building PHP application
### Highlights

- Unified environment to build <abbr title="Command Line Interface">CLI</abbr>, <u>web applications</u> and/or <u>micro-services</u> based on **PHP8**.
- Allows you to create an optimized **development environment** Docker image
- Allows you to create an optimized **production-ready** Docker image
- **Self-signed local domains** thanks to Caddy.

- Multi-stage Dockerfile to allows you to create an optimized **development** or **production-ready** Docker images
- Uses **Caddy webserver**.
- **Self-signed local domains** thanks to Caddy.
- **Everything on separated Docker services**.


------
Expand Down Expand Up @@ -76,7 +76,7 @@ $ git clone [email protected]:alcidesrc/dockerized-php.git .

`Dockerfile` is based on [multi-stage builds](https://docs.docker.com/build/building/multi-stage/) in order to simplify the process to generate the **development container image** and the optimized **production-ready container image**.

##### Default Stages
##### Defined Stages

| Name | Description |
| --------------------------- | ------------------------------------------------------------------------------------ |
Expand All @@ -88,7 +88,7 @@ $ git clone [email protected]:alcidesrc/dockerized-php.git .
| `optimize-php-dependencies` | Used to optimize the PHP dependencies in production by removing the development ones |
| `build-production` | Used to build the **production** environment |

###### Default Stages Hierarchy
###### Defined Stages Hierarchy

```mermaid
---
Expand All @@ -108,7 +108,7 @@ stateDiagram-v2

##### Health check

A custom health check script is provided to check the container service by performing a `PHP-FPM` `ping/pong` check.
A custom health check script is provided to check the container service by performing the default `PHP-FPM` `ping/pong` check.

You can find this shell script at `build/healthcheck.sh`.

Expand Down Expand Up @@ -181,7 +181,7 @@ The container service logs to `STDOUT` by default.

##### Volumes

There are some volumes created between the *host* and the container service:
There is a **bind volume** created between the *host* and the container service:

| Host path | Container path | Description |
| --------- | --------------- | ---------------------- |
Expand Down Expand Up @@ -231,6 +231,8 @@ A *Makefile* is provided with following commands:
· install-laravel Application: installs Laravel
· install-symfony Application: installs Symfony
· uninstall Application: removes the PHP application
· open-website Application: open the application website
· init Application: initializes the application
```

#### Web Server
Expand Down Expand Up @@ -310,37 +312,45 @@ Testing with date and/or time variations sometimes can be a nightmare. To assist


### Max. simultaneous connectionsMax. simultaneous connectionsDevelopment Environment
### Development Environment

#### Quickstart

```bash
$ make init
```

#### Build Docker Image
##### TL;DR

##### Linux Based Hosts
###### Building the container

```bash
$ make build
```

##### Windows Hosts
###### Starting the container service

```bash
$ docker compose build
$ make up
```

#### Access to Container

##### Linux Based Hosts
###### Extracting Caddy Local Authority - 20XX ECC Root

```bash
$ make bash
$ make install-caddy-certificate
```

##### Windows Hosts
###### Accessing to web application

```bash
$ docker run -it --rm app:development bash
$ make open-website
```

###### Stopping the container service

```bash
$ make down
```

#### Setup PHPStorm

Expand Down Expand Up @@ -375,7 +385,7 @@ Ensure the `~/path/to/my-new-project/src` folder is mapped to `/var/www/html`
> When selecting Docker Compose configuration files, ensure to include:
>
> 1. The `docker-compose.yml` file, which contains the default service(s) specification
> 2. The `docker-compose-dev.yml` file, which contains some override values or customization from default specification.
> 2. The `docker-compose.override.dev.yml` file, which may contains some override values or customization from default specification.
>
> **The order on here is important!**
Expand All @@ -387,37 +397,45 @@ Ensure the `~/path/to/my-new-project/src` folder is mapped to `/var/www/html`

### Production Environment

#### Build Docker Image

##### Linux Based Hosts
#### Quickstart

```bash
$ make env=prod
$ make init env=prod
```

##### Windows Hosts
##### TL;DR

###### Building the container

```bash
$ docker buildx build --target=build-production --tag="app:production" .
$ make build env=prod
```

#### Access to Container

##### Linux Based Hosts
###### Starting the container service

```bash
$ make shell env=prod
$ make up env=prod
```

##### Windows Hosts
###### Extracting Caddy Local Authority - 20XX ECC Root

```bash
$ docker run -it --rm app:production sh
$ make install-caddy-certificate env=prod
```

###### Accessing to web application

```bash
$ make open-website env=prod
```

###### Stopping the container service

```bash
$ make down env=prod
```

####

------

Expand Down
Binary file modified README/setup-phpstorm-xdebug/phpstorm-settings-php-servers.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified README/setup-phpstorm-xdebug/phpstorm-settings-php-settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7724941

Please sign in to comment.