Skip to content

A bash script for deploying php APP from git repo

License

Notifications You must be signed in to change notification settings

atlza/noDeploy-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

noDeploy PHP

You don't need a deploying app.
Deploy your PHP app with a simple bash script. Please see specific version for laravel here: https://github.com/atlza/noDeploy/

Getting Started

This script was tested to deploy a php App in a LAMP environment from a git repository and a tag version. It assumes that you have git, npm and composer installed and working.

Prerequisites

You will need :

  • git to retrieve your code from a repo
  • npm to install dependencies and run webpack
  • composer for php dependencies

What it does

  • switch current user to deploy user
  • ask for tag to deploy
  • clone tag into destination directory
  • install composer dependencies
  • install npm dependencies
  • move symlink from previous release to new one (no downtime)

Installing

Clone this repo in your ssh user home directory
Give current user permission to execute both deploy.sh and realDeploy.sh We also give others users right to execute realDeploy.sh so user deploy can execute the file.

git clone https://github.com/atlza/noDeploy-php.git

How to use it

This script use a deploy user, which also is member of your www-data group This user must have the rights to access your git repository, you can use a deploy key for this. In our case, this user is called deploy. You can change it in the deploy.sh script.

Copy the variables files

cp variables.example variables.prod

Fill the variables files with correct value. Mainly :

#where you app should be deployed
deployPath="/path/to/deploy"

#your git repository
gitPath="git@github.com:user/repo.git"

In your deploy path the directory structure must look like :

/path/
  |-to/
    |-deploy/
      |-environment
        |-releases
        |-shared

Edit the user used to deploy in deploy scrip (must have write access to deploy path and be in apache groupe)

vim deploy.sh

in the file edit the line

ME="deploy"

Run the deploy script

./deploy.sh prod

or for staging

./deploy.sh recette

Next steps

  • Add feature to remove old releases from system.
  • Fully manage staging environments and parameters

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

About

A bash script for deploying php APP from git repo

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages