##like rspec http://www.phpspec.net/en/latest/manual/getting-started.html
##mock interfaces https://github.com/atoum/atoum
##describe it, monkey patching https://github.com/crysalead/kahlan
##like rspec http://www.phpspec.net/en/latest/manual/getting-started.html
##mock interfaces https://github.com/atoum/atoum
##describe it, monkey patching https://github.com/crysalead/kahlan
We create a separate port listener in web server config, forwart all HTTP connections from load balancer to this port, and configure web server to redirect all connections on this port to https
#add port 1443 listener to EC2 security group
Custom TCP Rule TCP 1443 <load balancer group id>
#add load balancer rules:
HTTP 80 HTTP 1443 N/A N/A
/** | |
* Functor takes a value and a function, splits the value, feeds the value to the function and returns the result | |
* Examples: .map(), .filter() | |
*/ | |
function F(value, fn){ | |
return fn(value); | |
} | |
F(1, plus1); //2 |
#Auto Scaling ##1. Have a config (ex. .env) file in a private S3 ##2. Create a reference instance ##3. Install AWS cli app to the server ##4. Create a shell script to download config file ##5. Create an image with all stack software installed, with shell script in place Write bash scripts in the AMI creating interface to automatically bootstrap the instance on create
#Code Deploy configuration ##Create an App
Style Guide for Python Code - https://www.python.org/dev/peps/pep-0008/
Python style guide checkers - pep8
, flake8
Access an item in a dict that is not available. The dict returns a new object using the function you passed as argument to the constructor
#long:
somedict = {}
if somekey not in somedict:
somedict[somekey] = []
#! /usr/bin/env python | |
import redis | |
import random | |
import pylibmc | |
import sys | |
r = redis.Redis(host = 'localhost', port = 6389) | |
mc = pylibmc.Client(['localhost:11222']) |
#It's better to terminate SSL session on ELB level and make ELB - WS communication a plain HTTP
#set up http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/SSL-on-an-instance.html
sudo yum install -y mod24_ssl
By default it sets up self-signed certificate.
#EC2 LB
#SSH Inbound
SSH TCP 22 0.0.0.0/0
Outbound
All traffic All All 0.0.0.0/0