Demo App

By Malcolm van Staden on 8th August 2021

When working through labs and stuff it’s often cumbersome to setup a demo app or website for each of your deployments. Today I’m making my little “Demo App” available for general availability. “Demo App” is a simple PHP app to set some visual attributes (background colour etc..) and to perform some basic connectivity tests.

The main use case for “Demo App” is allow you to bootstrap a simple PHP app onto your lab machines and configure the appearance, so for example in a blue/green test you could configure one app to be blue and the other green by setting the appropriate background. Then when going through your labs you’ll know exactly which server you’ve landed on.

With “Demo App” you can also test a port from the server without having to SSH into the server and doing a ping or curl etc… for connectivity tests. Additionally, you can perform a DNS lookup from the app without having to log into the server, useful for testing geo DNS responses.

“Demo App” was designed for use on AWS, here are the features in V1:

Let me know how you’ve used “Demo App” and what feature’s you’d like to see.

Installation Steps

Copy this code into the User Data of your Amazon Linux 2 instance when you launch it:

#--- Install Apache
sudo yum install -y httpd httpd-tools

#--- Install PHP
sudo yum install amazon-linux-extras -y
sudo amazon-linux-extras enable php7.4
sudo yum clean metadata 
sudo yum install -y php php-common php-pear 
sudo yum install -y php-{cgi,curl,mbstring,gd,mysqlnd,gettext,json,xml,fpm,intl,zip}

#--- Set Apache Permissions
sudo usermod -a -G apache ec2-user
sudo chown -R ec2-user:apache /var/www
sudo chmod 2775 /var/www
find /var/www -type d -exec sudo chmod 2775 {} \;
find /var/www -type f -exec sudo chmod 0664 {} \;

#--- Change the default page to default.php
sed -i 's/DirectoryIndex index.html/DirectoryIndex default.php/' /etc/httpd/conf/httpd.conf

#--- Install Demo App
rm -rf /var/www/html/*
wget -O /var/www/html/default.php

#--- Enable and start httpd service
sudo systemctl enable httpd
sudo systemctl start httpd 

Home   |   About   |   My Apps   |   © Malcolm van Staden , all views are my own