Git Product home page Git Product logo

symfony2-ansible-deploy's Introduction

Deploying Symfony2 with Ansible

Installation

Choose a directory to clone the project. The directory doesn't need to be inside Symfony structure.

    cd /path/to/somewhere/deploys
    git clone [email protected]:dcastello/symfony2-ansible-deploy

Configuration

Main files

  • production: Production servers inventory
  • staging: Development servers inventory
  • group_vars/devservers: List of variable to fill for development environment (Symfony2 and database vars)
  • group_vars/prodservers: List of variable to fill for production environment (Symfony2 and database vars)

group_vars variable list

    symfony2_project_root: '/var/www/dev.example.com'
    symfony2_project_name: 'My Project'
    symfony2_project_repo: 'url to your GIT repo'
    symfony2_project_branch: master
    symfony2_project_php_path: /usr/local/bin/php
    symfony2_project_env: dev
    symfony2_project_console_opts: ''
    symfony2_project_composer_opts: ''
    database_driver: 'pdo_mysql'
    database_port: null
    database_host: 'localhost'
    database_name: 'name'
    database_user: 'user'
    database_password: 'passwd'
    ansible_ssh_user: user

Production/Staging inventory example

    # staging
    [devservers]
    dev.example.com
    # production
    [prodservers]
    example.com

Task list by role

Setup tasks

  • Generate release directory name
  • Create release dir
  • Create shared dir
  • Create shared/web/uploads dir
  • Create shared/app/logs dir
  • Create shared/app/config dir
  • Generate parameters.yml from template to shared/app/config
  • Install composer

Deploy tasks

  • Generate release directory name
  • Pull sources from the repository
  • Set permissions to cache directory
  • Create app/logs symlink
  • Create web/uploads symlink
  • Create app/config/parameters.yml symlink
  • Run composer install
  • Dump assets
  • Migrating database
  • Create symlink to new release

Examples

The project has two main roles: setup and deploy. Setup is used to create the main structure and deploy to next deployments.

    $ ansible-playbook -i <host inventory> <playbook>

To create main structure for development environment:

    $ ansible-playbook -i /path/to/devserver /path/to/deploy_setup.yml

Second deploy and next deploys:

    $ ansible-playbook -i /path/to/devserver /path/to/deploy.yml

TODO

  • Rollback functionality
  • Limit number of releases available

symfony2-ansible-deploy's People

Contributors

dcastello avatar

Stargazers

 avatar  avatar  avatar  avatar  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.