Skip to content

This is to demonstrate you how to setup the media wiki application using terraform

Notifications You must be signed in to change notification settings

dewshekhar/terraformed_mediawiki

Repository files navigation

Media Wiki Installation

Install mediawiki using terraform

Prerequisites:

- AWS Access and Secret keys with required privileges
- Terraform plugin installed into the local machine
- AWS CLI installed in local system
- An backend s3 bucket be created in the AWS account for keeping .tfstate file

Implementation

  1. export aws credentials
# Linux

export AWS_ACCESS_KEY_ID=XXXXXXXXX
export AWS_SECRET_ACCESS_KEY=XXXXXXXXXXXXX
  1. Generate a SSH key-pair(This is required at the time of ssh)
ssh-keygen -m PEM -t rsa -b 2048 -f mediawiki
  1. Keep the private key with you and place the .pub key in the code. Lets keep it at /files/key_pairs/mediawiki.pub
  2. Clone the [repo] (https://github.com/dewshekhar/terraformed_mediawiki.git) and then Run Terraform init for initialization

  1. Run terraform plan it will show you the resources to be created, changed or deleted

  1. Run terraform apply to create the resources if everything looks good and pass an argument as yes to confirm.

  1. Wait till your resources be created.

  2. Once resources gets created use the endpoint to access the mediawiki home page for installation

  1. Select the language

  1. Fill DB related details

  1. Download LocalSettings.php file

  1. SSH to the EC2 machine using the pem key which you have kept with you in step no 2.(I am using session manager as I had already attached the ssm related policies to the IAM role of Instance profile of EC2 )

  1. Copy the file to location /var/www/html/mediawiki.

  1. Ones copied click onto enter your wiki link available onto page where php file is downloaded you will be redirected to your wiki

  1. As this was only for demo purpose so after the activity destroy the infra.

Attributes:

1. Created aws core infra module for basic platfor setup
2. I have created all the resources in us-west-1 region
3. Instead of hardcopying the ami id I have used data element.
4. Kept my EC2 in private subnet and added load balancer in public subnet.(EC2 will only allow load balancer to communicate to its port 80)
5. Used the SSM to connect to EC2. for this purpose added the respective policies to EC2 instance profile's IAM role.

Issue:

1. We were getting issue with AMI which I used for initial setup as presently It is not available so used the data element instead of hardcoding.

About

This is to demonstrate you how to setup the media wiki application using terraform

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published