AWS Lambda hosted PHP7.1 website for bigprimes.net
PHP HCL C++
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
cloudformation
htdocs
src/Bigprimes
test
tools
.gitignore
.travis.yml
LICENSE
README.md
build.tf
composer.json
composer.lock
php.ini
phpunit.xml
schema.sql

README.md

bigprimes.net

PHP 7 codebase for bigprimes.net written using the Silex micro-framework.

Minimum PHP Version Codecov branch Build Status

Install

  1. Apache instructions: Copy htdocs/.htaccesssample to htdocs/.htaccess and provide it with the variables needed for mysql.
  2. Run schema.sql on your chosen mysql server and populate tables such as primeNumbers if required.
  3. php composer.phar install

AWS Lambda

To host bigprimes.net via AWS Lambda we need to; build a package, copy the bigprimes codebase into it, deploy it to lambda.

All of that has been wrapped up into running the following on an Amazon linux box to compile php.

  • touch /tmp/lambda.zip
  • terraform init
  • terraform apply -var 'rdsuser=user' -var 'rdspass=pass' -var 'rdshost=host' -var 'rdsdb=bigprimes' -var 'subnetA="subnet-aaaaaaaa"' -var 'subnetB="subnet-bbbbbbbb"' -var 'subnetC="subnet-cccccccc"' -var 'securityGroup=sg-gggggggg'

make sure you have your aws credentials in your home directory and you have terraform installed (or referenced in the bin directory, or the repo directory)

Related projects

Goals

  • Remove redundent code.
  • Organise code into logical folders.
  • Get code to the point where we can run unit tests.
  • 100% test coverage.

Fun Facts

  • there are 1.4*10297 primes smaller than 300 digits
  • there is always a prime between n^2 and (n+1)^2.