Giter VIP home page Giter VIP logo

easypeasysymfonydockerprod's Introduction

EasyPeasySymfonyDockerProd (with a mail server / traefik / https. Optionally)

How to install the production

  1. If the docker images were not built

In the host system (your server):

  • Install docker

  • Clone your project (if it's on git, and not already done), then go in it

  • git clone https://github.com/ruano-a/EasyPeasySymfonyDockerProd.git docker

  • cd docker

  • cp .env.dist .env

  • Replace the values in this .env file (docker/.env)

  • If needed, at the root of the project, set the values in the .env (or .env.local depending on your symfony version). The values of MAILER_URL, MAILER_DSN, DATABASE_URL are automatically replaced during the build. But the lines have to exist, just say an empty value or something random.

  • Put in the folder database/init.sql some sql files to init the database

  • Use ./setup.sh (docker folder). It modifies the docker-compose.yml file depending on what you specified in the docker/.env file.

  • In the docker folder : docker-compose build

  1. Once they were built, but not started yet
  • If you didn't built the images in the host server, you have to transfer them to the host.

  • Make sure you're in the docker folder.

  • Start the containers : docker-compose up

  • If you have things to do in the container, (like symfony commands) Go in it : docker exec -it docker_php-apache_1 bash (if the name docker_php-apache_1 isn't working, check docker ps) and do what you have to. If you didn't init your database with an sql file, you'll need to run doctrine commands.

Notes :

  • The docker image contains the project, the php / js / everything files. So once the image is built, the outer project isn't needed.

  • This means that if the .env parameters (at the root) are changed, either the image should be rebuilt, or the values should be changed in the container running. Changing the values in the inner .env file should be enough, but if not, change it in the env values with 'export'. If it's reboot, the values will be reset though.

  • During the build, the composer install is done, and yarn install, and the yarn encore production. You don't need to do it.

  • After these installs / generations are done, composer / yarn / npm are removed from the image, for a smaller size.

  • The local-php-security-checker is downloaded in /usr/bin/local-php-security-checker. You (probably, it's in production, so your call) should use it in the composer scripts. It's removed after the install.

  • It's been decided that fail2ban should be installed in the host, and not the images, because it usually handles ssh

  • This repo will probably evolve over the time

  • This repo should work out of the box for mainstream cases. But you might have to make custom changes. And you should. Remember that you can modify any file. It's your website.

  • If you changed values in .env, and want to update the docker-compose.yml file without getting new https certificates, don't use setup.sh. Use (in the docker folder) ./update-yml.sh

easypeasysymfonydockerprod's People

Contributors

ruano-a avatar

Stargazers

Jean-Philippe Chateau avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.