██████╗ ██████╗ ███╗ ███╗██████╗ ██╗ ██████╗ ██╗ ██╗
██╔════╝██╔═══██╗████╗ ████║██╔══██╗██║ ██╔═══██╗╚██╗ ██╔╝
██║ ██║ ██║██╔████╔██║██████╔╝██║ ██║ ██║ ╚████╔╝
██║ ██║ ██║██║╚██╔╝██║██╔═══╝ ██║ ██║ ██║ ╚██╔╝
╚██████╗╚██████╔╝██║ ╚═╝ ██║██║ ███████╗╚██████╔╝ ██║
╚═════╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚══════╝ ╚═════╝ ╚═╝
./comploy 'commit/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.
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.
comploy will use the default machine key (~/.ssh/id_rsa) to deploy. Optionally you can define the absolute local path to another SSH key (the key
variable) for this purpose.
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.
comploy is just one file. Just delete comploy from your project and it's gone.
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
.
- Client side, rsync is required, Git and Composer is optional.
- comploy sets user/group as
www-data:www-data
,755
rights for folders and644
for files on the entire project folder on the server, when deploying. - comploy needs the client machine SSH key to have root access to the deployment server (to streamline the permission setup).
- comploy will install the production version of the application (when using composer), locally. Then it syncs the project files and finally, re-installs the development version locally. This ensures local/server parity.
- You need to know how to set up a webserver in order to use comploy effectively.