How do I deploy my Symfony API - Part 5 - Conclusion

How do I deploy my Symfony API - Part 5 - Conclusion

Improvements

Migrations


  1. Run migration 1
    1. Add a "new" column (with the new name)
    2. Copy values from "old" to "new" column
    3. (now the database version is v2)
  2. Deploy application v2 (this app must be able to work with both "new" and "old" column)
    1. Wait till all the copies of application v1 are not in service anymore
  3. Run migration 2
    1. Copy values from "old" to "new" column where the "new" values are still NULL (or something similar).
      This is necessary because while the application v2 was going up, application v1 was still running and was using only the "old" column.
    2. (at the end of this migration the database version is still v2)
  4. Deploy application v3 (knows only the "new" column)
    1. Wait till all the copies of application v2 are not in service anymore
  5. Run migration 3
    1. Drop "old" column
    2. (now the database version is v3)
docker-compose run --rm -u www-data --no-deps php bin/console doctrine:migrations:migrate

Health checks

# docker-compose.live.yml
version: '3.3'
services:
    php:
        # php service definition...             
    www:
        # www service definition...             
        healthcheck:
          test: ["CMD", "curl", "-f", "http://localhost/check.php"]
          interval: 30s
          timeout: 10s
          retries: 2            

Container placement

version: '3'
services:
  www:
    # www service definition...             
    deploy:
      placement:
        constraints:
          - node.role == worker
          - engine.labels.operatingsystem != ubuntu 14.04

PHP and Nginx together

Node draining

Kubernetes

Conclusion


Comments

Popular posts from this blog

A Tailwind CSS Preset for Laravel 5.5

Short and safe array iteration

PHPStorm's performance