Saturday, February 14, 2015

Script for setting up Wordpress on an AWS machine

I found the documentation a bit of a headache to run through. This is a quick way to get a wordpress server up and running on Amazon Web Services.

DBPASSWORD="yourdbpassword"
DBSERVERPASSWORD="yourdbserverpassword"

sudo apt-get -y update
sudo apt-get -y upgrade

sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password yourdbserverpassword'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password yourdbserverpassword'
sudo apt-get -y install mysql-server

sudo apt-get -y install apache2 php5 php5-mysql mercurial

sudo service mysql start
mysql -u root -p
yourdbserverpassword
CREATE USER 'wordpress-user'@'localhost' IDENTIFIED BY 'yourdbpassword';
CREATE DATABASE `wordpress-db`;
GRANT ALL PRIVILEGES ON `wordpress-db`.* TO "wordpress-user"@"localhost";
FLUSH PRIVILEGES;
exit

cd ~
wget https://wordpress.org/latest.tar.gz
tar -xzf latest.tar.gz

cd wordpress/
cp wp-config-sample.php wp-config.php
sed -i 's/database_name_here/wordpress-db/g' wp-config.php
sed -i 's/username_here/wordpress-user/g' wp-config.php
sed -i 's/password_here/yourdbpassword/g' wp-config.php

curl https://api.wordpress.org/secret-key/1.1/salt/ >> wp-config.php

sudo rm /var/www/html/index.html
sudo mv * /var/www/html/
sudo chown -R www-data:www-data /var/www/html

Tuesday, December 2, 2014

Learn to Program in Python!

The second edition of Program Arcade Games with Python and Pygame is out! I'm very happy with how it has turned out. A lot of feedback from the first edition has gone into making the second. The Amazon reviews are good as well. The whole book is available on-line at ProgramArcadeGames.com.

 I'm not sure what my second professional project will be.

Monday, March 11, 2013

Three Years After The Adoption

Three years ago today Val and I sat in a courtroom to adopt Tanya and Nastya. Ten days later they were officially ours, and soon after they were in the US. 

Nothing worth doing is easy. But it has been worth it.

Nastya has learned so much and worked so hard. Her teacher this year didn't even know she’d been in Russia less than three years ago. 

Tanya, wow. The teenage years are hard enough. Watching her work through the frustration of everything and grow into a happy young woman getting ready to be independent is beautiful.

Alyssa? She grew up. We no longer had time to be helicopter parents, and Alyssa showed that she could do great anyways. One minute she can be an adult, the next minute turn around and act like a kid with Nastya.

Parents push their kids to do better, particularly when they don’t want to.

What I didn't know was that kids push their parents to do be better. I've never been pushed harder by anyone, including myself. And no one has been there for me more than Val. In another eight years the kids will leave, and there’s no one I’d rather spend the rest of my days with than her.

I think sometimes in life we focus so hard on where we’d like to be, that we forget to appreciate how far we've come. Nastya has had to learn everything a typical fourth grader knows in less than three years. Alyssa welcomed two strangers into her home as sisters. Tanya? She’s a typical high school student, defying the odds where half of all 15 year-olds that immigrate to the U.S. without English fail to even finish high school.

Please excuse me as I congratulate my family. Not everyone could have done that.

It has been a hard road, but we've traveled far and it looks like we have many miles ahead of us. Thanks to everyone that has traveled with us.

Wednesday, February 6, 2013

Pygame

Pygame Tutorials

Learn to create games using pygame with this free on-line e-book.

Install Sphinx on Windows.

First, install Python 2.7. I've had no luck the the 3.x series.

Then, download and install easy_install from here: http://pypi.python.org/pypi/setuptools/0.6c11

Then, execute:

\Python27\Scripts\easy_install.exe sphinx

Saturday, December 29, 2012

I recently installed RhodeCode onto Simpson's server. Awesome program, but setup isn't quite as easy as I'd like. So here are my notes, in case anyone else is interested.
I relied heavily on the following sites for information:
Installation was done on a Debian Wheezy system.
First, become superuser.
sudo bash
Install pre-requisites.
apt-get install python-all-dev python-pip python-mysqldb rabbitmq-server python-virtualenv libmysqlclient-dev
easy_install -U distribute
pip install mysql-python
pip install virtualenv
Set up the message queue system.
rabbitmqctl add_user rhodeuser mypassword
rabbitmqctl add_vhost rhodevhost
rabbitmqctl set_permissions -p rhodevhost rhodeuser ".*" ".*" ".*"
I prefer mysql for the database. Set this up.
mysql -u root -p

create database rhodecode character set utf8; 
create user 'rhodecode'@'localhost' identified by 'mypassword';
grant all privileges on rhodecode.* to 'rhodecode'@'localhost';
flush privileges; 
exit
Create a directory for installation
cd /var
mkdir rhode
chown www-data rhode
cd rhode

virtualenv --no-site-packages /var/rhode/venv
cd /var/rhode/venv/bin
source activate

cd /
pip install pastescript
pip install rhodecode

cd /var/rhode/venv/bin/
wget http://ncu.dl.sourceforge.net/project/mysql-python/mysql-python/1.2.3/MySQL-python-1.2.3.tar.gz
tar -zxf MySQL-python-1.2.3.tar.gz
cd MySQL-python-1.2.3
python setup.py build
cd ..

paster make-config RhodeCode production.ini
Edit production.ini so it looks like this:
vim production.ini
# -----
use_celery = true
# broker.host = localhost
broker.vhost = rhodevhost
broker.port = 5672
broker.user = rhodeuser
broker.password = mypassword

# Find this line and change to:
sqlalchemy.db1.url = mysql://rhodecode:mypassword@localhost/rhodecode
paster setup-rhodecode production.ini --user=rhodeuser --password=mypassword --email=paul@cravenfamily.com --repos=/mnt/hg_repos
/etc/init.d/rabbitmq-server start
See if celery works and hooks up to the message queue. If it does, hit ctrl-c and go to the next step. If it doesn't, debug before continuing.
paster celeryd production.ini
Start running. Then see if it works.
paster celeryd production.ini &
paster serve production.ini
I really wanted to use wsgi to serve stuff up. But I couldn't get authentication working. I am sad.
vim apache.conf
----
    WSGIScriptAlias /repo /var/rhode/venv/dispatch.wsgi
    WSGIPassAuthorization On
    WSGIDaemonProcess rhodecode user=www-data group=www-data threads=1 processes=10
    WSGIDaemonProcess pylons \
        threads=4 \
        python-path=/var/rhode/venv/lib/python2.6/site-packages

More wsgi stuff I didn't get working.
vim /var/rhode/venv/dispatch.wsgi
------
import os
os.environ["HGENCODING"] = "UTF-8"
os.environ['PYTHON_EGG_CACHE'] = '/var/rhode/venv/.egg-cache'

os.chdir('/var/rhode/venv')

import site
site.addsitedir("/var/rhode/pyenv/lib/python2.6/site-packages")

from paste.deploy import loadapp
from paste.script.util.logging_config import fileConfig

fileConfig('/var/rhode/venv/bin/production.ini')
application = loadapp('config:/var/rhode/venv/bin/production.ini')

To get the pass-through proxy working, this is what I did. First, enable the proxy mods:
a2enmod proxy_http
a2enmod proxy
a2enmod mod_headers
And some other stuff. I'll finish my notes later.













Thursday, October 4, 2012

Computer Science – Simpson College

Rather pleased with the customization we've done four our website: Computer Science – Simpson College