Skip to content

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_rewrite enabled (.htaccess support)
  • git available in the shell
  • DirectAdmin cron job scheduler (for Immoweb push)

First-time setup

1. Clone the repository

cd /home/USERNAME/
git clone https://github.com/rousseauxy/essentimmo app
cd app

2. Configure environment

cp .env.example .env
nano .env    # fill in DB_*, CONNECT_API_KEY, DEPLOY_SECRET, ADMIN_PASS

See configuration.md for a description of every variable.

3. Set the document root

DirectAdmin → Domains → essentimmo.be → Document Root:

/home/USERNAME/app/public

4. Create the database and run the schema

mysql -u USERNAME -p essentimmo < /home/USERNAME/app/immohive/schema.sql
ln -s /home/USERNAME/app/immohive/admin /home/USERNAME/app/public/admin

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:

git push origin main

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:

mysql -u USERNAME -p essentimmo < /home/USERNAME/app/immohive/migrate-XXXX.sql

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:

git revert HEAD --no-edit
git push origin main

The webhook will trigger deploy.php again and pull the reverted state.