Slide 1

Slide 1 text

ThinkUp Hands-On Brennan Neoh @bren http://brennan.sg

Slide 2

Slide 2 text

AGENDA • Easy: – Set-up a ThinkUp instance from a ready-baked public AMI (Amazon Machine Image). • Hard: – Set-up an EC2 micro instance from scratch. – Leverage on CloudWatch to do custom metrics + alarms. – Rock it like it’s 1999!

Slide 3

Slide 3 text

FRESHLY-BAKED! (or, let me do it for you)

Slide 4

Slide 4 text

START FROM SCRATCH!!! (or, the long-winded method) WARNING Terminal Interaction Ahead https://gist.github.com/2157420

Slide 5

Slide 5 text

STEPS 1. Login to AWS Management Console. 2. Start a Debian (x86) micro instance. 3. Access your instance via SSH.

Slide 6

Slide 6 text

STEPS (dotdeb) 3. Edit sources: nano /etc/apt/sources.list 4. Copy: deb http://packages.dotdeb.org squeeze all deb-src http://packages.dotdeb.org squeeze all 5. Exit, then: wget http://www.dotdeb.org/dotdeb.gpg cat dotdeb.gpg | sudo apt-key add -

Slide 7

Slide 7 text

STEPS (getting them packages, sources) 7. Update apt sources: apt-get update 8. Install packages: apt-get install nginx mysql-server php5-fpm php5-mysql php5-gd php5-curl git 9. Get ThinkUp straight from the source: git clone https://github.com/ginatrapani/ThinkUp.git /usr/share/thinkup

Slide 8

Slide 8 text

STEPS (database setup) 10. Login to MySQL: mysql –u root –p 11. Create the Database: CREATE DATABASE thinkup; 12. Grant connection privilege: GRANT USAGE ON *.* TO thinkup@localhost IDENTIFIED BY ‘thinkuppassword’; 13. Grant database privilege: GRANT ALL PRIVILEGES ON thinkup.* to thinkup@localhost ; 14. Give it a spin: mysql –u thinkup –p‘thinkuppassword’ thinkup

Slide 9

Slide 9 text

STEPS (nginx) 15. Create a new site config: touch /etc/nginx/sites-enabled/thinkup nano /etc/nginx/sites-enabled/thinkup 16. Add some configurations: server { listen 80; root /usr/share/thinkup; index index.php; server_name your-hostname; location ~ ^/(.+\.php)$ { try_files $uri =404; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include /etc/nginx/fastcgi_params; } location ~ /\.ht { deny all; } }

Slide 10

Slide 10 text

STEPS (fin) 17. Test the config! nginx –s test 18. Start the servers! service nginx start service php5-fpm start 19. Configure thinkup! http://your-host/install 20. Heart yourself.

Slide 11

Slide 11 text

EXTRAS • TRON CRON! • Gimme’ some alarms! • Setup a memory utilization custom metric! • LET’S PHP-APC THIS S**T YO! • IAM your AWS account!

Slide 12

Slide 12 text

Q&A