Deploy an autoscaling group with EC2 Instances on Amazon Linux Running Mediawiki on Nginx. Using RDS backend and EFS for content sharing (uploads).
No ELB/ALB configured, because we deploy behind an existing Sophos load balancer.
- VPC with Public (If Using ALB) and Private subnets
- Create RDS Instance
- Create Empty Mediawiki Database and User
- EFS Mount Storage Created
- Internet Access from EC2 Instance
Click this button to open AWS CloudFormation web console with the Template URL automatically entered.
Public S3 Link:
https://s3.amazonaws.com/bonusbits-public/cloudformation-templates/cookbooks/bonusbits-mediawiki-nginx.yml
The CloudFormation Template the following:
- Create Autoscale Group for Frontend Web Server in private network for HA not Scaling (Currently)
- Adds the EC2 Instance to the appropriate security groups
- Create own Security Group
- Create IAM Instance Profile Role
- Create Cloudwatch CPU Alarm for Autoscale Group
- UserData
Installs some basic packages needed for bootstrapping
- cfn-init
- aws-cfn-bootstrap
- cloud-init
- git
- Cloud Init (cfn-init)
- Configure CFN Hup and Auto Reloader Hook Conf
- Setup and Execute Chef Zero
- Install Chef Client from internet
- Create Chef Configuration Files
- Download bonusbits_mediawiki_nginx cookbook from Github
- Triggers Chef Zero run
- Run DNS Update Script (Optional)
- Warm EBS Volume
- Adjust Sudoers secure path to include /usr/local/bin
- Install Linux packages for Mediawiki, Nginx and PHP FPM
- Configure Nginx
- Configure PHP FPM
- Install specific version of Mediawiki and list of extensions
- Create LocalSettings.php
- Configure Extensions
- Mount and Configure fstab for EFS share
- Install and configure CloudWatch Logs Agent
- Setup EFS share backup to encrypted/versioned S3 bucket
- Create node info script
- Create Route53 DNS Upset script
- If needed the instance size can be increased.
- Optionally you could add an ELB and scale past one, but I designed it to be an affordable easy solution.
All of the example values are randomly generated and not real or used by Bonus Bits. Such as, data bag secret, HostedZoneId, etc. Other times it's more obvious that example values are fake such as vpc-0000000. We just added random values to a few specific parameters and attributes to give a better idea of what should be entered.
The point is, don't think we put any real secrets in the repo.
Also, this is a highly customized Mediawiki implementation for our needs and may be outside the scope of what you would like to implement. The main purpose is to share code ideas that you can use for your own project. Use are your own cost and risk. Don't rely on us to maintain the projects for your needs. Fork away and enjoy the help to success!
We'll maintain this project for our needs and we hope it helps others on similar implementations!