Bash script for quickly creating a new Drupal project
- Creates or clones a Drupal project, database and Apache vhost file
- Creates a Bitbucket repository and pushes an initial commit
- Sets correct file and folder permissions
- List all projects inside a folder
- Removes the project files, database and Apache vhost file
You install the script by placing it into a folder, that is also in your system $PATH, on your server and then calling it, preferably with a help of an alias.
Step by step instructions on how to install this script to your server. Of course you can put it anywhere you wish and use it however you like.
First connect to your server via ssh.
# Go to your home directory
cd ~
# Create a folder if it doesnt exist already
mkdir .bin
chmod a+ .bin
# Install the script inside this folder
cd .bin
wget https://raw.githubusercontent.com/AGILEDROP/create-project/master/create-project.sh
chmod u+x create-project.sh
And thats it. Now you can simply call the script like so
sudo bash ~/.bin/create-project.sh
We can also create an alias for this for easier access. To do so we need to add the following line to our .profile file which should already be inside our home directory.
alias create-project='sudo bash ~/.bin/create-project.sh'
After that save the file, exit the editor and make sure your current session recognizes the new alias.
source .profile
After installing it from the above instructions you can now use your new Drupal project creating. Use the -h or --help argument to show options.
create-project -h
The repository also contains drupal-permissions.sh which is a script to properly set the files and folders in a Drupal project. This gets automatically called with the create-project script but you can also install the script and call it manually just like with the original create-project script described above. After that you can call it as such.
drupal-permissions --drupal_path=[path] --drupal_user=[user] --httpd_group=[group]
List functionRemove functionChange owner:group of the filesInitialize a git repository on creating a new projectBitbucket integrations to create a new repository- Option to choose which Drupal major version to install
- Update README.md file for better installation and usage instructions
- Jenkins integration to create a build task