Skip to content

Instantly share code, notes, and snippets.

@wilmoore
Last active September 19, 2023 08:45
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 wilmoore/781608 to your computer and use it in GitHub Desktop.
Save wilmoore/781608 to your computer and use it in GitHub Desktop.
Software Engineering :: Talk :: Tame your build and deploy process - A look at Hudson, PHPUnit, and SSH
<VirtualHost *:80>
SetEnv APPLICATION_ENV local
ServerName api.example.com
DocumentRoot /home/api/apps/api.example.com/current/src/www
<Directory /home/api/apps/api.example.com/current/src/www/>
Options FollowSymLinks
AllowOverride None
Order Allow,Deny
Allow from All
</Directory>
<Location />
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
</Location>
</VirtualHost>

Shell commands for setting up hudson user's Git configuration

git config --global user.name "Hudson”
git config --global user.email "hudson@example.com"

Hudson Job Configuration

“example.com.api” >> “Configure” >> “Source Code Management” >> “Git”

URL of Repository: /media/psf/example.com.api

�NOTE: I cheated by linking a folder to my VM

“Build” >> “Add Build Step” >> “Execute Shell” >> “Command”

rsync -avzH -e ssh --progress $WORKSPACE/ api@127.0.0.1:~/apps/api/releases/$BUILD_ID

“Build” >> “Add Build Step” >> “Execute Shell” >> “Command”

ssh api@127.0.0.1 <<ssh-session
########## BEGIN: ssh commands ##########
cp ~/apps/api.example.com/releases/${BUILD_ID}/ops/etc/apache2/sites-available/example.com.api.vhost /etc/apache2/sites-available/
ln -nfs /etc/apache2/sites-available/example.com.api.vhost /etc/apache2/sites-enabled/
ln -nfs ~/apps/api.example.com/releases/${BUILD_ID} ~/apps/api.example.com/current
sudo /usr/sbin/service apache2 restart
##########   END: ssh commands ##########
ssh-session
<!– Naive Example -->
<h1>Hello, World!</h1>
<?php
printf('<pre>%s</pre>', var_export($_SERVER, true));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment