phd uses an environment variables based configuration, see also [Dev/prod parity](http://12factor.net/dev-prod-parity) for more information about this topic.
There are two level of environment configurations.
There are two levels of environment configurations.
**Variables for controlling the application stacks *(outside on your host)* with `docker-compose`, are defined in `.env` files.**
Variables for controlling the application stacks *(outside on your host)* with `docker-compose`, are defined in
-`.env` files.
**Environment settings used within the application services *(inside a container)* are defined in `*.yml` files and `src/app.env`.**
## Basic configuration
Environment settings used within the application services *(inside a container)* are defined in
:exclamation: Before starting the application the first time, update your `.env-dist`, `tests/.env-dist` and `src/app.env` files with sane defaults for the new project.
See also hierarchy & scopes below for more information about variables.
## Host environment
:exclamation: Before starting the application the first time, run `make init` to create your `.env` and `tests/.env` from `.dist`-files.
### Development stack
...
...
@@ -25,25 +30,24 @@ There are two level of environment configurations.
### Testing stack
COMPOSE_PROJECT_NAME=test-myapp
COMPOSE_PROJECT_NAME=testmyapp
STACK_PHP_IMAGE=local/namespace/myapp_php
> Windows users, use a semicolon as path separator `COMPOSE_FILE=./docker-compose.yml;./docker-compose.dev.yml`
### Application environment
## Application environment
> `app.env-dist` should be adjusted and committed to reflect basic application settings, but we strongly recommend **not to add secrets** like passwords or tokens to the repository.
> Note: The `app.env-dist` file is intentionally copied as `app.env` onto the image. If you want to make changes during runtime, you also need to create a local file and mount this into the container.
Initial configuration adjustments should be made for the following values
Initial configuration adjustments should be made for the following values:
APP_NAME=myapp
APP_TITLE="MyApp"
APP_LANGUAGES=en,fr,zh
> :build: Within a `phd5-app` we recommend to update `app.env-dist` settings, while in a `phd5-template` we usually update the `Dockerfile`.
> `app.env-dist` should be adjusted and committed to reflect basic application settings, but we strongly recommend **not to add secrets** like passwords or tokens to the repository.
> Note: The `app.env-dist` file is intentionally copied as `app.env` onto the image. If you want to make changes during runtime, you also need to create a local file and mount this into the container.
> To be able to use translatemanager every defined/used language must be present in the app_language table.
For more frequently asked questions (FAQ) see [GitHub](https://github.com/dmstr/docker-phd5-app/issues) and [Stackoverflow](http://stackoverflow.com/questions/tagged/phundament)
...
...
@@ -39,11 +39,9 @@ You need to use https://getcomposer.org/doc/articles/aliases.md, see also https:
"asset-pattern-skip-version": "(-build|-patch)"
Docker
------
#### Port is already allocated
ERROR: Cannot start container 88b754d7e46aca58961ef0a049216f0e7331e35ba905d84fab01016a4797a779: failed to create endpoint appdev_mariadb_1 on network bridge: Bind for 0.0.0.0:43306 failed: port is already allocated
...
...
@@ -66,7 +64,6 @@ See https://github.com/chadoe/docker-cleanup-volumes
docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker --rm martin/docker-cleanup-volumes
#### Service 'php' failed to build
Pulling repository docker.io/phundament/php-one
...
...
@@ -108,6 +105,24 @@ Login docker CLI
> Note! Check if Docker saves the credentials locally in `~/.docker`
#### Slow running tests
- check DNS settings
- check shared memory settings for *Selenium* container (`/dev/shm`)
- removed unnecessary host-volumes
#### `chown` commands in Dockefile
For every file, which is "chownd" a copy is created...
> The filesystem has to copy up the the file into the new layer so that it can be chowned.
To run **phd** you need Docker, on your host-system. While older versions should also work, here are the minimum versions which are actively tested and supported.
-[`docker >=1.10.0`](https://docs.docker.com)
-[`docker-compose >=1.8.0`](https://github.com/docker/compose)*included in Docker for Mac and Windows*,
on Linux the fastest way to get it is probably `sudo pip install docker-compose`.
### Customizing startup and webserver configuration
You can build your custom container image on top of the [phd Docker container](https://registry.hub.docker.com/u/phundament/app/)([repository](https://github.com/phundament/docker)).
Just use the `FROM` instruction in your `Dockerfile`
You can add your custom configuration to he container image on top of `dmstr/php-yii2` or `phd5-app`
Grab the file from a running container by copying it into the `image-files` directory.
FROM phundament/app
Start or use a running container to copy the startup files into your `build/` directory.