I used to work in many random small startup companies. The truth is, some of the companies don't have the basic development environment that set up with
live. The scariest thing ever was they did everything in one single environment. And many of them are pretty anti-pattern and very confident about what they are doing.
So, I wrote a
bash script that manipulates on top of the
Git to create such low-cost solution and this is my Github repository page.
This script discards the complicated set up like the professional CI/CD for who would find this useful. It helps with creating a very practical sort-of-CI/CD-thing. You can modify and adding your innovation onto the script to fit in your style.
- At first, you have a
gitaccount set up with
BitBucketand created a new
repositoryfor a new project.
- You are mostly doing software development on your local computer. The project files in this environment are called the
- You pulled the new project repository from
- You make some new changes to the project files and pushed to
- Let say you set up a new server somewhere at
Digital Ocean, for example.
- With installed
deployermay be located at dir
/dev, for example.
- Run the
$ ./deployer --deployto pulling the latest project repository from
/stagingdirectory, you can run testing on the actual server environment, instead of doing it locally on your computer.
- Once you have satisfied and there are no errors in the
- You can run
$ deployer --deploycommand to sync to
Let's get started and clone the repository at Github with a Terminal,
$ git clone https://github.com/loouislow81/deployer.git $ cd deployer
Run this command to get an overview of what this CLI is offered,
$ ./deployer --help
Before anything else, you will need to edit the
config.proto file to configure the identity of this script, which is only working for a specific payload (your project files),
# To identify specific payload is located # To store payload history in-between `local` and `staging` # PROJECT_NAME="defreeze" PROJECT_NAME="defreeze" # Set git repository URL (URL must end with `.git`) # TO_LOCAL_DIR="https://github.com/loouislow81/defreeze.git" TO_LOCAL_DIR="https://github.com/loouislow81/defreeze.git" # Staging directory (full path required) # e.g. `/to/your/staging/dir/` # TO_STAGING_DIR="staging" TO_STAGING_DIR="staging" # Public or live directory (full path required) # e.g. `/to/your/production/dir/` # ~ recommended to use symlink re-routing to this directory # TO_PRODUCTION_DIR="live" TO_PRODUCTION_DIR="live"
Then you are ready to start to load your payload into new a deployer environment,
$ ./deployer --deploy
What this command will do:
- Check if prerequisites (
Git) are installed.
- Create local
.gitjust for deployers use to track changes and history.
- Create a
- Check or load the latest payload into
- Create a
- Synchronize directory from
/livewith an exclusion, (see
- Output statistics.
Thank you for reading this article. Please
unicornwould encourage me to write more about this kind of article next time.