[perforce] swarm workshop
TRANSCRIPT
1
Perforce Swarm Get it. Use it. Hack it. Love it!
Geoff Nicol Technical Architect Perforce Software
Stewart Lord Technical Architect & Team Lead Perforce Software
2
Agenda
• Swarm Overview • Installing Swarm • Reviews: Starting, Updating, Committing • Extending Swarm • Hands on Reviews & Q/A
3
Swarm Overview!
4
Installing Swarm
5
Software Requirements
• Linux 2.6+ Intel or Mac OS X 10.6+ • Apache 2.2+ • PHP
• 5.3.3+, 5.4+ recommended • P4PHP extension, APC recommended
• P4D 2010.2+, 2013.1+ recommended
6
Hardware Requirements
• No hard/fast requirements at this time • Internally, VM with 4 GB ram and 2 cores • Perforce has ~250 employees; if you have more:
• Use bigger hardware • Scale Swarm horizontally • Run Swarm behind a replica
7
Ubuntu Packages
• apt-get update; apt-get upgrade • apt-get install
• vim unzip ssh • curl apache2 libapache2-mod-php5 php5 php-apc
8
Extract Swarm
• Under /var/www • wget ftp://ftp.perforce.com/perforce/r13.1/
bin.multiarch/swarm.tgz • tar -zxf swarm.tgz • ln -s swarm-<version> swarm • chown -R www-data:www-data data
9
Configure Swarm
• Create file /var/www/swarm/data/config.php <?php
return array(
'p4' => array(
'port' => 'perforce:1666',
'user' => 'swarm',
'password' => 'password',
)
);
10
Configuring Apache
• a2enmod rewrite • in /etc/apache2/sites-available/default:
• change ‘DocumentRoot’ to /var/www/swarm/public • update ‘Directory’ to /var/www/swarm/public • under ‘Directory’ AllowOverride All
11
Configuring PHP
• Create file /etc/php5/conf.d/perforce.ini with: extension=/var/www/swarm/p4-bin/bin.linux26x86_64/p4php/perforce-php54.so
12
Configuring Swarm’s Worker Queue
• Add a cron job similar to below: * * * * * curl -o /dev/null -m1 http://swarm-host/queue/worker
13
Verifying Install
• apachectl restart • You’re now where the OVA would start • visit http://my-swarm-host/ to ensure site is up • login as a super user
• view ‘about swarm’ dialog for trigger token • visit http://my-swarm-host/queue/status
14
Completing Install - Perforce Triggers
• Copy swarm-trigger.sh to your perforce server • Configure swarm host and swarm token • Run the script with no args for trigger values • Install triggers
15
Trouble?
• Check log files • /var/www/swarm/data/log • /var/log/apache2/error.log
• Ask for help! [email protected]
16
Reviews
Starting / Updating / Committing
17
Extensions!
18
Hands on Code Review!
19
Hands On
• Step 1: Connect to WiFi • SSID ‘Swarm’ no password
• Step 2: Connect to Swarm • http://192.168.2.220
20
SSID ‘Swarm‘ http://192.168.2.220 P4PORT 192.168.2.220:1666 • Step 3: Make a perforce user
• CLI: p4 -p <p4port> -u <myuser> user • P4V: Open connection, enter port and click new user
• Step 4: Make a client • CLI: p4 -p <p4port> -u <myuser> client • P4V: On connection dialog, click new Workspace
• Step 5: Login to Swarm • Step 6: Create a file for your username and shelve it • Step 7: Review your change / Profit