From c6012c5122ca772ce602331632b1d40a9d3b5900 Mon Sep 17 00:00:00 2001 From: Mathieu Jaumotte Date: Thu, 25 Feb 2021 18:46:45 +0100 Subject: [PATCH] updating readme --- README.md | 94 ++++++++++++++++++++++++++----------------------------- 1 file changed, 44 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index c729c19..5079c7d 100644 --- a/README.md +++ b/README.md @@ -1,56 +1,19 @@ -Docker environment for a Symfony5 project +Environnement de développement Docker pour démarrer un nouveau projet Symfony5 ================================== -# Présentation (français) +# Présentation -Ce repository propose une configuration qui permet de démarrer très simplement un nouveau projet Symfony dans des conteneurs docker. Cette configuration doit encore être améliorée, mais déjà, en suivant pas à pas les instructions à partir du chapitre "My installation", on peut démarrer en quelques minutes un nouveau projet. +L'objectif de ce dépôt est de proposer et de faire évoluer une configuration de départ pour démarrer très simplement un nouveau projet Symfony dans des conteneurs Docker. + +En suivant pas-à-pas les instructions à partir du chapitre "Installation", on peut démarrer en quelques minutes un nouveau projet. + +Le dépôt utilise plusieurs branches qui peuvent être utilisée selon le point de départ recherché: +1. la branche `docker_config` fournit juste le docker-compose.yml et les Dockerfile qui permettent de construire les conteneurs ; +2. la branche `master` fournit la structure de départ du projet Symfony ; +3. la branche `with_vujs` permet de démarrer le projet en complémentarité du framework Javascript VueJS ; -# Add to your project - -Move the `docker-compose.yml` and the folder named `docker_build` containing nginx and php-fpm config for it to the root of your Symfony project. - -Ensure the webserver config on `docker\nginx.conf` is correct for your project. For instance, for Symfony 4 or 5 it should look for the `public/index.php`, instead of the `web/app.php` from Symfony2 and Symfony3 - -Note: you may place the files elsewhere in your project. Make sure you modify the locations for the php-fpm dockerfile, the php.ini overrides and nginx config on `docker-compose.yml` if you do so. - -# How to run - -Dependencies: - - * Docker engine v1.13 or higher. Your OS provided package might be a little old, if you encounter problems, do upgrade. See [https://docs.docker.com/engine/installation](https://docs.docker.com/engine/installation) - * Docker compose v1.12 or higher. See [docs.docker.com/compose/install](https://docs.docker.com/compose/install/) - -Once you're done, simply `cd` to your project and run `docker-compose up -d`. This will initialise and start all the containers, then leave them running in the background. - -# Docker compose cheatsheet - -**Note:** you need to cd first to where your docker-compose.yml file lives. - - * Start containers in the background: `docker-compose up -d` - * Start containers on the foreground: `docker-compose up`. You will see a stream of logs for every container running. - * Stop containers: `docker-compose stop` - * Kill containers: `docker-compose kill` - * View container logs: `docker-compose logs` - * Execute command inside of container: `docker-compose exec SERVICE_NAME COMMAND` where `COMMAND` is whatever you want to run. Examples: - * Shell into the PHP container, `docker-compose exec --user 1000 php bash` - * Run symfony console, `docker-compose exec --user 1000 php bin/console` - * Open a postgresql shell, `docker-compose exec --user postgres db psql` - * or if user is not postgres: `docker-compose exec db psql --user admin postgres` - -# Docker general cheatsheet - -**Note:** these are global commands and you can run them from anywhere. - - * To clear containers: `docker rm -f $(docker ps -a -q)` - * To clear images: `docker rmi -f $(docker images -a -q)` - * To clear volumes: `docker volume rm $(docker volume ls -q)` - * To clear networks: `docker network rm $(docker network ls | tail -n+2 | awk '{if($2 !~ /bridge|none|host/){ print $1 }}')` - -Disclaimer: This project has been generated on phpdocker.io - - -# My installation +# Installation * Build containers: `docker-compose build` * Run containers: `docker-compose up -d` @@ -80,9 +43,9 @@ Disclaimer: This project has been generated on phpdocker.io * Test psql connection: `psql --host db --user postgres --password postgres` * Create database schema: `bin/console doctrine:schema:create` -## Let's go ! +## C'est parti ! -* Let's create first object: +* Créons un premier objet: * Create entity: `bin/console make:entity Beer` * Create CRUD on entity: `bin/console make:crud Beer` * See sql: `bin/console doctrine:schema:update --dump-sql` @@ -91,3 +54,34 @@ Disclaimer: This project has been generated on phpdocker.io * See migration file: `cat migrations/Version20210218160541.php ` * Migrate: `bin/console doctrine:migrations:migrate` * Control migrations: `bin/console doctrine:migrations:status` + * ... + + +--- + +# Docker compose cheatsheet + +**Note:** you need to cd first to where your docker-compose.yml file lives. + + * Start containers in the background: `docker-compose up -d` + * Start containers on the foreground: `docker-compose up`. You will see a stream of logs for every container running. + * Stop containers: `docker-compose stop` + * Kill containers: `docker-compose kill` + * View container logs: `docker-compose logs` + * Execute command inside of container: `docker-compose exec SERVICE_NAME COMMAND` where `COMMAND` is whatever you want to run. Examples: + * Shell into the PHP container, `docker-compose exec --user 1000 php bash` + * Run symfony console, `docker-compose exec --user 1000 php bin/console` + * Open a postgresql shell, `docker-compose exec --user postgres db psql` + * or if user is not postgres: `docker-compose exec db psql --user admin postgres` + +# Docker general cheatsheet + +**Note:** these are global commands and you can run them from anywhere. + + * To clear containers: `docker rm -f $(docker ps -a -q)` + * To clear images: `docker rmi -f $(docker images -a -q)` + * To clear volumes: `docker volume rm $(docker volume ls -q)` + * To clear networks: `docker network rm $(docker network ls | tail -n+2 | awk '{if($2 !~ /bridge|none|host/){ print $1 }}')` + +Disclaimer: This project has been generated on phpdocker.io +