{"result":{"depiction_url":null,"edges":{"observes":{"objects":[{"created":"2026-11-02T19:56:03Z","object_id":{"id":1466,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_admin_menu","title":"observe_admin_menu\/3","uri":"https:\/\/zotonic.com\/id\/1466"},"seq":1}],"predicate":{"id":2550,"is_a":["meta","predicate"],"name":"observes","title":{"_type":"trans","tr":{"en":"Observes"}},"uri":"https:\/\/zotonic.com\/id\/observes"}},"subject":{"objects":[{"created":"2026-09-09T13:47:41Z","object_id":{"id":2555,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_reference","title":"Reference","uri":"https:\/\/zotonic.com\/id\/2555"},"seq":1},{"created":"2026-09-09T13:47:41Z","object_id":{"id":2566,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_operator","title":"Operator","uri":"https:\/\/zotonic.com\/id\/2566"},"seq":2},{"created":"2026-09-09T13:47:41Z","object_id":{"id":2605,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_site_management","title":"Site management","uri":"https:\/\/zotonic.com\/id\/2605"},"seq":3},{"created":"2026-09-09T13:47:41Z","object_id":{"id":2631,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_database","title":"Database","uri":"https:\/\/zotonic.com\/id\/2631"},"seq":4},{"created":"2026-09-09T13:47:41Z","object_id":{"id":2635,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_module","title":"Module","uri":"https:\/\/zotonic.com\/id\/2635"},"seq":5},{"created":"2026-09-09T13:47:41Z","object_id":{"id":2658,"is_a":["categorization","keyword","keyword_task"],"name":"zotonic_topic_migrate","title":"Migrate","uri":"https:\/\/zotonic.com\/id\/2658"},"seq":6}],"predicate":{"id":308,"is_a":["meta","predicate"],"name":"subject","title":{"_type":"trans","tr":{"en":"Keyword"}},"uri":"http:\/\/purl.org\/dc\/elements\/1.1\/subject"}}},"export_revision":3823,"id":2207,"is_a":["text","documentation","reference","module"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2207"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_module_mod_site_update","page_url":{"en":"https:\/\/zotonic.com\/docs\/2207\/mod_site_update","x-default":"https:\/\/zotonic.com\/docs\/2207\/mod_site_update"},"preview_url":null,"resource":{"version":3823,"pivot_location_lat":null,"title":"mod_site_update","is_authoritative":true,"body":"<p>This module pulls updates of a site‘s code from a remote version control system. The supported version control systems\nare git and mercurial.<\/p>\n<p>After enabling this module you will see a <strong>Deployment<\/strong> page in the System menu in the admin.<\/p>\n<p>This button is only available to users with the <em>use.mod_site_update<\/em> right. It opens a\npreview of the current commit and incoming remote history. Fetching this preview does\nnot change checked-out files; deployment starts only after pressing <strong>Deploy<\/strong>.<\/p>\n<p>Deploy controls show a node-wide <strong>Deployment running<\/strong> indicator, including\nupdates started from another page or the CLI. The retained MQTT topic\n<code>$SYS\/status\/code-update<\/code> (under the extensible <code>$SYS\/status\/<\/code> namespace) carries the sanitized node-wide coordinator\nstate in the shared MQTT pool. Indicators subscribe to changes without polling;\nnew pages receive the current state immediately. The topic follows the coordinator&#39;s\nactive deployment state, so failed or completed deployments are not marked running.\nSnapshots use two-hour retention and are refreshed on state\nchanges, coordinator restart and site startup. Rendering an indicator also reads\nthe coordinator directly, so it does not depend on an unexpired snapshot. Subscribers need\nadministrator or <code>use mod_site_update<\/code> permission; no repository paths or failure\nterms are published.<\/p>\n<p><strong>Reset<\/strong> lists the site&#39;s uncommitted changes before offering <strong>Undo all local changes<\/strong>.\nThis restores tracked files and removes non-ignored untracked files throughout the repository.\nLocal commits and nested repositories are preserved. Reset rebuilds and activates the code\nbefore releasing a failed deployment barrier; a failed rebuild keeps the barrier closed.\nDeployment previews remain available after failures so deployment can also be retried directly.<\/p>\n<p>The update uses the same deployment barrier as <code>bin\/zotonic deploy<\/code>: restore the tracked Git lock file,\npull code, compile and activate the updated modules before allowing schema upgrades. File changes are\nbuffered until activation completes, then caches and template indexes are refreshed.<\/p>\n<p>This update of the system can take a while.<\/p>\n<h2>Webhook<\/h2>\n<p>In GitHub and other systems it is possible to set a <em>webhook<\/em> that is called when new updates are pushed to the repository.<\/p>\n<p>In System &gt; Modules there is a <em>Config<\/em> button next to the mod_site_update module. Click this and configure a secure\ntoken to be passed to the webhook.<\/p>\n<p>The URL for GitHub et al is:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-erlang\">https:\/\/yoursite.test\/api\/model\/site_update\/post\/webhook\/&lt;token&gt;\n<\/code><\/pre>\n<p>Where <code>&lt;token&gt;<\/code> should be replaced with your configured token.<\/p>\n<p>The token is saved in the config key <code>mod_site_update.webhook_token<\/code>.<\/p>\n<p>Ensure that the external system performs a HTTP POST to the webhook, the posted body is dropped.<\/p>\n<h2>Zotonic status site<\/h2>\n<p>The <code>mod_site_update<\/code> module is also used by the zotonic status site.<\/p>\n<p>Here the module adds buttons to update sites and a button to update the complete Zotonic system.<\/p>\n<p>Site updates get their datamodel fixed by automatic restarts of modules, ensure that you increment the\n<code>-mod_schema(...)<\/code> version number.<\/p>\n<p>Zotonic updates are a bit more complicated. Small updates will be fine. Large updates that also change the datamodel or\nadd new Erlang dependencies need more compilation and a system restart. So be careful with using this update button.<\/p>\n<h2>Accepted Events<\/h2>\n<p>The Modules page renders deployment-button placeholders without discovering repositories.\nA single <code>module_deployment_buttons<\/code> postback starts a background lookup and fills the\napplicable rows through page actions. Repository discovery retains its short cache;\npreview and deployment still resolve the repository and check permissions again.<\/p>\n<p>Delegate callbacks:<\/p>\n<ul><li><code>event\/2<\/code> with <code>postback<\/code> messages: <code>make<\/code>, <code>module_deployment_buttons<\/code>, <code>vcs_up<\/code> (open dialog), <code>vcs_preview<\/code> (fetch preview), <code>vcs_deploy<\/code> (confirmation), <code>vcs_reset<\/code> (list local changes), <code>vcs_reset_confirm<\/code> (discard and rebuild).<\/li><\/ul>","slug":"mod_site_update","doc_module_config":[{"default":"[]","description":"The token to use for the webhook used to fetch new code from the version control system. If empty the webhook is disabled. This must be kept secret.","has_default":true,"key":"webhook_token","module":"mod_site_update","type":"string"}],"is_protected":false,"visible_for":0,"tz":"UTC","language":["en"],"doc_source_hash":"8248bffcea19c47ee04bff555d14a5d9cf025ecc2ee17a43fa5fa2bd6681bd9e","is_featured":false,"content_group_id":{"id":2551,"is_a":["meta","content_group"],"name":"content_group_imported_docs","title":"Imported documentation","uri":"https:\/\/zotonic.com\/id\/content_group_imported_docs"},"category_id":{"id":320,"is_a":["meta","category"],"name":"module","title":"Modules","uri":"https:\/\/test.zotonic.com\/id\/320"},"doc_source_path":"apps\/zotonic_mod_site_update\/src\/mod_site_update.erl","publication_start":"2023-06-24T08:18:01Z","github_url":"https:\/\/github.com\/zotonic\/zotonic\/blob\/master\/apps\/zotonic_mod_site_update\/src\/mod_site_update.erl","pivot_location_lng":null,"doc_source_kind":"module","name":"doc_module_mod_site_update","is_unfindable":false,"is_published":true,"pivot_geocode":null,"created":"2020-12-12T11:50:45Z","uri":null,"doc_status":"current","is_dependent":false,"erlang_app":"zotonic_mod_site_update","publication_end":"9999-06-01T00:00:00Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"privacy":0,"doc_source_commit":"1e7914d8b94e6fc755b615d50639fcb8828b41e7\n","creator_id":{"id":336,"is_a":["person","robot"],"name":"gitbot","title":"Git","uri":"https:\/\/zotonic.com\/id\/336"},"modified":"2026-11-17T14:40:58Z","title_slug":"mod_site_update"},"uri":"https:\/\/zotonic.com\/id\/2207","uri_template":"https:\/\/zotonic.com\/id\/:id","version":3823,"websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2207"}},"status":"ok"}