Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/production.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ git clone [email protected]:<username>/<project-name>.git
Go into the directory containing your project (`<project-name>`), and start the app in production mode:

```console
# Build fresh production image
docker compose -f compose.yaml -f compose.prod.yaml build --no-cache

# Start container
SERVER_NAME=your-domain-name.example.com \
APP_SECRET=ChangeMe \
CADDY_MERCURE_JWT_SECRET=ChangeThisMercureHubJWTSecretKey \
Expand Down
52 changes: 52 additions & 0 deletions docs/troubleshooting.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,55 @@ If you work on linux and cannot edit some of the project files right after the f
## TLS/HTTPS Issues

See more in the [TLS section](tls.md)

## Production issues

### How to properly build fresh images for production use

Remember that, by default, if you run `docker compose up -d`, only the files `compose.yaml` and `compose.override.yaml` will be used.
See https://docs.docker.com/compose/intro/compose-application-model.

If you need to build images for production environment, you have to use the following command:
`docker compose -f compose.yaml -f compose.prod.yaml build --no-cache`.

### Why application outputs `phpinfo()`

Both dev and prod images have the same image tag (`<...>app-php:latest`). This can cause confusion when working with images.
It is important to make sure that your image is the appropriate one for the current environment.

If you are not careful about this, and try to run your production container(s) with
`docker compose -f compose.yaml -f compose.prod.yaml up -d`
without the right build process beforehand, your application **will still launch**, but will be displaying an output of `phpinfo()` (or possibly even a HTTP 500 error page).

See details below.

<details>

<summary>Output of a basic build process</summary>

In the case of a dev image, you need the `compose.yaml` and `compose.override.yaml` files. Which are the default files for Docker Compose.
This means that running `docker compose <command>` or `docker compose -f compose.yaml -f compose.override.yaml <command>` is the same thing.

And in doing so, images `frankenphp_base` and `frankenphp_dev` are built. And not `frankenphp_prod`.
Which is good enough for dev purposes.

Then, you can start your dev container(s) by running: `docker compose up -d`.

</details>

<br>

<details>

<summary>Output expected for the production build process</summary>

To build the production image, you <ins>have to</ins> specify the `compose.yaml` and `compose.prod.yaml` files.
This means you have to run: `docker compose -f compose.yaml -f compose.prod.yaml up -d` in order to build your image
(careful: the order of `-f` arguments is important).

That way, you will see that `frankenphp_base` and `frankenphp_prod` are built this time, which is what you will need for production purposes.

You can finally start your prod container(s) by running: `docker compose -f compose.yaml -f compose.prod.yaml up -d`.

</details>