@rakay-technology/kraft 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +263 -0
- package/dist/bare-HL2GUYE2.js +27 -0
- package/dist/bowser-HNOTPGJO.js +2825 -0
- package/dist/chunk-3CJLKL6E.js +124 -0
- package/dist/chunk-3NQQXMDR.js +2098 -0
- package/dist/chunk-42WQABXM.js +439 -0
- package/dist/chunk-5GPXMTE4.js +25 -0
- package/dist/chunk-AJ4QZLZ2.js +1069 -0
- package/dist/chunk-AO252K7Z.js +137 -0
- package/dist/chunk-BQMFIXHI.js +975 -0
- package/dist/chunk-DM3PKWDC.js +2453 -0
- package/dist/chunk-DOD2BXHQ.js +1364 -0
- package/dist/chunk-DRK3MEDS.js +2870 -0
- package/dist/chunk-EW4PHKB2.js +13914 -0
- package/dist/chunk-HMJUFZK7.js +340 -0
- package/dist/chunk-I2TOOF2A.js +517 -0
- package/dist/chunk-I3DPMTSF.js +29 -0
- package/dist/chunk-JSCZT76F.js +2588 -0
- package/dist/chunk-MNV2QFHW.js +138 -0
- package/dist/chunk-MOLPYPVH.js +2529 -0
- package/dist/chunk-N4OALTFK.js +295 -0
- package/dist/chunk-OFXBNFNL.js +458 -0
- package/dist/chunk-ONKEYSMY.js +1388 -0
- package/dist/chunk-PDW4L3NV.js +17 -0
- package/dist/chunk-PNNXWA2A.js +1947 -0
- package/dist/chunk-PNRPKRJU.js +11105 -0
- package/dist/chunk-PVOWHIND.js +26781 -0
- package/dist/chunk-PXKCZB2I.js +46 -0
- package/dist/chunk-PZVKPCKE.js +475 -0
- package/dist/chunk-QWHBRY2K.js +4945 -0
- package/dist/chunk-RFOBMHQ7.js +338 -0
- package/dist/chunk-RHLNVZMS.js +28 -0
- package/dist/chunk-RVER2EOO.js +577 -0
- package/dist/chunk-S3QBGGVP.js +81 -0
- package/dist/chunk-TAML5WMA.js +198 -0
- package/dist/chunk-THTEUDBC.js +3188 -0
- package/dist/chunk-WYNM7L22.js +329 -0
- package/dist/chunk-XGCG4MD5.js +102 -0
- package/dist/chunk-XVKUFMIB.js +148 -0
- package/dist/chunk-XZYFZ6A5.js +50 -0
- package/dist/chunk-Y7PVJUXJ.js +2275 -0
- package/dist/chunk-YRSZPVMB.js +306 -0
- package/dist/chunk-YZUKHG3S.js +362 -0
- package/dist/chunk-ZVFS4LUA.js +116 -0
- package/dist/chunk-ZWLDLTJP.js +1417 -0
- package/dist/detect-676SNZK4.js +48 -0
- package/dist/dist-es-2YRDXMUU.js +73 -0
- package/dist/dist-es-CCVZEFRZ.js +91 -0
- package/dist/dist-es-EDUSMF6Q.js +488 -0
- package/dist/dist-es-IOH6G4GM.js +380 -0
- package/dist/dist-es-KWSMDPIP.js +26 -0
- package/dist/dist-es-UYDDOVZ3.js +173 -0
- package/dist/dist-es-XUOR4NQN.js +321 -0
- package/dist/docker-GOT3Q7DJ.js +41 -0
- package/dist/docker-edge-executor-VO6JHHW2.js +19 -0
- package/dist/edge-import-NFCHIW7G.js +50 -0
- package/dist/edge-preflight-QUJ757C6.js +45 -0
- package/dist/ensure-container-edge-Q7IZXHGM.js +38 -0
- package/dist/event-streams-TR4GAC53.js +46 -0
- package/dist/executor-GKXKN52K.js +42 -0
- package/dist/host-channel-preflight-Z6HYSPKO.js +48 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +9469 -0
- package/dist/loadSso-UGF4JMRK.js +581 -0
- package/dist/local-executor-OMMDKXCM.js +13 -0
- package/dist/nginx-VITTWZZU.js +42 -0
- package/dist/node-bootstrap.js +277 -0
- package/dist/node-entry.js +55 -0
- package/dist/noop-CLLJHCPL.js +11 -0
- package/dist/openresty-lua-6I3Z6PEQ.js +90 -0
- package/dist/privilege-UQAI2HV4.js +20 -0
- package/dist/server/engine/ChangeLog +2289 -0
- package/dist/server/engine/Documentations +5 -0
- package/dist/server/engine/LICENSE +674 -0
- package/dist/server/engine/README.md +34 -0
- package/dist/server/engine/conf/amavisd +150 -0
- package/dist/server/engine/conf/clamav +71 -0
- package/dist/server/engine/conf/core +632 -0
- package/dist/server/engine/conf/dovecot +151 -0
- package/dist/server/engine/conf/fail2ban +72 -0
- package/dist/server/engine/conf/global +698 -0
- package/dist/server/engine/conf/iredapd +52 -0
- package/dist/server/engine/conf/logwatch +28 -0
- package/dist/server/engine/conf/postfix +97 -0
- package/dist/server/engine/conf/postgresql +93 -0
- package/dist/server/engine/conf/spamassassin +39 -0
- package/dist/server/engine/dialog/config_via_dialog.sh +258 -0
- package/dist/server/engine/dialog/optional_components.sh +122 -0
- package/dist/server/engine/dialog/pgsql_config.sh +52 -0
- package/dist/server/engine/dialog/virtual_domain_config.sh +94 -0
- package/dist/server/engine/functions/amavisd.sh +267 -0
- package/dist/server/engine/functions/backend.sh +85 -0
- package/dist/server/engine/functions/clamav.sh +100 -0
- package/dist/server/engine/functions/cleanup.sh +393 -0
- package/dist/server/engine/functions/dovecot.sh +583 -0
- package/dist/server/engine/functions/fail2ban.sh +209 -0
- package/dist/server/engine/functions/iredapd.sh +356 -0
- package/dist/server/engine/functions/optional_components.sh +24 -0
- package/dist/server/engine/functions/packages.sh +522 -0
- package/dist/server/engine/functions/packages_freebsd.sh +179 -0
- package/dist/server/engine/functions/postfix.sh +457 -0
- package/dist/server/engine/functions/postgresql.sh +239 -0
- package/dist/server/engine/functions/spamassassin.sh +49 -0
- package/dist/server/engine/functions/system_accounts.sh +128 -0
- package/dist/server/engine/iRedMail.sh +144 -0
- package/dist/server/engine/pkgs/get_all.sh +338 -0
- package/dist/server/engine/pkgs/pkgs.freebsd.sha256 +3 -0
- package/dist/server/engine/pkgs/pkgs.openbsd.sha256 +6 -0
- package/dist/server/engine/pkgs/pkgs.sha256 +1 -0
- package/dist/server/engine/samples/amavisd/amavisd.conf +702 -0
- package/dist/server/engine/samples/amavisd/amavisd.mysql +278 -0
- package/dist/server/engine/samples/amavisd/amavisd.pgsql +253 -0
- package/dist/server/engine/samples/amavisd/amavisd.schema +942 -0
- package/dist/server/engine/samples/amavisd/default_spam_policy.sql +46 -0
- package/dist/server/engine/samples/dovecot/dovecot-2.4-mariadb.conf +758 -0
- package/dist/server/engine/samples/dovecot/dovecot-2.4-openldap.conf +767 -0
- package/dist/server/engine/samples/dovecot/dovecot-2.4-pgsql.conf +762 -0
- package/dist/server/engine/samples/dovecot/dovecot-last-login.conf +50 -0
- package/dist/server/engine/samples/dovecot/dovecot-ldap.conf +21 -0
- package/dist/server/engine/samples/dovecot/dovecot-share-folder.conf +22 -0
- package/dist/server/engine/samples/dovecot/dovecot-sql.conf +28 -0
- package/dist/server/engine/samples/dovecot/dovecot-used-quota.conf +13 -0
- package/dist/server/engine/samples/dovecot/dovecot.conf +484 -0
- package/dist/server/engine/samples/dovecot/dovecot.sieve +7 -0
- package/dist/server/engine/samples/dovecot/dovecot2-quota-warning.sh +38 -0
- package/dist/server/engine/samples/dovecot/sql/imap_share_folder.mysql +16 -0
- package/dist/server/engine/samples/dovecot/sql/last_login.mysql +12 -0
- package/dist/server/engine/samples/dovecot/sql/used_quota.mysql +26 -0
- package/dist/server/engine/samples/dovecot/systemd/override.conf +3 -0
- package/dist/server/engine/samples/fail2ban/action.d/banned_db.conf +9 -0
- package/dist/server/engine/samples/fail2ban/bin/fail2ban_banned_db +268 -0
- package/dist/server/engine/samples/fail2ban/fail2ban.local +17 -0
- package/dist/server/engine/samples/fail2ban/filter.d/dovecot.iredmail.conf +5 -0
- package/dist/server/engine/samples/fail2ban/filter.d/postfix-pregreet.iredmail.conf +16 -0
- package/dist/server/engine/samples/fail2ban/filter.d/postfix.iredmail.conf +18 -0
- package/dist/server/engine/samples/fail2ban/filter.d/roundcube.iredmail.conf +9 -0
- package/dist/server/engine/samples/fail2ban/jail.d/dovecot.local +8 -0
- package/dist/server/engine/samples/fail2ban/jail.d/nginx-http-auth.local +8 -0
- package/dist/server/engine/samples/fail2ban/jail.d/postfix-pregreet.local +9 -0
- package/dist/server/engine/samples/fail2ban/jail.d/postfix.local +8 -0
- package/dist/server/engine/samples/fail2ban/jail.d/roundcube.local +9 -0
- package/dist/server/engine/samples/fail2ban/jail.d/sogo.local +8 -0
- package/dist/server/engine/samples/fail2ban/jail.d/sshd.local +11 -0
- package/dist/server/engine/samples/fail2ban/jail.local +6 -0
- package/dist/server/engine/samples/fail2ban/openbsd/rc +27 -0
- package/dist/server/engine/samples/fail2ban/sql/fail2ban.mysql +49 -0
- package/dist/server/engine/samples/fail2ban/sql/fail2ban.pgsql +48 -0
- package/dist/server/engine/samples/firewall/firewalld/services/ssh.xml +6 -0
- package/dist/server/engine/samples/firewall/firewalld/zones/iredmail.xml +15 -0
- package/dist/server/engine/samples/firewall/iptables/ip6tables.init.debian +362 -0
- package/dist/server/engine/samples/firewall/iptables/ip6tables.rules +53 -0
- package/dist/server/engine/samples/firewall/iptables/iptables.init.debian +363 -0
- package/dist/server/engine/samples/firewall/iptables/iptables.rules +54 -0
- package/dist/server/engine/samples/firewall/nftables.conf +58 -0
- package/dist/server/engine/samples/freebsd/newsyslog.conf.d/dovecot.conf +3 -0
- package/dist/server/engine/samples/freebsd/newsyslog.conf.d/iredapd.conf +1 -0
- package/dist/server/engine/samples/freebsd/newsyslog.conf.d/mlmmjadmin.conf +1 -0
- package/dist/server/engine/samples/freebsd/newsyslog.conf.d/php-fpm.conf +2 -0
- package/dist/server/engine/samples/freebsd/newsyslog.conf.d/slapd.conf +1 -0
- package/dist/server/engine/samples/freebsd/syslog.d/dovecot.conf +2 -0
- package/dist/server/engine/samples/freebsd/syslog.d/fail2ban.conf +2 -0
- package/dist/server/engine/samples/freebsd/syslog.d/iredapd.conf +2 -0
- package/dist/server/engine/samples/freebsd/syslog.d/mlmmjadmin.conf +2 -0
- package/dist/server/engine/samples/freebsd/syslog.d/php-fpm.conf +2 -0
- package/dist/server/engine/samples/freebsd/syslog.d/slapd.conf +2 -0
- package/dist/server/engine/samples/iredmail/iredmail.mysql +491 -0
- package/dist/server/engine/samples/iredmail/iredmail.pgsql +465 -0
- package/dist/server/engine/samples/iredmail/iredmail.schema +456 -0
- package/dist/server/engine/samples/iredmail/used_quota_triggers_dovecot_2.3.pgsql +40 -0
- package/dist/server/engine/samples/iredmail/used_quota_triggers_dovecot_2.4.pgsql +18 -0
- package/dist/server/engine/samples/logrotate/dovecot +13 -0
- package/dist/server/engine/samples/logrotate/iredapd +13 -0
- package/dist/server/engine/samples/logrotate/mlmmjadmin +13 -0
- package/dist/server/engine/samples/logrotate/openldap +19 -0
- package/dist/server/engine/samples/logrotate/php-fpm +13 -0
- package/dist/server/engine/samples/openbsd/ldapd.conf +58 -0
- package/dist/server/engine/samples/openbsd/pf.conf +28 -0
- package/dist/server/engine/samples/postfix/command_filter.pcre +3 -0
- package/dist/server/engine/samples/postfix/freebsd/mailer.conf +9 -0
- package/dist/server/engine/samples/postfix/helo_access.pcre +180 -0
- package/dist/server/engine/samples/postfix/ldap/catchall_maps.cf +11 -0
- package/dist/server/engine/samples/postfix/ldap/recipient_bcc_maps_domain.cf +11 -0
- package/dist/server/engine/samples/postfix/ldap/recipient_bcc_maps_user.cf +11 -0
- package/dist/server/engine/samples/postfix/ldap/relay_domains.cf +11 -0
- package/dist/server/engine/samples/postfix/ldap/sender_bcc_maps_domain.cf +11 -0
- package/dist/server/engine/samples/postfix/ldap/sender_bcc_maps_user.cf +11 -0
- package/dist/server/engine/samples/postfix/ldap/sender_dependent_relayhost_maps_domain.cf +11 -0
- package/dist/server/engine/samples/postfix/ldap/sender_dependent_relayhost_maps_user.cf +11 -0
- package/dist/server/engine/samples/postfix/ldap/sender_login_maps.cf +11 -0
- package/dist/server/engine/samples/postfix/ldap/transport_maps_domain.cf +11 -0
- package/dist/server/engine/samples/postfix/ldap/transport_maps_user.cf +11 -0
- package/dist/server/engine/samples/postfix/ldap/virtual_alias_maps.cf +11 -0
- package/dist/server/engine/samples/postfix/ldap/virtual_group_maps.cf +11 -0
- package/dist/server/engine/samples/postfix/ldap/virtual_group_members_maps.cf +11 -0
- package/dist/server/engine/samples/postfix/ldap/virtual_mailbox_domains.cf +11 -0
- package/dist/server/engine/samples/postfix/ldap/virtual_mailbox_maps.cf +12 -0
- package/dist/server/engine/samples/postfix/main.cf +282 -0
- package/dist/server/engine/samples/postfix/main.cf.amavisd +7 -0
- package/dist/server/engine/samples/postfix/main.cf.dovecot +8 -0
- package/dist/server/engine/samples/postfix/main.cf.ldap +39 -0
- package/dist/server/engine/samples/postfix/main.cf.mlmmj +5 -0
- package/dist/server/engine/samples/postfix/main.cf.mysql +39 -0
- package/dist/server/engine/samples/postfix/main.cf.pgsql +39 -0
- package/dist/server/engine/samples/postfix/main.cf.postscreen +30 -0
- package/dist/server/engine/samples/postfix/master.cf +101 -0
- package/dist/server/engine/samples/postfix/mysql/catchall_maps.cf +5 -0
- package/dist/server/engine/samples/postfix/mysql/domain_alias_catchall_maps.cf +5 -0
- package/dist/server/engine/samples/postfix/mysql/domain_alias_maps.cf +5 -0
- package/dist/server/engine/samples/postfix/mysql/recipient_bcc_maps_domain.cf +5 -0
- package/dist/server/engine/samples/postfix/mysql/recipient_bcc_maps_user.cf +5 -0
- package/dist/server/engine/samples/postfix/mysql/relay_domains.cf +5 -0
- package/dist/server/engine/samples/postfix/mysql/sender_bcc_maps_domain.cf +5 -0
- package/dist/server/engine/samples/postfix/mysql/sender_bcc_maps_user.cf +5 -0
- package/dist/server/engine/samples/postfix/mysql/sender_dependent_relayhost_maps.cf +6 -0
- package/dist/server/engine/samples/postfix/mysql/sender_login_maps.cf +5 -0
- package/dist/server/engine/samples/postfix/mysql/transport_maps_domain.cf +5 -0
- package/dist/server/engine/samples/postfix/mysql/transport_maps_maillist.cf +5 -0
- package/dist/server/engine/samples/postfix/mysql/transport_maps_user.cf +5 -0
- package/dist/server/engine/samples/postfix/mysql/virtual_alias_maps.cf +5 -0
- package/dist/server/engine/samples/postfix/mysql/virtual_mailbox_domains.cf +5 -0
- package/dist/server/engine/samples/postfix/mysql/virtual_mailbox_maps.cf +5 -0
- package/dist/server/engine/samples/postfix/pgsql/catchall_maps.cf +5 -0
- package/dist/server/engine/samples/postfix/pgsql/domain_alias_catchall_maps.cf +5 -0
- package/dist/server/engine/samples/postfix/pgsql/domain_alias_maps.cf +5 -0
- package/dist/server/engine/samples/postfix/pgsql/recipient_bcc_maps_domain.cf +5 -0
- package/dist/server/engine/samples/postfix/pgsql/recipient_bcc_maps_user.cf +5 -0
- package/dist/server/engine/samples/postfix/pgsql/relay_domains.cf +5 -0
- package/dist/server/engine/samples/postfix/pgsql/sender_bcc_maps_domain.cf +5 -0
- package/dist/server/engine/samples/postfix/pgsql/sender_bcc_maps_user.cf +5 -0
- package/dist/server/engine/samples/postfix/pgsql/sender_dependent_relayhost_maps.cf +6 -0
- package/dist/server/engine/samples/postfix/pgsql/sender_login_maps.cf +5 -0
- package/dist/server/engine/samples/postfix/pgsql/transport_maps_domain.cf +5 -0
- package/dist/server/engine/samples/postfix/pgsql/transport_maps_maillist.cf +5 -0
- package/dist/server/engine/samples/postfix/pgsql/transport_maps_user.cf +5 -0
- package/dist/server/engine/samples/postfix/pgsql/virtual_alias_maps.cf +5 -0
- package/dist/server/engine/samples/postfix/pgsql/virtual_mailbox_domains.cf +5 -0
- package/dist/server/engine/samples/postfix/pgsql/virtual_mailbox_maps.cf +5 -0
- package/dist/server/engine/samples/postfix/postscreen_access.cidr +6 -0
- package/dist/server/engine/samples/postgresql/sql/add_first_domain_and_user.sql +34 -0
- package/dist/server/engine/samples/postgresql/sql/grant_permissions.sql +14 -0
- package/dist/server/engine/samples/postgresql/sql/init_vmail_db.sql +15 -0
- package/dist/server/engine/samples/rsyslog.d/1-iredmail-dovecot.conf +23 -0
- package/dist/server/engine/samples/rsyslog.d/1-iredmail-fail2ban.conf +2 -0
- package/dist/server/engine/samples/rsyslog.d/1-iredmail-iredapd.conf +12 -0
- package/dist/server/engine/samples/rsyslog.d/1-iredmail-mlmmjadmin.conf +12 -0
- package/dist/server/engine/samples/rsyslog.d/1-iredmail-openldap.conf +2 -0
- package/dist/server/engine/samples/rsyslog.d/1-iredmail-phpfpm.conf +3 -0
- package/dist/server/engine/samples/spamassassin/local.cf +186 -0
- package/dist/server/engine/samples/spamassassin/razor.conf +1 -0
- package/dist/server/engine/samples/systemd/clamd.service.d/override.conf +2 -0
- package/dist/server/engine/samples/systemd/mariadb.service.d/override.conf +3 -0
- package/dist/server/engine/samples/systemd/slapd.service.d/override.conf +6 -0
- package/dist/server/engine/samples/yum/CentOS-Linux-AppStream.repo +6 -0
- package/dist/server/engine/samples/yum/CentOS-Linux-PowerTools.repo +6 -0
- package/dist/server/engine/samples/yum/CentOS-Stream-AppStream.repo +7 -0
- package/dist/server/engine/samples/yum/CentOS-Stream-PowerTools.repo +7 -0
- package/dist/server/engine/samples/yum/symas-openldap.repo +6 -0
- package/dist/server/engine/tools/add_enabled_service.py +60 -0
- package/dist/server/engine/tools/backup_mysql.sh +238 -0
- package/dist/server/engine/tools/backup_openldap.sh +230 -0
- package/dist/server/engine/tools/backup_pgsql.sh +217 -0
- package/dist/server/engine/tools/backup_sogo.sh +156 -0
- package/dist/server/engine/tools/create_mail_user_OpenLDAP.py +335 -0
- package/dist/server/engine/tools/create_mail_user_OpenLDAP.sh +287 -0
- package/dist/server/engine/tools/create_mail_user_SQL.sh +127 -0
- package/dist/server/engine/tools/enable_postscreen.sh +144 -0
- package/dist/server/engine/tools/fail2ban_unban_ip.sh +39 -0
- package/dist/server/engine/tools/find_sasl_login_ip.sh +20 -0
- package/dist/server/engine/tools/find_top_sasl_usernames.sh +28 -0
- package/dist/server/engine/tools/generate_ssl_keys.sh +85 -0
- package/dist/server/engine/tools/kill_high_cpu_sogo_process.sh +32 -0
- package/dist/server/engine/tools/ldap_assign_user_to_groups.py +151 -0
- package/dist/server/engine/tools/ldap_move_members_to_another_group.py +129 -0
- package/dist/server/engine/tools/migrate_sql_alias_table.py +177 -0
- package/dist/server/engine/update/0.9.8/amavisd.mysql +29 -0
- package/dist/server/engine/update/0.9.8/amavisd.pgsql +39 -0
- package/dist/server/engine/update/0.9.8/iredmail.mysql +53 -0
- package/dist/server/engine/update/0.9.8/iredmail.pgsql +61 -0
- package/dist/server/engine/update/0.9.9/iredmail.mysql +2 -0
- package/dist/server/engine/update/0.9.9/iredmail.pgsql +2 -0
- package/dist/server/engine/update/1.0/iredmail.mysql +2 -0
- package/dist/server/engine/update/1.0/iredmail.pgsql +2 -0
- package/dist/server/engine/update/1.2/last_login.mysql +16 -0
- package/dist/server/engine/update/1.4.0/iredmail.mysql +22 -0
- package/dist/server/engine/update/1.4.0/iredmail.pgsql +20 -0
- package/dist/server/engine/update/1.4.1/iredmail.mysql +3 -0
- package/dist/server/engine/update/1.4.1/iredmail.pgsql +3 -0
- package/dist/server/engine/update/1.4.1/sogo.mysql +11 -0
- package/dist/server/engine/update/1.4.1/sogo.pgsql +30 -0
- package/dist/server/engine/update/1.4.1/update-ldap.py +66 -0
- package/dist/server/engine/update/1.4.2/iredmail.mysql +9 -0
- package/dist/server/engine/update/1.4.2/iredmail.pgsql +9 -0
- package/dist/server/engine/update/1.4.2/sogo.pgsql +30 -0
- package/dist/server/engine/update/1.6.0/sogo_view.pgsql +27 -0
- package/dist/server/engine/update/1.6.3/iredmail.mysql +1 -0
- package/dist/server/engine/update/1.7.0/fail2ban.mysql +11 -0
- package/dist/server/engine/update/1.7.0/fail2ban.pgsql +12 -0
- package/dist/server/engine/update/1.7.1/amavisd.mysql +1 -0
- package/dist/server/engine/update/1.7.2/vmail.mysql +30 -0
- package/dist/server/engine/update/1.7.3/deleted_mailboxes.mysql +43 -0
- package/dist/server/engine/update/1.7.3/iredadmin.mysql +26 -0
- package/dist/server/engine/update/1.7.3/vmail.mysql +79 -0
- package/dist/server/engine/update/1.7.3/vmail.pgsql +9 -0
- package/dist/server/engine/update/README.md +1 -0
- package/dist/server/engine/update/ldap/README.md +39 -0
- package/dist/server/engine/update/ldap/update-ldap-dovecot-2.3.py +69 -0
- package/dist/server/index.js +349016 -0
- package/dist/server/lua/geo_country.lua +127 -0
- package/dist/server/lua/maxminddb.lua +403 -0
- package/dist/server/lua/mgmt_api.lua +654 -0
- package/dist/server/lua/pipe_stream.lua +103 -0
- package/dist/server/lua/rules_guard.lua +132 -0
- package/dist/server/lua/rules_lib.lua +176 -0
- package/dist/server/lua/site_logger.lua +405 -0
- package/dist/server/lua/webhook_handler.lua +126 -0
- package/dist/server/migrations/0000_init.sql +666 -0
- package/dist/server/migrations/0001_brief_tomorrow_man.sql +47 -0
- package/dist/server/migrations/0002_funny_dazzler.sql +2 -0
- package/dist/server/migrations/0003_third_killer_shrike.sql +1 -0
- package/dist/server/migrations/0004_session_active_org_not_null.sql +10 -0
- package/dist/server/migrations/0005_warm_amazoness.sql +3 -0
- package/dist/server/migrations/0006_lumpy_joystick.sql +1 -0
- package/dist/server/migrations/0007_outgoing_maginty.sql +2 -0
- package/dist/server/migrations/0008_frozen_cutover.sql +3 -0
- package/dist/server/migrations/0009_credits_billing.sql +142 -0
- package/dist/server/migrations/0010_credit_grant_dedupe.sql +14 -0
- package/dist/server/migrations/0011_remove_credit_ledger.sql +23 -0
- package/dist/server/migrations/0012_smart_deploys_and_git_rollback.sql +81 -0
- package/dist/server/migrations/0013_fix_check_run_rollup_unique.sql +38 -0
- package/dist/server/migrations/0014_default_rollback_git.sql +9 -0
- package/dist/server/migrations/0015_billing_idempotency_grants.sql +41 -0
- package/dist/server/migrations/0016_github_auth_high_findings.sql +30 -0
- package/dist/server/migrations/0017_spooky_rumiko_fujikawa.sql +6 -0
- package/dist/server/migrations/0018_calm_shatterstar.sql +1 -0
- package/dist/server/migrations/0019_rename_workspace_install_to_prepare.sql +1 -0
- package/dist/server/migrations/0020_uneven_the_renegades.sql +13 -0
- package/dist/server/migrations/0021_shiny_firestar.sql +2 -0
- package/dist/server/migrations/0022_version_on_success_backfill.sql +6 -0
- package/dist/server/migrations/0023_productive_gorilla_man.sql +17 -0
- package/dist/server/migrations/0024_sleepy_peter_quill.sql +2 -0
- package/dist/server/migrations/0025_smooth_blue_shield.sql +1 -0
- package/dist/server/migrations/0026_mail_backup_source.sql +11 -0
- package/dist/server/migrations/0027_opposite_anthem.sql +6 -0
- package/dist/server/migrations/0028_stale_rogue.sql +18 -0
- package/dist/server/migrations/0029_bouncy_loners.sql +16 -0
- package/dist/server/migrations/0030_bright_darkstar.sql +6 -0
- package/dist/server/migrations/0031_conscious_catseye.sql +13 -0
- package/dist/server/migrations/0032_wet_mimic.sql +51 -0
- package/dist/server/migrations/0033_eminent_molly_hayes.sql +2 -0
- package/dist/server/migrations/0034_nervous_surge.sql +1 -0
- package/dist/server/migrations/0035_thankful_morgan_stark.sql +1 -0
- package/dist/server/migrations/0036_gorgeous_scalphunter.sql +17 -0
- package/dist/server/migrations/0037_clever_makkari.sql +28 -0
- package/dist/server/migrations/0038_young_magneto.sql +1 -0
- package/dist/server/migrations/0039_secret_lady_ursula.sql +15 -0
- package/dist/server/migrations/0040_sharp_red_wolf.sql +16 -0
- package/dist/server/migrations/0041_round_spyke.sql +4 -0
- package/dist/server/migrations/0042_dapper_havok.sql +1 -0
- package/dist/server/migrations/0043_fast_sharon_ventura.sql +15 -0
- package/dist/server/migrations/0044_amused_shape.sql +8 -0
- package/dist/server/migrations/0045_amusing_korath.sql +1 -0
- package/dist/server/migrations/0046_white_harrier.sql +35 -0
- package/dist/server/migrations/0047_sloppy_strong_guy.sql +2 -0
- package/dist/server/migrations/0048_funny_emma_frost.sql +2 -0
- package/dist/server/migrations/0049_nappy_piledriver.sql +3 -0
- package/dist/server/migrations/0050_add_service_deployment_image_digest.sql +1 -0
- package/dist/server/migrations/0051_add_update_status.sql +19 -0
- package/dist/server/migrations/0052_add_notice_target.sql +2 -0
- package/dist/server/migrations/0053_colossal_sandman.sql +14 -0
- package/dist/server/migrations/0054_add_instance_smtp.sql +5 -0
- package/dist/server/migrations/0055_rainy_klaw.sql +22 -0
- package/dist/server/migrations/0056_moaning_daredevil.sql +2 -0
- package/dist/server/migrations/0057_complete_prism.sql +18 -0
- package/dist/server/migrations/0058_add_server_is_local.sql +1 -0
- package/dist/server/migrations/0059_legal_fixer.sql +18 -0
- package/dist/server/migrations/0060_add_route_strategy_host_port.sql +3 -0
- package/dist/server/migrations/0061_notification_default_multi_kind.sql +3 -0
- package/dist/server/migrations/0062_add_incoming_webhook.sql +21 -0
- package/dist/server/migrations/0063_add_migration_logs.sql +1 -0
- package/dist/server/migrations/0064_add_migration_partial.sql +2 -0
- package/dist/server/migrations/0065_custom_app_template.sql +14 -0
- package/dist/server/migrations/0066_ensure_migration_partial_columns.sql +2 -0
- package/dist/server/migrations/0067_webhook_delivery.sql +28 -0
- package/dist/server/migrations/0068_add_migration_target_volumes.sql +1 -0
- package/dist/server/migrations/0069_add_project_composite_routes.sql +1 -0
- package/dist/server/migrations/0070_forward_git_to_server.sql +1 -0
- package/dist/server/migrations/0071_gh_device_token.sql +3 -0
- package/dist/server/migrations/0072_gh_device_token_method.sql +1 -0
- package/dist/server/migrations/0073_project_volumes_object_storage.sql +3 -0
- package/dist/server/migrations/0074_project_compose_path.sql +1 -0
- package/dist/server/migrations/0075_service_command_argv.sql +1 -0
- package/dist/server/migrations/0076_rollback_retention.sql +17 -0
- package/dist/server/migrations/0077_domain_redirect.sql +13 -0
- package/dist/server/migrations/0078_grant_source_scope.sql +30 -0
- package/dist/server/migrations/0079_project_readiness.sql +18 -0
- package/dist/server/migrations/0080_deployment_error_classification.sql +26 -0
- package/dist/server/migrations/0081_project_readiness_repair.sql +34 -0
- package/dist/server/migrations/0082_edge_target_verification.sql +39 -0
- package/dist/server/migrations/0083_service_incident.sql +84 -0
- package/dist/server/migrations/0084_analytics_daily_rollup.sql +72 -0
- package/dist/server/migrations/0085_resource_usage.sql +68 -0
- package/dist/server/migrations/0086_remote_infra_updates.sql +41 -0
- package/dist/server/migrations/0087_server_container_version_columns.sql +17 -0
- package/dist/server/migrations/0088_audit_source_and_settings.sql +27 -0
- package/dist/server/migrations/0089_auto_scan_infra.sql +7 -0
- package/dist/server/migrations/0090_project_collect_paths.sql +18 -0
- package/dist/server/migrations/0091_project_server_id.sql +26 -0
- package/dist/server/migrations/0092_project_internal_alias.sql +13 -0
- package/dist/server/migrations/0093_service_incident_org_index.sql +13 -0
- package/dist/server/migrations/0094_backup_restore_meta.sql +15 -0
- package/dist/server/migrations/0095_backup_restore_cancel.sql +19 -0
- package/dist/server/migrations/0096_backup_policy_retention_defaults.sql +20 -0
- package/dist/server/migrations/0097_update_status_upstream_only.sql +35 -0
- package/dist/server/migrations/0098_instance_product_mode.sql +12 -0
- package/dist/server/migrations/0099_mail_webmail_project.sql +24 -0
- package/dist/server/migrations/0100_server_ssh_private_key.sql +11 -0
- package/dist/server/migrations/0101_mail_resume_step.sql +12 -0
- package/dist/server/migrations/0102_project_workload_axes.sql +19 -0
- package/dist/server/migrations/0103_dns_credential.sql +41 -0
- package/dist/server/migrations/0104_instance_host_control.sql +15 -0
- package/dist/server/migrations/0105_mail_inbound_rules.sql +80 -0
- package/dist/server/migrations/0106_mcp_call_tracking.sql +23 -0
- package/dist/server/migrations/0107_build_minute_metering_indexes.sql +20 -0
- package/dist/server/migrations/0108_credential.sql +68 -0
- package/dist/server/migrations/0109_service_build_args.sql +9 -0
- package/dist/server/migrations/0110_service_deployment_host_ports.sql +18 -0
- package/dist/server/migrations/0111_host_port_claim.sql +381 -0
- package/dist/server/migrations/0112_backup_run_execution_lease.sql +12 -0
- package/dist/server/migrations/0113_docker_migration_execution_lease.sql +11 -0
- package/dist/server/migrations/0114_build_session_execution_lease_index.sql +6 -0
- package/dist/server/migrations/0115_orphan_target_key.sql +3 -0
- package/dist/server/migrations/0116_domain_ssl_challenge.sql +2 -0
- package/dist/server/migrations/0117_github_installation_workspace_scope.sql +24 -0
- package/dist/server/migrations/0118_git_sources.sql +66 -0
- package/dist/server/migrations/0119_backup_run_batch.sql +8 -0
- package/dist/server/migrations/0120_domain_primary_unique.sql +24 -0
- package/dist/server/migrations/0121_host_port_claim_overlap.sql +14 -0
- package/dist/server/migrations/0122_data_transfer_staging.sql +45 -0
- package/dist/server/migrations/0123_drop_cloud_infra.sql +7 -0
- package/dist/server/migrations/0124_mail_dmarc_report.sql +23 -0
- package/dist/server/migrations/0125_server_security_snapshot.sql +22 -0
- package/dist/server/migrations/meta/0000_snapshot.json +4848 -0
- package/dist/server/migrations/meta/0001_snapshot.json +4991 -0
- package/dist/server/migrations/meta/0002_snapshot.json +5013 -0
- package/dist/server/migrations/meta/0003_snapshot.json +5020 -0
- package/dist/server/migrations/meta/0004_snapshot.json +5020 -0
- package/dist/server/migrations/meta/0005_snapshot.json +5039 -0
- package/dist/server/migrations/meta/0006_snapshot.json +5045 -0
- package/dist/server/migrations/meta/0007_snapshot.json +5057 -0
- package/dist/server/migrations/meta/0016_snapshot.json +6053 -0
- package/dist/server/migrations/meta/0017_snapshot.json +6091 -0
- package/dist/server/migrations/meta/0018_snapshot.json +6098 -0
- package/dist/server/migrations/meta/0019_snapshot.json +6098 -0
- package/dist/server/migrations/meta/0020_snapshot.json +6201 -0
- package/dist/server/migrations/meta/0021_snapshot.json +6213 -0
- package/dist/server/migrations/meta/0022_snapshot.json +6213 -0
- package/dist/server/migrations/meta/0023_snapshot.json +6331 -0
- package/dist/server/migrations/meta/0024_snapshot.json +6343 -0
- package/dist/server/migrations/meta/0025_snapshot.json +6350 -0
- package/dist/server/migrations/meta/0026_snapshot.json +6440 -0
- package/dist/server/migrations/meta/0027_snapshot.json +6447 -0
- package/dist/server/migrations/meta/0028_snapshot.json +6581 -0
- package/dist/server/migrations/meta/0029_snapshot.json +6710 -0
- package/dist/server/migrations/meta/0030_snapshot.json +6748 -0
- package/dist/server/migrations/meta/0031_snapshot.json +6859 -0
- package/dist/server/migrations/meta/0032_snapshot.json +7222 -0
- package/dist/server/migrations/meta/0033_snapshot.json +7249 -0
- package/dist/server/migrations/meta/0034_snapshot.json +7255 -0
- package/dist/server/migrations/meta/0035_snapshot.json +7262 -0
- package/dist/server/migrations/meta/0036_snapshot.json +7392 -0
- package/dist/server/migrations/meta/0037_snapshot.json +7602 -0
- package/dist/server/migrations/meta/0038_snapshot.json +7609 -0
- package/dist/server/migrations/meta/0039_snapshot.json +7714 -0
- package/dist/server/migrations/meta/0040_snapshot.json +7820 -0
- package/dist/server/migrations/meta/0041_snapshot.json +7833 -0
- package/dist/server/migrations/meta/0042_snapshot.json +7839 -0
- package/dist/server/migrations/meta/0043_snapshot.json +7938 -0
- package/dist/server/migrations/meta/0044_snapshot.json +7982 -0
- package/dist/server/migrations/meta/0045_snapshot.json +7989 -0
- package/dist/server/migrations/meta/0046_snapshot.json +8263 -0
- package/dist/server/migrations/meta/0047_snapshot.json +8275 -0
- package/dist/server/migrations/meta/0048_snapshot.json +8289 -0
- package/dist/server/migrations/meta/0049_snapshot.json +8308 -0
- package/dist/server/migrations/meta/0050_snapshot.json +8314 -0
- package/dist/server/migrations/meta/0051_snapshot.json +8460 -0
- package/dist/server/migrations/meta/0052_snapshot.json +8472 -0
- package/dist/server/migrations/meta/0053_snapshot.json +8556 -0
- package/dist/server/migrations/meta/0054_snapshot.json +8586 -0
- package/dist/server/migrations/meta/0055_snapshot.json +8756 -0
- package/dist/server/migrations/meta/0056_snapshot.json +8777 -0
- package/dist/server/migrations/meta/0057_snapshot.json +8904 -0
- package/dist/server/migrations/meta/0058_snapshot.json +8911 -0
- package/dist/server/migrations/meta/0059_snapshot.json +9061 -0
- package/dist/server/migrations/meta/0060_snapshot.json +9081 -0
- package/dist/server/migrations/meta/_journal.json +888 -0
- package/dist/server/pglite/pglite.data +0 -0
- package/dist/server/pglite/pglite.wasm +0 -0
- package/dist/setup-JWKZIECM.js +25 -0
- package/dist/signin-3M3UPB6K.js +667 -0
- package/dist/ssh-client-NWQVRCV7.js +29 -0
- package/dist/sso-oidc-3VDIYOEJ.js +834 -0
- package/dist/sts-B3WIYLXR.js +1426 -0
- package/dist/up-P5DMQ5YO.js +55 -0
- package/package.json +58 -0
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
-- Durable, host-wide loopback-port reservations.
|
|
2
|
+
--
|
|
3
|
+
-- A port collision domain is a physical target, not an organization. Claims are
|
|
4
|
+
-- also deliberately detached from project/service foreign keys: a stopped app,
|
|
5
|
+
-- record-only delete, or cleanup-pending vhost must keep its reservation until
|
|
6
|
+
-- routing has been explicitly removed.
|
|
7
|
+
CREATE TABLE IF NOT EXISTS "host_port_claim" (
|
|
8
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
9
|
+
"target_key" text NOT NULL,
|
|
10
|
+
"port" integer NOT NULL,
|
|
11
|
+
"project_id" text NOT NULL,
|
|
12
|
+
"service_id" text,
|
|
13
|
+
"container_port" integer,
|
|
14
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
15
|
+
"updated_at" timestamp DEFAULT now() NOT NULL,
|
|
16
|
+
CONSTRAINT "ck_host_port_claim_target_key"
|
|
17
|
+
CHECK (
|
|
18
|
+
"target_key" = 'local'
|
|
19
|
+
OR "target_key" ~ '^host:[0-9a-f]{64}$'
|
|
20
|
+
OR ("target_key" LIKE 'server:%' AND length("target_key") > 7)
|
|
21
|
+
),
|
|
22
|
+
CONSTRAINT "ck_host_port_claim_port"
|
|
23
|
+
CHECK ("port" BETWEEN 1 AND 65535),
|
|
24
|
+
CONSTRAINT "ck_host_port_claim_container_port"
|
|
25
|
+
CHECK ("container_port" IS NULL OR "container_port" BETWEEN 1 AND 65535)
|
|
26
|
+
);
|
|
27
|
+
--> statement-breakpoint
|
|
28
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "uq_host_port_claim_target_port"
|
|
29
|
+
ON "host_port_claim" ("target_key", "port");
|
|
30
|
+
--> statement-breakpoint
|
|
31
|
+
-- NULLS NOT DISTINCT expressed with portable sentinels: port zero is rejected
|
|
32
|
+
-- above, and ids generated by Kraft are never empty strings.
|
|
33
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "uq_host_port_claim_target_owner"
|
|
34
|
+
ON "host_port_claim" (
|
|
35
|
+
"target_key",
|
|
36
|
+
"project_id",
|
|
37
|
+
COALESCE("service_id", ''),
|
|
38
|
+
COALESCE("container_port", 0)
|
|
39
|
+
);
|
|
40
|
+
--> statement-breakpoint
|
|
41
|
+
CREATE INDEX IF NOT EXISTS "idx_host_port_claim_project"
|
|
42
|
+
ON "host_port_claim" ("project_id");
|
|
43
|
+
--> statement-breakpoint
|
|
44
|
+
|
|
45
|
+
-- Build one canonical candidate set for the whole migration. This is the same
|
|
46
|
+
-- set used to detect legacy ambiguity and to insert ordinary claims, so a source
|
|
47
|
+
-- cannot be considered by one path and silently omitted by the other.
|
|
48
|
+
--
|
|
49
|
+
-- Legacy `deployTarget:server` snapshots could omit serverId. Runtime resolves
|
|
50
|
+
-- those to the org's sole server; this backfill mirrors that exact org-scoped
|
|
51
|
+
-- fallback and collapses an isLocal server row into the local bind namespace.
|
|
52
|
+
WITH "sole_org_servers" AS (
|
|
53
|
+
SELECT
|
|
54
|
+
candidate."organization_id",
|
|
55
|
+
MIN(candidate."id") AS "server_id"
|
|
56
|
+
FROM "servers" candidate
|
|
57
|
+
WHERE candidate."organization_id" IS NOT NULL
|
|
58
|
+
GROUP BY candidate."organization_id"
|
|
59
|
+
HAVING COUNT(*) = 1
|
|
60
|
+
),
|
|
61
|
+
"target_inputs" AS (
|
|
62
|
+
SELECT
|
|
63
|
+
'project'::text AS "context_kind",
|
|
64
|
+
p."id" AS "context_id",
|
|
65
|
+
COALESCE(d."organization_id", p."organization_id") AS "organization_id",
|
|
66
|
+
NULLIF(d."meta" ->> 'serverId', '') AS "snapshot_server_id",
|
|
67
|
+
NULLIF(p."server_id", '') AS "project_server_id",
|
|
68
|
+
d."meta" ->> 'deployTarget' AS "deploy_target"
|
|
69
|
+
FROM "project" p
|
|
70
|
+
LEFT JOIN "deployment" d ON d."id" = p."active_deployment_id"
|
|
71
|
+
|
|
72
|
+
UNION ALL
|
|
73
|
+
|
|
74
|
+
SELECT
|
|
75
|
+
'deployment'::text AS "context_kind",
|
|
76
|
+
d."id" AS "context_id",
|
|
77
|
+
d."organization_id",
|
|
78
|
+
NULLIF(d."meta" ->> 'serverId', '') AS "snapshot_server_id",
|
|
79
|
+
NULLIF(p."server_id", '') AS "project_server_id",
|
|
80
|
+
d."meta" ->> 'deployTarget' AS "deploy_target"
|
|
81
|
+
FROM "deployment" d
|
|
82
|
+
INNER JOIN "project" p ON p."id" = d."project_id"
|
|
83
|
+
WHERE p."active_deployment_id" = d."id"
|
|
84
|
+
OR d."status" IN ('deploying', 'reconciling')
|
|
85
|
+
),
|
|
86
|
+
"resolved_target_ids" AS (
|
|
87
|
+
SELECT
|
|
88
|
+
input."context_kind",
|
|
89
|
+
input."context_id",
|
|
90
|
+
COALESCE(
|
|
91
|
+
input."snapshot_server_id",
|
|
92
|
+
input."project_server_id",
|
|
93
|
+
CASE
|
|
94
|
+
WHEN input."deploy_target" = 'server' THEN sole."server_id"
|
|
95
|
+
ELSE NULL
|
|
96
|
+
END
|
|
97
|
+
) AS "server_id"
|
|
98
|
+
FROM "target_inputs" input
|
|
99
|
+
LEFT JOIN "sole_org_servers" sole
|
|
100
|
+
ON sole."organization_id" = input."organization_id"
|
|
101
|
+
),
|
|
102
|
+
"candidate_targets" AS (
|
|
103
|
+
SELECT
|
|
104
|
+
target."context_kind",
|
|
105
|
+
target."context_id",
|
|
106
|
+
CASE
|
|
107
|
+
WHEN target."server_id" IS NULL OR server."is_local" = true THEN 'local'
|
|
108
|
+
ELSE 'server:' || target."server_id"
|
|
109
|
+
END AS "target_key"
|
|
110
|
+
FROM "resolved_target_ids" target
|
|
111
|
+
LEFT JOIN "servers" server ON server."id" = target."server_id"
|
|
112
|
+
),
|
|
113
|
+
-- Parse each routed service map once. Only numeric container keys and 0110's
|
|
114
|
+
-- explicit legacy sentinel are meaningful. Nested CASE expressions guarantee a
|
|
115
|
+
-- malformed hand-edited JSON value is never cast before it passes the digit gate.
|
|
116
|
+
"service_port_entries" AS (
|
|
117
|
+
SELECT
|
|
118
|
+
sd."id" AS "service_deployment_id",
|
|
119
|
+
target."target_key",
|
|
120
|
+
p."id" AS "project_id",
|
|
121
|
+
sd."service_id",
|
|
122
|
+
ports."container_key",
|
|
123
|
+
parsed."container_port",
|
|
124
|
+
parsed."host_port"
|
|
125
|
+
FROM "service_deployment" sd
|
|
126
|
+
INNER JOIN "deployment" d ON d."id" = sd."deployment_id"
|
|
127
|
+
INNER JOIN "project" p ON p."id" = d."project_id"
|
|
128
|
+
INNER JOIN "candidate_targets" target
|
|
129
|
+
ON target."context_kind" = 'deployment'
|
|
130
|
+
AND target."context_id" = d."id"
|
|
131
|
+
CROSS JOIN LATERAL jsonb_each_text(COALESCE(sd."host_ports", '{}'::jsonb))
|
|
132
|
+
AS ports("container_key", "host_port_text")
|
|
133
|
+
CROSS JOIN LATERAL (
|
|
134
|
+
SELECT
|
|
135
|
+
CASE
|
|
136
|
+
WHEN ports."container_key" ~ '^[0-9]{1,5}$' THEN
|
|
137
|
+
CASE
|
|
138
|
+
WHEN ports."container_key"::integer BETWEEN 1 AND 65535
|
|
139
|
+
THEN ports."container_key"::integer
|
|
140
|
+
ELSE NULL
|
|
141
|
+
END
|
|
142
|
+
ELSE NULL
|
|
143
|
+
END AS "container_port",
|
|
144
|
+
CASE
|
|
145
|
+
WHEN ports."host_port_text" ~ '^[0-9]{1,5}$' THEN
|
|
146
|
+
CASE
|
|
147
|
+
WHEN ports."host_port_text"::integer BETWEEN 1 AND 65535
|
|
148
|
+
THEN ports."host_port_text"::integer
|
|
149
|
+
ELSE NULL
|
|
150
|
+
END
|
|
151
|
+
ELSE NULL
|
|
152
|
+
END AS "host_port"
|
|
153
|
+
) parsed
|
|
154
|
+
WHERE (
|
|
155
|
+
p."active_deployment_id" = d."id"
|
|
156
|
+
OR d."status" IN ('deploying', 'reconciling')
|
|
157
|
+
)
|
|
158
|
+
-- Cloud owns its own routing namespace. Persisted/imported hostPorts on a
|
|
159
|
+
-- cloud release are source-host cache, never a claim on this installation.
|
|
160
|
+
AND p."cloud_workspace_id" IS NULL
|
|
161
|
+
AND COALESCE(NULLIF(d."meta" ->> 'deployTarget', ''), '') <> 'cloud'
|
|
162
|
+
AND parsed."host_port" IS NOT NULL
|
|
163
|
+
AND (
|
|
164
|
+
parsed."container_port" IS NOT NULL
|
|
165
|
+
OR ports."container_key" = '__legacy__'
|
|
166
|
+
)
|
|
167
|
+
),
|
|
168
|
+
"candidate_claims" AS (
|
|
169
|
+
-- Single-app Docker compatibility pin. Cloud bindings are excluded for the
|
|
170
|
+
-- same reason as Compose maps above.
|
|
171
|
+
SELECT
|
|
172
|
+
'hpc_project_' || p."id" AS "id",
|
|
173
|
+
target."target_key",
|
|
174
|
+
p."host_port" AS "port",
|
|
175
|
+
p."id" AS "project_id",
|
|
176
|
+
NULL::text AS "service_id",
|
|
177
|
+
NULL::integer AS "container_port"
|
|
178
|
+
FROM "project" p
|
|
179
|
+
LEFT JOIN "deployment" d ON d."id" = p."active_deployment_id"
|
|
180
|
+
INNER JOIN "candidate_targets" target
|
|
181
|
+
ON target."context_kind" = 'project'
|
|
182
|
+
AND target."context_id" = p."id"
|
|
183
|
+
WHERE p."host_port" BETWEEN 1 AND 65535
|
|
184
|
+
AND p."cloud_workspace_id" IS NULL
|
|
185
|
+
AND COALESCE(NULLIF(d."meta" ->> 'deployTarget', ''), '') <> 'cloud'
|
|
186
|
+
|
|
187
|
+
UNION ALL
|
|
188
|
+
|
|
189
|
+
-- Bare web processes bind their declared app port directly.
|
|
190
|
+
SELECT
|
|
191
|
+
'hpc_bare_' || p."id" || '_' || p."port"::text AS "id",
|
|
192
|
+
target."target_key",
|
|
193
|
+
p."port" AS "port",
|
|
194
|
+
p."id" AS "project_id",
|
|
195
|
+
NULL::text AS "service_id",
|
|
196
|
+
p."port" AS "container_port"
|
|
197
|
+
FROM "project" p
|
|
198
|
+
INNER JOIN "deployment" d ON d."id" = p."active_deployment_id"
|
|
199
|
+
INNER JOIN "candidate_targets" target
|
|
200
|
+
ON target."context_kind" = 'project'
|
|
201
|
+
AND target."context_id" = p."id"
|
|
202
|
+
WHERE p."port" BETWEEN 1 AND 65535
|
|
203
|
+
AND p."cloud_workspace_id" IS NULL
|
|
204
|
+
AND COALESCE(NULLIF(d."meta" ->> 'deployTarget', ''), '') <> 'cloud'
|
|
205
|
+
AND COALESCE(
|
|
206
|
+
NULLIF(d."meta" ->> 'runtimeMode', ''),
|
|
207
|
+
NULLIF(p."runtime_mode", '')
|
|
208
|
+
) = 'bare'
|
|
209
|
+
AND COALESCE(
|
|
210
|
+
NULLIF(d."meta" ->> 'workloadType', ''),
|
|
211
|
+
NULLIF(p."workload_type", ''),
|
|
212
|
+
CASE
|
|
213
|
+
WHEN COALESCE(NULLIF(d."meta" ->> 'hasServer', ''), p."has_server"::text) = 'false'
|
|
214
|
+
THEN 'static'
|
|
215
|
+
ELSE 'web'
|
|
216
|
+
END
|
|
217
|
+
) = 'web'
|
|
218
|
+
|
|
219
|
+
UNION ALL
|
|
220
|
+
|
|
221
|
+
-- Complete Compose map. A numeric key supersedes 0110's targetless legacy
|
|
222
|
+
-- sentinel when both name the same host port.
|
|
223
|
+
SELECT
|
|
224
|
+
'hpc_service_' || entry."service_deployment_id" || '_' || entry."container_key" AS "id",
|
|
225
|
+
entry."target_key",
|
|
226
|
+
entry."host_port" AS "port",
|
|
227
|
+
entry."project_id",
|
|
228
|
+
entry."service_id",
|
|
229
|
+
entry."container_port"
|
|
230
|
+
FROM "service_port_entries" entry
|
|
231
|
+
WHERE NOT (
|
|
232
|
+
entry."container_port" IS NULL
|
|
233
|
+
AND EXISTS (
|
|
234
|
+
SELECT 1
|
|
235
|
+
FROM "service_port_entries" numeric_entry
|
|
236
|
+
WHERE numeric_entry."service_deployment_id" = entry."service_deployment_id"
|
|
237
|
+
AND numeric_entry."host_port" = entry."host_port"
|
|
238
|
+
AND numeric_entry."container_port" IS NOT NULL
|
|
239
|
+
)
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
UNION ALL
|
|
243
|
+
|
|
244
|
+
-- Scalar fallback only when the map did not already preserve this port.
|
|
245
|
+
SELECT
|
|
246
|
+
'hpc_service_' || sd."id" || '_scalar' AS "id",
|
|
247
|
+
target."target_key",
|
|
248
|
+
sd."host_port" AS "port",
|
|
249
|
+
p."id" AS "project_id",
|
|
250
|
+
sd."service_id",
|
|
251
|
+
NULL::integer AS "container_port"
|
|
252
|
+
FROM "service_deployment" sd
|
|
253
|
+
INNER JOIN "deployment" d ON d."id" = sd."deployment_id"
|
|
254
|
+
INNER JOIN "project" p ON p."id" = d."project_id"
|
|
255
|
+
INNER JOIN "candidate_targets" target
|
|
256
|
+
ON target."context_kind" = 'deployment'
|
|
257
|
+
AND target."context_id" = d."id"
|
|
258
|
+
WHERE (
|
|
259
|
+
p."active_deployment_id" = d."id"
|
|
260
|
+
OR d."status" IN ('deploying', 'reconciling')
|
|
261
|
+
)
|
|
262
|
+
AND p."cloud_workspace_id" IS NULL
|
|
263
|
+
AND COALESCE(NULLIF(d."meta" ->> 'deployTarget', ''), '') <> 'cloud'
|
|
264
|
+
AND sd."host_port" BETWEEN 1 AND 65535
|
|
265
|
+
AND NOT EXISTS (
|
|
266
|
+
SELECT 1
|
|
267
|
+
FROM "service_port_entries" entry
|
|
268
|
+
WHERE entry."service_deployment_id" = sd."id"
|
|
269
|
+
AND entry."host_port" = sd."host_port"
|
|
270
|
+
)
|
|
271
|
+
),
|
|
272
|
+
-- Duplicate records of the exact same claim (for example an active and carried
|
|
273
|
+
-- row agreeing on one port) are harmless. Pick one deterministic id.
|
|
274
|
+
"canonical_candidates" AS (
|
|
275
|
+
SELECT
|
|
276
|
+
MIN(candidate."id") AS "id",
|
|
277
|
+
candidate."target_key",
|
|
278
|
+
candidate."port",
|
|
279
|
+
candidate."project_id",
|
|
280
|
+
candidate."service_id",
|
|
281
|
+
candidate."container_port"
|
|
282
|
+
FROM "candidate_claims" candidate
|
|
283
|
+
GROUP BY
|
|
284
|
+
candidate."target_key",
|
|
285
|
+
candidate."port",
|
|
286
|
+
candidate."project_id",
|
|
287
|
+
candidate."service_id",
|
|
288
|
+
candidate."container_port"
|
|
289
|
+
),
|
|
290
|
+
"port_conflicts" AS (
|
|
291
|
+
SELECT candidate."target_key", candidate."port"
|
|
292
|
+
FROM "canonical_candidates" candidate
|
|
293
|
+
GROUP BY candidate."target_key", candidate."port"
|
|
294
|
+
HAVING COUNT(*) > 1
|
|
295
|
+
),
|
|
296
|
+
"owner_conflicts" AS (
|
|
297
|
+
SELECT
|
|
298
|
+
candidate."target_key",
|
|
299
|
+
candidate."project_id",
|
|
300
|
+
candidate."service_id",
|
|
301
|
+
candidate."container_port"
|
|
302
|
+
FROM "canonical_candidates" candidate
|
|
303
|
+
GROUP BY
|
|
304
|
+
candidate."target_key",
|
|
305
|
+
candidate."project_id",
|
|
306
|
+
candidate."service_id",
|
|
307
|
+
candidate."container_port"
|
|
308
|
+
HAVING COUNT(*) > 1
|
|
309
|
+
),
|
|
310
|
+
"ambiguous_ports" AS (
|
|
311
|
+
SELECT DISTINCT candidate."target_key", candidate."port"
|
|
312
|
+
FROM "canonical_candidates" candidate
|
|
313
|
+
WHERE EXISTS (
|
|
314
|
+
SELECT 1
|
|
315
|
+
FROM "port_conflicts" conflict
|
|
316
|
+
WHERE conflict."target_key" = candidate."target_key"
|
|
317
|
+
AND conflict."port" = candidate."port"
|
|
318
|
+
)
|
|
319
|
+
OR EXISTS (
|
|
320
|
+
SELECT 1
|
|
321
|
+
FROM "owner_conflicts" conflict
|
|
322
|
+
WHERE conflict."target_key" = candidate."target_key"
|
|
323
|
+
AND conflict."project_id" = candidate."project_id"
|
|
324
|
+
AND conflict."service_id" IS NOT DISTINCT FROM candidate."service_id"
|
|
325
|
+
AND conflict."container_port" IS NOT DISTINCT FROM candidate."container_port"
|
|
326
|
+
)
|
|
327
|
+
),
|
|
328
|
+
"final_claims" AS (
|
|
329
|
+
-- An unambiguous persisted claim keeps its real stable owner.
|
|
330
|
+
SELECT
|
|
331
|
+
candidate."id",
|
|
332
|
+
candidate."target_key",
|
|
333
|
+
candidate."port",
|
|
334
|
+
candidate."project_id",
|
|
335
|
+
candidate."service_id",
|
|
336
|
+
candidate."container_port"
|
|
337
|
+
FROM "canonical_candidates" candidate
|
|
338
|
+
WHERE NOT EXISTS (
|
|
339
|
+
SELECT 1
|
|
340
|
+
FROM "ambiguous_ports" ambiguous
|
|
341
|
+
WHERE ambiguous."target_key" = candidate."target_key"
|
|
342
|
+
AND ambiguous."port" = candidate."port"
|
|
343
|
+
)
|
|
344
|
+
|
|
345
|
+
UNION ALL
|
|
346
|
+
|
|
347
|
+
-- Ambiguity is fail-closed. The reserved identity cannot match a generated
|
|
348
|
+
-- project/service id, and container_port=port makes every owner tuple unique.
|
|
349
|
+
SELECT
|
|
350
|
+
'hpc_quarantine_' || ambiguous."target_key" || '_' || ambiguous."port"::text AS "id",
|
|
351
|
+
ambiguous."target_key",
|
|
352
|
+
ambiguous."port",
|
|
353
|
+
'__host_port_quarantine__' AS "project_id",
|
|
354
|
+
'__host_port_quarantine__' AS "service_id",
|
|
355
|
+
ambiguous."port" AS "container_port"
|
|
356
|
+
FROM "ambiguous_ports" ambiguous
|
|
357
|
+
)
|
|
358
|
+
INSERT INTO "host_port_claim" (
|
|
359
|
+
"id",
|
|
360
|
+
"target_key",
|
|
361
|
+
"port",
|
|
362
|
+
"project_id",
|
|
363
|
+
"service_id",
|
|
364
|
+
"container_port"
|
|
365
|
+
)
|
|
366
|
+
SELECT
|
|
367
|
+
claim."id",
|
|
368
|
+
claim."target_key",
|
|
369
|
+
claim."port",
|
|
370
|
+
claim."project_id",
|
|
371
|
+
claim."service_id",
|
|
372
|
+
claim."container_port"
|
|
373
|
+
FROM "final_claims" claim
|
|
374
|
+
ORDER BY
|
|
375
|
+
claim."target_key",
|
|
376
|
+
claim."port",
|
|
377
|
+
claim."project_id",
|
|
378
|
+
claim."service_id" NULLS FIRST,
|
|
379
|
+
claim."container_port" NULLS FIRST,
|
|
380
|
+
claim."id"
|
|
381
|
+
ON CONFLICT DO NOTHING;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
-- Separate a backup run's durable worker liveness from its public FSM outcome.
|
|
2
|
+
-- A timeout may record server_error while the original worker is still unwinding;
|
|
3
|
+
-- project deletion must keep waiting until that worker's outermost finally closes
|
|
4
|
+
-- this lease.
|
|
5
|
+
ALTER TABLE "backup_run"
|
|
6
|
+
ADD COLUMN "execution_started_at" timestamp,
|
|
7
|
+
ADD COLUMN "execution_finished_at" timestamp;
|
|
8
|
+
--> statement-breakpoint
|
|
9
|
+
CREATE INDEX "idx_backup_run_execution_in_flight"
|
|
10
|
+
ON "backup_run" ("project_id")
|
|
11
|
+
WHERE "execution_started_at" IS NOT NULL
|
|
12
|
+
AND "execution_finished_at" IS NULL;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
-- A parked migration can be resumed/cut over by any API replica. Persist the
|
|
2
|
+
-- winning callback's liveness separately from its public FSM status so project
|
|
3
|
+
-- deletion never mistakes an early terminal outcome for a stopped worker.
|
|
4
|
+
ALTER TABLE "docker_migration_run"
|
|
5
|
+
ADD COLUMN "execution_started_at" timestamp,
|
|
6
|
+
ADD COLUMN "execution_finished_at" timestamp;
|
|
7
|
+
--> statement-breakpoint
|
|
8
|
+
CREATE INDEX "idx_docker_migration_execution_in_flight"
|
|
9
|
+
ON "docker_migration_run" ("project_id")
|
|
10
|
+
WHERE "execution_started_at" IS NOT NULL
|
|
11
|
+
AND "execution_finished_at" IS NULL;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
-- Project deletion and deployment admission query the durable build-worker
|
|
2
|
+
-- lease, including after the deployment status has already become terminal.
|
|
3
|
+
CREATE INDEX "idx_build_session_live_project_deployment"
|
|
4
|
+
ON "build_session" ("project_id", "deployment_id")
|
|
5
|
+
WHERE "started_at" IS NOT NULL
|
|
6
|
+
AND "finished_at" IS NULL;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
-- GitHub App installations belong to an Kraft workspace, not to whichever
|
|
2
|
+
-- user happened to connect them. Keep the most recently reconciled legacy row
|
|
3
|
+
-- for each workspace/owner before installing the new uniqueness boundary.
|
|
4
|
+
ALTER TABLE "git_installation" ADD COLUMN IF NOT EXISTS "suspended_at" timestamp;
|
|
5
|
+
--> statement-breakpoint
|
|
6
|
+
|
|
7
|
+
WITH ranked AS (
|
|
8
|
+
SELECT
|
|
9
|
+
id,
|
|
10
|
+
row_number() OVER (
|
|
11
|
+
PARTITION BY provider, lower(owner), organization_id
|
|
12
|
+
ORDER BY updated_at DESC, created_at DESC, id DESC
|
|
13
|
+
) AS rn
|
|
14
|
+
FROM git_installation
|
|
15
|
+
)
|
|
16
|
+
DELETE FROM git_installation
|
|
17
|
+
WHERE id IN (SELECT id FROM ranked WHERE rn > 1);
|
|
18
|
+
--> statement-breakpoint
|
|
19
|
+
|
|
20
|
+
DROP INDEX IF EXISTS "uq_git_installation_provider_owner_user";
|
|
21
|
+
--> statement-breakpoint
|
|
22
|
+
|
|
23
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "uq_git_installation_provider_owner_org"
|
|
24
|
+
ON "git_installation" ("provider", "owner", "organization_id");
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
CREATE TABLE "git_source" (
|
|
2
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"organization_id" text NOT NULL,
|
|
4
|
+
"provider" text DEFAULT 'github' NOT NULL,
|
|
5
|
+
"name" text NOT NULL,
|
|
6
|
+
"app_id" integer NOT NULL,
|
|
7
|
+
"slug" text NOT NULL,
|
|
8
|
+
"client_id" text,
|
|
9
|
+
"app_name" text,
|
|
10
|
+
"avatar_url" text,
|
|
11
|
+
"api_base_url" text DEFAULT 'https://api.github.com' NOT NULL,
|
|
12
|
+
"web_base_url" text DEFAULT 'https://github.com' NOT NULL,
|
|
13
|
+
"webhook_url" text NOT NULL,
|
|
14
|
+
"secrets_enc" text NOT NULL,
|
|
15
|
+
"is_default" boolean DEFAULT false NOT NULL,
|
|
16
|
+
"status" text DEFAULT 'active' NOT NULL,
|
|
17
|
+
"last_verified_at" timestamp,
|
|
18
|
+
"last_error" text,
|
|
19
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
20
|
+
"updated_at" timestamp DEFAULT now() NOT NULL,
|
|
21
|
+
CONSTRAINT "git_source_organization_id_organization_id_fk"
|
|
22
|
+
FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id")
|
|
23
|
+
ON DELETE cascade ON UPDATE no action
|
|
24
|
+
);
|
|
25
|
+
--> statement-breakpoint
|
|
26
|
+
CREATE INDEX "idx_git_source_org_provider"
|
|
27
|
+
ON "git_source" USING btree ("organization_id", "provider");
|
|
28
|
+
--> statement-breakpoint
|
|
29
|
+
CREATE UNIQUE INDEX "uq_git_source_org_provider_name"
|
|
30
|
+
ON "git_source" USING btree ("organization_id", "provider", lower("name"));
|
|
31
|
+
--> statement-breakpoint
|
|
32
|
+
CREATE UNIQUE INDEX "uq_git_source_org_provider_app"
|
|
33
|
+
ON "git_source" USING btree ("organization_id", "provider", "api_base_url", "app_id");
|
|
34
|
+
--> statement-breakpoint
|
|
35
|
+
CREATE UNIQUE INDEX "uq_git_source_org_provider_default"
|
|
36
|
+
ON "git_source" USING btree ("organization_id", "provider")
|
|
37
|
+
WHERE "git_source"."is_default" = true;
|
|
38
|
+
--> statement-breakpoint
|
|
39
|
+
ALTER TABLE "git_installation" ADD COLUMN "source_id" text;
|
|
40
|
+
--> statement-breakpoint
|
|
41
|
+
ALTER TABLE "git_installation" ADD CONSTRAINT "git_installation_source_id_git_source_id_fk"
|
|
42
|
+
FOREIGN KEY ("source_id") REFERENCES "public"."git_source"("id")
|
|
43
|
+
ON DELETE cascade ON UPDATE no action;
|
|
44
|
+
--> statement-breakpoint
|
|
45
|
+
DROP INDEX IF EXISTS "uq_git_installation_provider_owner_org";
|
|
46
|
+
--> statement-breakpoint
|
|
47
|
+
CREATE UNIQUE INDEX "uq_git_installation_provider_owner_org_legacy"
|
|
48
|
+
ON "git_installation" USING btree ("provider", "owner", "organization_id")
|
|
49
|
+
WHERE "git_installation"."source_id" IS NULL;
|
|
50
|
+
--> statement-breakpoint
|
|
51
|
+
CREATE UNIQUE INDEX "uq_git_installation_provider_owner_org_source"
|
|
52
|
+
ON "git_installation" USING btree ("provider", "owner", "organization_id", "source_id")
|
|
53
|
+
WHERE "git_installation"."source_id" IS NOT NULL;
|
|
54
|
+
--> statement-breakpoint
|
|
55
|
+
CREATE INDEX "idx_git_installation_source"
|
|
56
|
+
ON "git_installation" USING btree ("source_id", "installation_id");
|
|
57
|
+
--> statement-breakpoint
|
|
58
|
+
ALTER TABLE "github_install_state" ADD COLUMN "source_id" text;
|
|
59
|
+
--> statement-breakpoint
|
|
60
|
+
ALTER TABLE "github_install_state" ADD COLUMN "flow" text DEFAULT 'install' NOT NULL;
|
|
61
|
+
--> statement-breakpoint
|
|
62
|
+
ALTER TABLE "github_install_state" ADD COLUMN "payload" jsonb DEFAULT '{}'::jsonb NOT NULL;
|
|
63
|
+
--> statement-breakpoint
|
|
64
|
+
ALTER TABLE "github_install_state" ADD CONSTRAINT "github_install_state_source_id_git_source_id_fk"
|
|
65
|
+
FOREIGN KEY ("source_id") REFERENCES "public"."git_source"("id")
|
|
66
|
+
ON DELETE cascade ON UPDATE no action;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
-- A project-default policy creates one child run per enabled service. Persist
|
|
2
|
+
-- the enqueue identity so read models can aggregate exact siblings without
|
|
3
|
+
-- co-mingling unrelated triggers that happened close together.
|
|
4
|
+
ALTER TABLE "backup_run" ADD COLUMN "batch_id" text;
|
|
5
|
+
--> statement-breakpoint
|
|
6
|
+
CREATE INDEX "idx_backup_run_policy_batch"
|
|
7
|
+
ON "backup_run" ("policy_id", "batch_id")
|
|
8
|
+
WHERE "batch_id" IS NOT NULL AND "deleted_at" IS NULL;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
-- Older route-sync writes could mark a new primary without clearing the old
|
|
2
|
+
-- one. Keep the most recently touched row: it is the best durable signal for
|
|
3
|
+
-- the user's last selection, with creation time and id as deterministic ties.
|
|
4
|
+
WITH ranked_primaries AS (
|
|
5
|
+
SELECT
|
|
6
|
+
"id",
|
|
7
|
+
row_number() OVER (
|
|
8
|
+
PARTITION BY "project_id"
|
|
9
|
+
ORDER BY "updated_at" DESC, "created_at" DESC, "id" DESC
|
|
10
|
+
) AS "rank"
|
|
11
|
+
FROM "domain"
|
|
12
|
+
WHERE "project_id" IS NOT NULL AND "is_primary" = true
|
|
13
|
+
)
|
|
14
|
+
UPDATE "domain"
|
|
15
|
+
SET "is_primary" = false, "updated_at" = now()
|
|
16
|
+
WHERE "id" IN (
|
|
17
|
+
SELECT "id" FROM ranked_primaries WHERE "rank" > 1
|
|
18
|
+
);
|
|
19
|
+
--> statement-breakpoint
|
|
20
|
+
-- Repository transactions make promotion orderly; this index makes the
|
|
21
|
+
-- invariant impossible to bypass through another writer or a concurrent race.
|
|
22
|
+
CREATE UNIQUE INDEX IF NOT EXISTS "uq_domain_project_primary"
|
|
23
|
+
ON "domain" ("project_id")
|
|
24
|
+
WHERE "is_primary" = true AND "project_id" IS NOT NULL;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
-- A routed workload may need a new loopback port while its previous route is
|
|
2
|
+
-- still live. Keep both claims through that make-before-break window; the
|
|
3
|
+
-- route-aware convergence pass removes the old claim only after a fresh edge
|
|
4
|
+
-- scan proves no vhost still dials it. The target/port unique index remains the
|
|
5
|
+
-- collision authority, so this does not permit two workloads to share a port.
|
|
6
|
+
DROP INDEX IF EXISTS "uq_host_port_claim_target_owner";
|
|
7
|
+
--> statement-breakpoint
|
|
8
|
+
CREATE INDEX IF NOT EXISTS "idx_host_port_claim_target_owner"
|
|
9
|
+
ON "host_port_claim" (
|
|
10
|
+
"target_key",
|
|
11
|
+
"project_id",
|
|
12
|
+
COALESCE("service_id", ''),
|
|
13
|
+
COALESCE("container_port", 0)
|
|
14
|
+
);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
-- Durable, bounded staging for browser imports and encrypted instance-to-instance
|
|
2
|
+
-- transfers. Sessions survive API worker changes/restarts; chunks cascade away
|
|
3
|
+
-- when the short-lived session is cleaned up.
|
|
4
|
+
CREATE TABLE "data_transfer_session" (
|
|
5
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
6
|
+
"kind" text NOT NULL,
|
|
7
|
+
"status" text DEFAULT 'ready' NOT NULL,
|
|
8
|
+
"mode" text,
|
|
9
|
+
"owner_user_id" text,
|
|
10
|
+
"token_hash" text,
|
|
11
|
+
"private_key" text,
|
|
12
|
+
"sender_public_key" text,
|
|
13
|
+
"claim_token" text,
|
|
14
|
+
"expected_bytes" bigint,
|
|
15
|
+
"expected_chunks" integer,
|
|
16
|
+
"result" jsonb,
|
|
17
|
+
"expires_at" timestamp NOT NULL,
|
|
18
|
+
"max_expires_at" timestamp NOT NULL,
|
|
19
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
20
|
+
"updated_at" timestamp DEFAULT now() NOT NULL,
|
|
21
|
+
CONSTRAINT "ck_data_transfer_session_kind" CHECK ("kind" IN ('direct', 'file')),
|
|
22
|
+
CONSTRAINT "ck_data_transfer_session_status" CHECK ("status" IN ('ready', 'uploading', 'consuming', 'complete', 'failed')),
|
|
23
|
+
CONSTRAINT "ck_data_transfer_session_mode" CHECK ("mode" IS NULL OR "mode" IN ('wipe', 'merge')),
|
|
24
|
+
CONSTRAINT "ck_data_transfer_session_expected_bytes" CHECK ("expected_bytes" IS NULL OR "expected_bytes" BETWEEN 1 AND 500000000),
|
|
25
|
+
CONSTRAINT "ck_data_transfer_session_expected_chunks" CHECK ("expected_chunks" IS NULL OR "expected_chunks" BETWEEN 1 AND 63)
|
|
26
|
+
);
|
|
27
|
+
--> statement-breakpoint
|
|
28
|
+
CREATE TABLE "data_transfer_chunk" (
|
|
29
|
+
"session_id" text NOT NULL,
|
|
30
|
+
"chunk_index" integer NOT NULL,
|
|
31
|
+
"bytes" bytea NOT NULL,
|
|
32
|
+
"byte_length" integer NOT NULL,
|
|
33
|
+
"sha256" text NOT NULL,
|
|
34
|
+
"created_at" timestamp DEFAULT now() NOT NULL,
|
|
35
|
+
CONSTRAINT "data_transfer_chunk_session_id_chunk_index_pk" PRIMARY KEY("session_id","chunk_index"),
|
|
36
|
+
CONSTRAINT "ck_data_transfer_chunk_index" CHECK ("chunk_index" BETWEEN 0 AND 62),
|
|
37
|
+
CONSTRAINT "ck_data_transfer_chunk_length" CHECK ("byte_length" BETWEEN 1 AND 8000064),
|
|
38
|
+
CONSTRAINT "ck_data_transfer_chunk_bytes" CHECK (octet_length("bytes") = "byte_length")
|
|
39
|
+
);
|
|
40
|
+
--> statement-breakpoint
|
|
41
|
+
ALTER TABLE "data_transfer_chunk" ADD CONSTRAINT "data_transfer_chunk_session_id_data_transfer_session_id_fk" FOREIGN KEY ("session_id") REFERENCES "public"."data_transfer_session"("id") ON DELETE cascade ON UPDATE no action;
|
|
42
|
+
--> statement-breakpoint
|
|
43
|
+
CREATE INDEX "data_transfer_session_expires_idx" ON "data_transfer_session" USING btree ("expires_at");
|
|
44
|
+
--> statement-breakpoint
|
|
45
|
+
CREATE INDEX "data_transfer_session_owner_idx" ON "data_transfer_session" USING btree ("owner_user_id");
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
-- Drop the hosted-cloud ("Kraft Cloud" / Oblien) infrastructure:
|
|
2
|
+
-- the project workspace binding, its uniqueness index, and the two
|
|
3
|
+
-- cloud-only tables (handoff codes + GitHub webhook bindings).
|
|
4
|
+
DROP INDEX IF EXISTS "uq_project_cloud_workspace_id";--> statement-breakpoint
|
|
5
|
+
ALTER TABLE "project" DROP COLUMN IF EXISTS "cloud_workspace_id";--> statement-breakpoint
|
|
6
|
+
DROP TABLE IF EXISTS "cloud_webhook_binding";--> statement-breakpoint
|
|
7
|
+
DROP TABLE IF EXISTS "cloud_handoff_code";
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
CREATE TABLE "mail_dmarc_report" (
|
|
2
|
+
"id" text PRIMARY KEY NOT NULL,
|
|
3
|
+
"server_id" text NOT NULL,
|
|
4
|
+
"organization_id" text NOT NULL,
|
|
5
|
+
"domain" text NOT NULL,
|
|
6
|
+
"reporter" text NOT NULL,
|
|
7
|
+
"report_id" text NOT NULL,
|
|
8
|
+
"date_begin" timestamp NOT NULL,
|
|
9
|
+
"date_end" timestamp NOT NULL,
|
|
10
|
+
"messages" integer DEFAULT 0 NOT NULL,
|
|
11
|
+
"dkim_pass" integer DEFAULT 0 NOT NULL,
|
|
12
|
+
"spf_pass" integer DEFAULT 0 NOT NULL,
|
|
13
|
+
"full_pass" integer DEFAULT 0 NOT NULL,
|
|
14
|
+
"records" jsonb DEFAULT '[]'::jsonb NOT NULL,
|
|
15
|
+
"created_at" timestamp DEFAULT now() NOT NULL
|
|
16
|
+
);
|
|
17
|
+
--> statement-breakpoint
|
|
18
|
+
ALTER TABLE "mail_dmarc_report" ADD CONSTRAINT "mail_dmarc_report_server_id_mail_servers_server_id_fk" FOREIGN KEY ("server_id") REFERENCES "public"."mail_servers"("server_id") ON DELETE cascade ON UPDATE no action;
|
|
19
|
+
--> statement-breakpoint
|
|
20
|
+
ALTER TABLE "mail_dmarc_report" ADD CONSTRAINT "mail_dmarc_report_organization_id_organization_id_fk" FOREIGN KEY ("organization_id") REFERENCES "public"."organization"("id") ON DELETE cascade ON UPDATE no action;
|
|
21
|
+
--> statement-breakpoint
|
|
22
|
+
CREATE UNIQUE INDEX "uq_mail_dmarc_report_stream" ON "mail_dmarc_report" USING btree ("server_id","reporter","report_id");--> statement-breakpoint
|
|
23
|
+
CREATE INDEX "idx_mail_dmarc_report_server_domain" ON "mail_dmarc_report" USING btree ("server_id","domain","date_end");
|