Git Product home page Git Product logo

ansible-update-laravel-role's Introduction

Ansible Laravel Update

This is a role that I use to update my Laravel 5 applications. It could be made to fit Laravel 4 with minimal effort, but at the moment, I don't have any that require/can use ansible.


Limitations

At the moment, this role suits my needs as they stand so:

  • MySQL
  • Gulp
  • Bower

This is not to say that it couldn't be adapted, so it should be easy enough to swap Gulp for Grunt and Mysq for Postgres if requested


Steps taken in role

This is all documented in the tasks/main.yml, but it never hurts to list them again.

Update Composer

Ensure that the latest version of composer is installed.

Bring site down

Put the site into maintenance mode to prevent any data changes while the update is occurring

Create back up MYSQL dump

Not matter how well I code something, I am still petrified of losing data. This step will copy the database to a local file on your computer at the playbook level.

Backup current folder to archive

Same as the database. If the deployment fails for any reason, the site should be able to reverted quickly and easily. This will eventually be made into a role as well.

Update from Git

Pull for the latest version.

Update folder permissions

Again, no matter how sure I am that I have set the permissions on the folders correctly, getting that white screen still happens sporadically, so this takes care of that.

Add the environment file

Dump everything needed into the .env file

Update Composer pacakges

This only installs not updates the packages, so you should commit your composer.lock file, especially on low spec servers ( i.e ones that have less that 1 gig of RAM)

Update Node modules

Install required NodeJs modules. This is run as the web_user.

Update Bower

Update the Bower packages. This is run as the web_user

Build static

Build the static files by running Gulp. This is run as the web_user

Optimize Laravel application

Creates a single file containing all the classes with the comments removed.

Clear caches

Reset any caches to avoid incorrect data.

Migrate database

Make any structural changes to the database.

Bring site back up

Brings the site out of maintenance mode.


Variables

Most of these are pretty self explanatory and examples of all variables can be found in defaults/main.yml. This contains sensitive data **So ensure you vault your var file.

####Database Variables

db_host

This is used in the task, but it can also be used in the .env file.

db_name

This is used in the task, but it can also be used in the .env file.

db_user

This is used in the task, but it can also be used in the .env file.

db_password

This is used in the task, but it can also be used in the .env file.

db_dump_file

The name you want the .sql dump to be saved as.

Website Variables

web_user

The user who requires permissions for all the files in the app. Usually something like www.

web_group

The user group who requires permissions for all the files in the app. Usually something like www.

site_current_folder

The absolute path of the Laravel application.

site_archive_folder

The absolute path of the where you want to backup your Laravel application.

site_repository

The git repository to pull from. Make sure that you have added your github token / whatever else you need to do.

env

Every thing that you need to put in your .env file.

ansible-update-laravel-role's People

Contributors

stones avatar

Watchers

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