Skip to content

superDuperCyberTechno/comploy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

95 Commits
 
 
 
 
 
 
 
 

Repository files navigation

 ██████╗ ██████╗ ███╗   ███╗██████╗ ██╗      ██████╗ ██╗   ██╗
██╔════╝██╔═══██╗████╗ ████║██╔══██╗██║     ██╔═══██╗╚██╗ ██╔╝
██║     ██║   ██║██╔████╔██║██████╔╝██║     ██║   ██║ ╚████╔╝
██║     ██║   ██║██║╚██╔╝██║██╔═══╝ ██║     ██║   ██║  ╚██╔╝
╚██████╗╚██████╔╝██║ ╚═╝ ██║██║     ███████╗╚██████╔╝   ██║
 ╚═════╝ ╚═════╝ ╚═╝     ╚═╝╚═╝     ╚══════╝ ╚═════╝    ╚═╝
comploy: commit and deploy

comploy is a Linux-only, simple, web development deployment script written in Bash, made to co-operate with Git. The premise is super simple; when set up and executed, comploy will deploy your source code (up to last commit) to your designated server(s).

It's kinda like an ultra lean Deployer...

It plays nice with Composer and Laravel. It's mostly geared towards PHP projects.

Installation

comploy works on a per-project basis so you need a copy for each of your projects you need to deploy. To install it in your project, simply run the following command in the root of your git project:

wget https://raw.githubusercontent.com/superDuperCyberTechno/comploy/master/comploy && chmod +x comploy

Open the file and edit the hosts variable found in the config section. - Here you will also be able to assign ignored folders/files that will not be synchronized with the server. Ignored folders/files must be seperated by a space.

Optionally you can define the absolute local path to an SSH key (the key variable) if your machine's key (~/.ssh/id_rsa) isn't a verified key on the server side. - If this option is left empty, comploy will use the default machine key (~/.ssh/id_rsa).

Before you can use comploy effectively, you need to execute it on a repository with no pending commits (IE: no staged files). You will be warned and denied execution if this requirement is not met. This is necessary since comploy will not deploy any uncommitted, changed files. This forces us to provide the server with a complete codebase from the beginning.

Uninstallation

comploy is just one file. Just delete comploy from your project and it's gone.

Usage

Simply running comploy will sync your project with the server, up to - but not including - files that have been added or changed since last commit. If you have a clean project (all files committed), it will sync everything.

You can also bypass the Git integration by setting use_git to false. In that case, everything (except ignored of course) is synced, every time. If use_git is true, comploy will also try to push the codebase to your remote repository.

You can pass a string argument (representing the commit message) to comploy if you want to commit, push and deploy at the same time. That - of course - is dependent on files actually being staged prior to execution. comploy will then commit (if string argument has been passed) and deploy all unchanged (committed) files to the server:

./comploy 'your commit message here'

Or, if you have already committed manually:

./comploy

An even simpler solution is to add the following function to your .bashrc:

cmp() {
    ./comploy "$1"
}

... enabling you to simply write cmp instead of ./comploy.

Requirements

  • Client side, rsync is required, Git and Composer is optional.

Notes

  • comploy sets user/group as www-data:www-data, 755 rights for folders and 644 for files on the entire project on synchronization.
  • comploy needs the client machine SSH key to have root access to the deployment server.
  • If you use Composer you should now that comploy auto installs your packages, server-side (it does so through the www-data user). This can be disabled by setting use_composer to false in the config.
  • You need to know how to set up a webserver in order to use comploy effectively.

About

./comploy 'commit and deploy'

Resources

License

Stars

Watchers

Forks

Languages