WordPress has a simple 503 "maintenance" page which you can (and should) enable during a code deployment. If you upgrade WordPress from within itself, then it enables and disables this page automatically.
If you want to enable it yourself, simply create a blank file .maintenance
in the top level WordPress directory, and delete it when the deployment is complete.
Example:
touch /srv/www/example.com/.maintenance
rsync staging@staging.example.com:/srv/www/example.com /srv/www/example.com
# custom scripts here, if any
rm /srv/www/example.com/.maintenance
At this time, a WordPress user with the Administrator role must now visit http://example.com/wp-admin/network/upgrade.php
(for multi-site; remove /network
for a single site) to update the database schema. I don't know of any good way to do that offline; however WordPress is pretty good at continuing to work with an out-of-date schema.