Skip to content

Instantly share code, notes, and snippets.

@yinyunqiao
Created October 25, 2012 04:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yinyunqiao/3950391 to your computer and use it in GitHub Desktop.
Save yinyunqiao/3950391 to your computer and use it in GitHub Desktop.
test
#psqlpostgresql 9.2
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get install postgresql-9.2 apache2 aptitude bzr git sshfs tmux php-pear php-apc libphp-phpmailer php5-mcrypt php5-curl
#ubuntu uses dash as /bin/sh by default, we need to change it back to bash
sudo dpkg-reconfigure dash
sudo ln -s /usr/bin/perl /usr/local/bin/
sudo ln -s /usr/bin/php /usr/local/bin/
sudo ln -s ~/perl5/lib/perl5 /usr/local/lib/perl/5.14.2
sudo mkdir -p /var/log/lotto/dev/
sudo chown -R $USER /var/log/lotto/dev/
cpan install Modern::Perl File::Slurp Data::Dumper Getopt::Long FindBin::libs JSON::XS TryCatch Exporter Hash::Merge DBI Devel::StackTrace Log::Log4perl Log::Log4perl::Level Log::Log4perl::Logger Scalar::Util DBD::Pg JSON Mail::Sendmail Class:Date Carp::Always TryCatch
pear install PHPMailer
#ssh config (for both you & root accounts)
vi ~/.ssh/config
Host *
User charlesy
ForwardAgent yes
ForwardX11 yes
GSSAPIAuthentication no
ControlPath ~/.ssh/master-%l-%r@%h:%p
ControlMaster auto
#config apache
ln -s /etc/apache2 /www/conf
ln -s /var/log/apache2 /www/logs
sudo echo "Include /www/staff/charlesy/conf/httpd.conf" >> /etc/apache2/httpd.conf
sudo a2enmod ssl
#setup directories & symbol links
sudo mkdir -p /www/staff/$USER
sudo chmod -R $USER /www
cd /www
mkdir chrisj chrisb template bzr justinl
sshfs -o transform_symlinks -o follow_symlinks charlesy@kryten.lan:/www/staff/chrisj ./chrisj
sshfs -o transform_symlinks -o follow_symlinks charlesy@kryten.lan:/www/staff/chrisb ./chrisb
sshfs -o transform_symlinks -o follow_symlinks charlesy@kryten.lan:/www/staff/template ./template
sshfs -o transform_symlinks -o follow_symlinks charlesy@kryten.lan:/www/staff/bzr ./bzr
sshfs -o transform_symlinks -o follow_symlinks charlesy@kryten.lan:/www/staff/justinl ./justinl
#sshfs/copy scripts from kryten.lan
sudo chown -R $USER /opt
cd /opt
mkdir bin perl php js
sshfs -o transform_symlinks -o follow_symlinks charlesy@kryten.lan:/opt/bin ./bin
sshfs -o transform_symlinks -o follow_symlinks charlesy@kryten.lan:/opt/perl ./perl
sshfs -o transform_symlinks -o follow_symlinks charlesy@kryten.lan:/opt/php ./php
sshfs -o transform_symlinks -o follow_symlinks charlesy@kryten.lan:/opt/bzr ./bzr
export PATH=/opt/bin:$PATH
#reserved ports from http://wiki.benon.com/bin/view/OzLotteries/B2BDevServer#Reserved_ports
#for localhost, just choose your own
export SALB2B_PORT=1001
export SALB2B_SOAP_PORT=1002
export TATTS_PORT=1003
export BROKER_PORT=1004
export NSWB2B_PORT=1005
scp -r charlesy@kryten.lan:/www/staff/template/. /www/staff/$USER
#config apache
echo "Include /www/staff/$USER/conf/ozlotteries/*.conf" > ~/www/conf/httpd.conf
if grep -q "Include /www/staff/$USER/conf/httpd.conf" /www/conf/httpd.conf
then
echo "Include /www/staff/$USER/conf/httpd.conf was in /www/conf/httpd.conf before we started !"
else
sudo echo "Include /www/staff/$USER/conf/httpd.conf" >> /www/conf/httpd.conf
fi
#config postgresql
export PGHOST=holly.lan
export PGUSER=postgres
PGHOST=holly.lan pg_save ozlotteries_clean_tms1 #on kryten
PGHOST=holly.lan pg_save ozlotteries_clean_nsw1 #on kryten
#localhost, change the sql.tar.gz file names to yours
PGHOST=localhost PGUSER=postgres pg_load ozlotteries_clean_tms1 ozlotteries_clean_tms1_20121015.sql.gz
PGHOST=localhost PGUSER=postgres pg_load ozlotteries_clean_nsw1 ozlotteries_clean_nsw1_20121015.sql.gz
for kind in "" _tms1 ; do echo "Creating database : ${USER}_ozlotteries${kind}" ; yes | createdb -h $PGHOST ${USER}_ozlotteries${kind} -T ozlotteries_clean_tms1 ; done
for kind in _nsw1 _sal; do echo "Creating database : ${USER}_ozlotteries${kind}" ; yes | createdb -h $PGHOST ${USER}_ozlotteries${kind} -T ozlotteries_clean_nsw1 ; done
export FEATURE=clean
export CONFDIR=admin
cp -av /www/staff/template/. /www/staff/$USER
sudo ln -s /usr/sbin/service /sbin/
/opt/bin/icanhastree
#Add draws
cd /www/staff/$USER/projects/ozlotteries/clean
source scripts/perl-env scripts/test_scripts/bootstrap_draws.pl /opt/bzr/ozlotteries/draws.csv
#Create test customers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment