merge phraseanet-docker repo to this one

This commit is contained in:
Arthur de Moulins
2020-02-21 12:03:35 +01:00
parent f80506f55e
commit 924b7d1b8e
17 changed files with 9455 additions and 126 deletions

View File

@@ -52,27 +52,82 @@ Ex:
For development with Phraseanet API see https://docs.phraseanet.com/4.0/en/Devel/index.html
# Docker build
# With Docker
WARNING : still in a work-in-progress status and can be used only for test purposes.
## Prerequisites
The docker distribution come with 3 differents containers :
* An nginx that act as the front http server.
* The php-fpm who serves the php files through nginx.
* The worker who execute Phraseanet scheduler.
- docker-compose
- docker >=v18.01-ce
## How to build
## Get started
You can build all the images with the following command at the root directory, choosing an arbirary TAG name :
You should review the default env variables defined in `.env` file.
Use `export` to override these values.
./build.sh <TAG>
i.e:
```bash
export PHRASEANET_DOCKER_TAG=latest
export PHRASEANET_VOLUMES_DIR=/path/to/my/custom/dir
export INSTALL_ACCOUNT_EMAIL=foo@bar.com
export INSTALL_ACCOUNT_PASSWORD=$3cr3t!
export PHRASEANET_APP_PORT=8082
```
It will build and tag the following images :
### Running the application
local/phraseanet-worker:<TAG>
local/phraseanet-fpm:<TAG>
local/phraseanet-nginx:<TAG>
If you are not interested in the development of Phraseanet, you can ignore everything in `.env` after the `DEV Purpose` part.
# Deploy the application
docker-compose -f docker-compose.yml up -d
Once the images are built, you can deploy the entire phraseanet stack using the repository : https://github.com/alchemy-fr/phraseanet-docker and follow the instruction inside its `README.md` file.
Why this option `-f docker-compose.yml`?
The development and integration concerns are separated using a `docker-compose.override.yml`. By default, `docker-compose` will include this files if it exists.
If you don't work on phraseanet development, avoiding this `-f docker-compose.yml` parameters will throw errors. So you have to add this options on every `docker-compose` commands to avoid this inclusion.
> You can also delete the `docker-compose.override.yml` to get free from this behavior.
The default parameters allow you to reach the app with : `http://localhost:8082`
## Development mode
The development mode uses the `docker-compose-override.yml` file.
You can run it with:
docker-compose up -d
The environment is not ready yet: you have to fetch all dependencies.
This can be made easily from the builder container:
docker-compose exec -u app builder make
> Please note that the phraseanet image does not contain nor `composer` neither `node` tools. This allow the final image to be slim.
> If you need to use dev tools, ensure you are running the `builder` image!
### Using Xdebug
Xdebug is enabled by default with the `docker-compose.override.yml`
You can disable it by setting:
```bash
export XDEBUG_ENABLED=0
```
Remote host is fixed because of the subnet network from compose.
You need to configure file mapping in your IDE.
For PhpStorm, you can follow this example:
![PhpStorm mapping](https://i.ibb.co/GMb43Cv/image.png)
> Configure the `Absolute path on the server` to `/var/alchemy/Phraseanet` at the project root path (i.e. `~/projects/Phraseanet`).
### How to change volumes location
Before moving all the files, or to use a different location, you have to remove all containers and volume definitions with the following command :
docker-compose down --volumes
Then move the files and set the `VOLUMES_DIR` to the new location.