Table of contents
- Introduction
- Files
- Install Drupal
- Puppet manifest to install Drupal
- AWS CLI to create Drupal cluster
Install Drupal with Puppet on AWS EC2 Ubuntu instance. Tested with AMI: ami-87564feb
Shell script to install Ruby, Gems, Thor and Puppet. After installing Puppet, the script will load the drupal-install.pp manifest from this repo, and it will apply the manifest to your EC2 instance. Once the installation is finished, you can access drupal in your browser on: your_host:your_port/drupal
Puppet manifest that installs:
- apache
- php
- drupal (latest recommended drupal, with drush)
Ruby CLI to handle AWS EC2 instances. Set the following environment vars:
export AWS_CLI_ID=your_AWS_client_ID
export AWS_CLI_SECRET=your_AWS_client_secret
export AWS_REGION=your_region
Usage
$ ruby awscli.rb [command] [--options]
drupal_status [HOST]
Check drupal status. HOST can be public IP or DNS
info
Get info about instances
start
Start an instance
Options:
[--instance-id=INSTANCE_ID] # Specifiy which instance to start.
stop
Stop an instance
Options:
[--instance-id=INSTANCE_ID] # Specifiy which instance to stop.
reboot
Reboot an instance
Options:
[--instance-id=INSTANCE_ID] # Specifiy which instance to reboot.
delete_stack [STACK_NAME]
Deletes the specfied stack
setup_drupal_ha_cluster
Sets up a Drupal cluster with CloudFormation
Options:
[--stack-name=STACK_NAME] # Name of the stack. Default: myStack
[--key-name=KEY_NAME] # Name of the key-pair, which can be used to connect via SSH.
[--drupal-admin-password=DRUPAL_ADMIN_PASSWORD] # Drupal admin password
[--drupal-site-name=DRUPAL_SITE_NAME] # Drupal site name. Default: My Drupal Site
[--db-name=DB_NAME] # DB name. Default: myDatabase
[--db-user=DB_USER] # DB admin user name
[--db-password=DB_PASSWORD] # DB admin password
[--db-allocated-storage=DB_ALLOCATED_STORAGE] # Db size (Gb). Default: 5
[--db-instance-class=DB_INSTANCE_CLASS] # DB instance class. Default: db.t2.micro
[--web-server-capacity=WEB_SERVER_CAPACITY] # Webserver capacity, between 1-5. Default: 2
[--instance-type=INSTANCE_TYPE] # EC2 instance type. Default: t2.micro
[--ssh-location=SSH_LOCATION] # Allowed IP's for SSH, in valid IP CIDR range (x.x.x.x/x). Default: 0.0.0.0/0
The CLI will use the drupal_cluster.tpl to create the cluster stack. Parts:
- LoadBalancer
- AutoScalingGroup
- LaunchConfiguration with the previously created AMI
- SecurityGroup for HTTP 80 and SSH 20 access
- RDS MySql database
The drupal_recipe.tpl will create
- an EC2 instance from image ami-87564feb
The template will run the install-drupal.sh script to install the Apache, PHP and Drupal. Installation is done by Puppet. The used manifest is drupal-install.pp
After the installation is done, your instance will have a running Apache with PHP, and Drupal installed on it.
After the base instance is up and running, with Drupal installed, the CLI creates a new AMI from this istance. When the AMI is available, the base instance stack is deleted.
The CLI updates the cluster stack with the newly created AMI.
When the process is done, you can access the newly created Drupal cluster via the load balancer.