ICAPMobile.app backend setup
- Enable verbose boot sequence
sudo nvram boot-args="-v"
- Disable Dashboard widgets (gained 31 pts. in GeekBench)
defaults write com.apple.dashboard mcx-disabled -boolean YES && killall Dock
- Disable ipv6
networksetup -setv6off Wi-Fi
networksetup -setv6off Ethernet
Install Oracle driver
1. Download Oracle Instant Client from smb://filesrv2/Technology/Boris/MacServer/instantclient_10_2.zip
2. Add Environment Variables to .profile
export ORACLE_HOME=/Users/bioffe/ORACLE/instantclient_10_2 export TNS_ADMIN=/Users/bioffe/ORACLE/instantclient_10_2 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME export DYLD_LIBRARY_PATH=$ORACLE_HOME export VERSIONER_PYTHON_PREFER_32_BIT=yes
3. Check DB connectivity
./sqlplus
SQL*Plus: Release 10.2.0.4.0 - Production on Wed Sep 28 15:08:43 2011
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Enter user-name: globalcustomer@refus2d
Enter password: ***********
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> select count(*) from cust_tbl;
COUNT(*)
----------
68131
4. Install CX_Oracle
- Download CX_Oracle from http://prdownloads.sourceforge.net/cx-oracle/cx_Oracle-5.1.tar.gz?download
- Build & Install CX_Oracle python egg
sudo env ORACLE_HOME=$ORACLE_HOME python setup.py install
- Check connectivity
import cx_Oracle
con = cx_Oracle.connect('globalcustomer/globalcustomer@refus2d')
con.cursor().execute('select count(*) from cust_tbl').fetchall()
Setup user account
- Create local log and SQLLite DB directories
mkdir access-logs db sudo chgrp -R _www access-logs/ db/ chmod -R 775 access-logs/ db/
- Create the directory structure
ln -s /Library/WebServer/CGI-Executables cgi-bin ln -s /Library/WebServer/Documents/ www mkdir bin/ certs/ mkdir /Library/WebServer/.python-eggs chown -R _www /Library/WebServer/.python-eggs chgrp -R _www /Library/WebServer/.python-eggs chmod -R 775 /Library/WebServer/.python-eggs
- Download and compile source code
svn --username=ioffe co https://www.wush.net/svn/ioffe/Icap ~/src/Icap xcodebuild -sdk macosx10.7 -configuration Debug -project ~/src/Icap/trunk/MarketEvent/MarketEvent.xcodeproj
Setup Launchd Deamons
- MarketEvent Deamon
MarketEvent Deamon(MarketEventd) is the system deamon which being used to observe market events. MarketEventd evaluates every incoming TickerUpdate(64) and triggers customer level PushMessage alerts delivery. The service is launched at the start-up sequence of a hosting environment. MarketEventd uses Mac OS X reachability API to determine a network route availability to target GTN gateway.
Configuration file:
/Library/LaunchDeamons/com.icap.MarketEventd.plist
ln -s /Users/bioffe/src/Icap/trunk/MarketEvent/resources/com.icap.MarketEventd.plist /Library/LaunchDaemons/com.icap.MarketEventd.plist launchctl load /Library/LaunchDaemons/com.icap.MarketEventd.plist
- Apple APNS feedback Service
APNS Feedback is a scheduled job that retrieves the list of device IDs associated with undeliverable PushMessages. Used to delete market alert triggers for devices that no longer have ICAPMobile.app installed.
Configuration file:
/Library/LaunchDeamons/com.icap.daily.apns.feedback.plist
ln -s /Users/bioffe/src/Icap/trunk/MarketEvent/resources/com.icap.daily.apns.feedback.plist /Library/LaunchDaemons/com.icap.daily.apns.feedback.plist launchctl load /Library/LaunchDaemons/com.icap.daily.apns.feedback.plist
- 8AM Maintenance script
It servers 2 main purposes. a) it restarts !marketEventD b) it rolls !marketEventD logs
ln -s /Users/bioffe/src/Icap/trunk/MarketEvent/resources/com.icap.daily.8am.plist /Library/LaunchDaemons/com.icap.daily.8am.plist launchctl load /Library/LaunchDaemons/com.icap.daily.8am.plist
- Change permissions per Launchd requirements
sudo chown root /Users/bioffe/src/Icap/trunk/MarketEvent/resources/*.plist sudo chmod 644 /Library/LaunchDaemons/com.icap.*
Setup Apache WebServer
2. Update /System/Library/LaunchDaemons/org.apache.httpd.plist by removing these lines:
<string>-D</string> <string>MACOSXSERVER</string>
3. Update httpd.conf
<Directory "/Library/WebServer/CGI-Executables">
AllowOverride None
Options None FollowSymLinks
Order allow,deny
Allow from all
SetEnv CONFIG_PATH /Users/bioffe/src/cgi-bin/
SetEnv ORACLE_HOME /Users/bioffe/ORACLE/instantclient_10_2
SetEnv TNS_ADMIN /Users/bioffe/ORACLE/instantclient_10_2
SetEnv LD_LIBRARY_PATH /Users/bioffe/ORACLE/instantclient_10_2
SetEnv DYLD_LIBRARY_PATH /Users/bioffe/ORACLE/instantclient_10_2
SetEnv VERSIONER_PYTHON_PREFER_32_BIT yes
</Directory>
4. Link CGI scripts
- agreementHelper.cgi ? - records user agreement acceptance
- alertHelper.cgi ? - (un)registers alerts on the behalf of a mobile customer
- apptoken.cgi ? - registers deviceID with a productID
- connectionString.cgi ? - retrieves GTN gateway destination
- currentAgreementVersion.cgi ? - retrieves GTN gateway destination
- messageFetcher.cgi? - retrieves content for Pushed Messages and deletes them from the backend
sudo ln -s ~/src/Icap/trunk/cgi-bin/agreementHelper.cgi ~/cgi-bin/agreementHelper.cgi sudo ln -s ~/src/Icap/trunk/cgi-bin/alertHelper.cgi ~/cgi-bin/alertHelper.cgi sudo ln -s ~/src/Icap/trunk/cgi-bin/apptoken.cgi ~/cgi-bin/apptoken.cgi sudo ln -s ~/src/Icap/trunk/cgi-bin/connectionString.cgi ~/cgi-bin/connectionString.cgi sudo ln -s ~/src/Icap/trunk/cgi-bin/currentAgreementVersion.cgi ~/cgi-bin/currentAgreementVersion.cgi sudo ln -s ~/src/Icap/trunk/cgi-bin/messageFetcher.cgi ~/cgi-bin/messageFetcher.cgi
