Deployment
Overview
Push-triggered deploy via GitHub webhook:
flowchart TD
dev(["git push origin main"])
dev --> gh["GitHub\nemits webhook POST"]
gh --> dp["public/deploy.php\nverifies HMAC-SHA256 signature"]
dp --> git["git pull origin main"]
git --> live(["Site updated on\nDirectAdmin VPS"])
No build step — this is pure PHP. The deploy script pulls the latest commit in-place.
Prerequisites
On the DirectAdmin VPS
- PHP 7.4+ with PDO MySQL extension
- MySQL / MariaDB
- Apache with
mod_rewriteenabled (.htaccesssupport) gitavailable in the shell- DirectAdmin cron job scheduler (for Immoweb push)
First-time setup
1. Clone the repository
2. Configure environment
See configuration.md for a description of every variable.
3. Set the document root
DirectAdmin → Domains → essentimmo.be → Document Root:
4. Create the database and run the schema
5. Create the admin symlink
This makes the admin UI reachable at https://essentimmo.be/admin/ without exposing
immohive/ as a web-accessible directory.
6. Configure the GitHub webhook
GitHub repo → Settings → Webhooks → Add webhook:
| Field | Value |
|---|---|
| Payload URL | https://essentimmo.be/deploy.php |
| Content type | application/json |
| Secret | Value of DEPLOY_SECRET in .env |
| Events | push (just the push event) |
deploy.php verifies the X-Hub-Signature-256 header before running git pull.
Any request with an invalid or missing signature is rejected with HTTP 403.
7. Add the cron job (Immoweb push)
DirectAdmin → Cron Jobs → Add:
*/5 * * * * php /home/USERNAME/app/immohive/cron/publish.php >> /home/USERNAME/logs/immohive-cron.log 2>&1
Directory layout on the server
/home/USERNAME/app/ ← git working tree (repo root)
config.php
.env ← git-ignored; created manually
immohive/
public/ ← Apache document root
uploads/ ← property photos; git-ignored
admin/ ← symlink → ../../immohive/admin
templates/
/home/USERNAME/logs/
immohive-cron.log ← cron output
uploads/ is git-ignored (.gitignore tracks .gitkeep). It survives git pull
because git does not touch untracked files.
Routine deploys
Every git push to main triggers deploy.php automatically:
The webhook fires within seconds. There is no downtime — git pull is atomic at the
filesystem level for a PHP site with no compiled assets.
Database migrations
Run ad-hoc SQL files after deploying a commit that requires schema changes.
Migration files live in immohive/ and are named migrate-*.sql.
| File | Purpose | Prerequisite |
|---|---|---|
schema.sql |
Full schema from scratch — run once on a fresh DB | — |
migrate-sync-immoweb.sql |
Separates Immoweb sync state from site status; adds sync_immoweb column |
schema.sql |
migrate-floor-market-status.sql |
Adds floor_number and market_status columns |
migrate-sync-immoweb.sql |
migrate-withdraw-pending.sql |
Extends immoweb_status ENUM with withdraw_pending |
migrate-floor-market-status.sql |
Run a migration:
On an existing installation, run only the migrations that have not been applied yet. The files are cumulative — applying them out of order or twice will break the schema.
WordPress migration (one-time)
If migrating from a WordPress site running the Easy Real Estate plugin:
# Dry run — inspect what will be imported
php /home/USERNAME/app/immohive/migrate-from-wordpress.php --dry-run
# Live run
php /home/USERNAME/app/immohive/migrate-from-wordpress.php
Edit the DB constants at the top of the script before running. This script is CLI-only and is safe to delete once the migration is complete.
Rollback
Because the deploy is a git pull, rolling back is a git revert + push, or checking out
a specific commit and pushing that:
The webhook will trigger deploy.php again and pull the reverted state.