@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,517 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
":" //# ; exec "$(command -v node || command -v bun)" "$0" "$@"
|
|
3
|
+
import { createRequire as __ospCreateRequire } from "node:module";
|
|
4
|
+
const require = __ospCreateRequire(import.meta.url);
|
|
5
|
+
import {
|
|
6
|
+
COMPONENT_CHECKS,
|
|
7
|
+
COMPONENT_INSTALLERS,
|
|
8
|
+
checkAll,
|
|
9
|
+
checkComponents
|
|
10
|
+
} from "./chunk-THTEUDBC.js";
|
|
11
|
+
|
|
12
|
+
// ../../packages/adapters/src/system/requirements.ts
|
|
13
|
+
var REMOTE_SERVER_REQUIRED_COMPONENTS = ["docker", "git"];
|
|
14
|
+
var SYSTEM_COMPONENT_DEPENDENCIES = {
|
|
15
|
+
// The managed edge is always the kraft-edge container. There is no
|
|
16
|
+
// host-OpenResty fallback, so Docker must be ready before any edge image work.
|
|
17
|
+
edge: ["docker"]
|
|
18
|
+
};
|
|
19
|
+
function getSystemComponentDependencies(name) {
|
|
20
|
+
return SYSTEM_COMPONENT_DEPENDENCIES[name] ?? [];
|
|
21
|
+
}
|
|
22
|
+
function resolveSystemComponentInstallPlan(requested) {
|
|
23
|
+
const ordered = [];
|
|
24
|
+
const resolved = /* @__PURE__ */ new Set();
|
|
25
|
+
const visiting = /* @__PURE__ */ new Set();
|
|
26
|
+
const visit = (name) => {
|
|
27
|
+
if (resolved.has(name)) return;
|
|
28
|
+
if (visiting.has(name)) {
|
|
29
|
+
throw new Error(`Cyclic system component dependency involving "${name}"`);
|
|
30
|
+
}
|
|
31
|
+
visiting.add(name);
|
|
32
|
+
for (const dependency of getSystemComponentDependencies(name))
|
|
33
|
+
visit(dependency);
|
|
34
|
+
visiting.delete(name);
|
|
35
|
+
resolved.add(name);
|
|
36
|
+
ordered.push(name);
|
|
37
|
+
};
|
|
38
|
+
for (const name of requested) visit(name);
|
|
39
|
+
return ordered;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// ../../packages/adapters/src/system/state.ts
|
|
43
|
+
var DEFAULT_STATE_PATH = "/etc/kraft/setup-state.json";
|
|
44
|
+
var FileStateStore = class {
|
|
45
|
+
statePath;
|
|
46
|
+
executor;
|
|
47
|
+
constructor(executor, statePath) {
|
|
48
|
+
this.executor = executor;
|
|
49
|
+
this.statePath = statePath ?? DEFAULT_STATE_PATH;
|
|
50
|
+
}
|
|
51
|
+
async get() {
|
|
52
|
+
try {
|
|
53
|
+
const exists = await this.executor.exists(this.statePath);
|
|
54
|
+
if (!exists) return null;
|
|
55
|
+
const content = await this.executor.readFile(this.statePath);
|
|
56
|
+
return JSON.parse(content);
|
|
57
|
+
} catch {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async set(state) {
|
|
62
|
+
const content = JSON.stringify(state, null, 2);
|
|
63
|
+
await this.executor.writeFile(this.statePath, content);
|
|
64
|
+
}
|
|
65
|
+
async clear() {
|
|
66
|
+
await this.executor.rm(this.statePath);
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
// ../../packages/adapters/src/system/setup.ts
|
|
71
|
+
var CACHE_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
72
|
+
function resolveRules(mode) {
|
|
73
|
+
if (mode === "docker") {
|
|
74
|
+
return [
|
|
75
|
+
{
|
|
76
|
+
feature: "build",
|
|
77
|
+
requires: ["git", "docker"],
|
|
78
|
+
message: "Build requires Git and Docker"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
feature: "deploy",
|
|
82
|
+
requires: ["docker"],
|
|
83
|
+
message: "Deploy requires Docker"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
feature: "routing",
|
|
87
|
+
requires: ["edge"],
|
|
88
|
+
message: "Routing requires the edge"
|
|
89
|
+
},
|
|
90
|
+
{ feature: "ssl", requires: ["edge"], message: "SSL requires the edge" }
|
|
91
|
+
];
|
|
92
|
+
}
|
|
93
|
+
return [
|
|
94
|
+
{ feature: "build", requires: ["git"], message: "Build requires Git" },
|
|
95
|
+
{
|
|
96
|
+
feature: "routing",
|
|
97
|
+
requires: ["edge"],
|
|
98
|
+
message: "Routing requires the edge"
|
|
99
|
+
},
|
|
100
|
+
{ feature: "ssl", requires: ["edge"], message: "SSL requires the edge" }
|
|
101
|
+
];
|
|
102
|
+
}
|
|
103
|
+
function resolveRequired() {
|
|
104
|
+
return resolveSystemComponentInstallPlan([
|
|
105
|
+
...REMOTE_SERVER_REQUIRED_COMPONENTS,
|
|
106
|
+
"edge"
|
|
107
|
+
]);
|
|
108
|
+
}
|
|
109
|
+
var SystemManager = class {
|
|
110
|
+
mode;
|
|
111
|
+
executor;
|
|
112
|
+
rules;
|
|
113
|
+
required;
|
|
114
|
+
stateStore;
|
|
115
|
+
installerConfig;
|
|
116
|
+
provisionLock;
|
|
117
|
+
assumeInstalled;
|
|
118
|
+
/** In-memory cache to avoid even reading from disk/DB on hot paths. */
|
|
119
|
+
cachedState = null;
|
|
120
|
+
/** In-flight background re-verification, if any (see kickBackgroundVerify). */
|
|
121
|
+
verifyInFlight = null;
|
|
122
|
+
constructor(mode, opts) {
|
|
123
|
+
this.mode = mode;
|
|
124
|
+
this.executor = opts.executor;
|
|
125
|
+
this.rules = resolveRules(mode);
|
|
126
|
+
this.required = resolveRequired();
|
|
127
|
+
this.stateStore = opts.stateStore ?? new FileStateStore(opts.executor);
|
|
128
|
+
this.installerConfig = opts.installerConfig ?? {};
|
|
129
|
+
this.provisionLock = opts.provisionLock;
|
|
130
|
+
this.assumeInstalled = opts.assumeInstalled ?? false;
|
|
131
|
+
}
|
|
132
|
+
// ── Fast-path state queries (cached) ─────────────────────────────────
|
|
133
|
+
/**
|
|
134
|
+
* Is the server fully set up? Reads from cache - never runs checks.
|
|
135
|
+
*
|
|
136
|
+
* Returns false if:
|
|
137
|
+
* - No cached state (first boot)
|
|
138
|
+
* - Cached state says setupComplete = false
|
|
139
|
+
*
|
|
140
|
+
* A stale cache (> 24h) still answers true, with a re-verification kicked behind
|
|
141
|
+
* the call — this must never block.
|
|
142
|
+
*
|
|
143
|
+
* Use this on hot paths (every request). It's essentially free.
|
|
144
|
+
*/
|
|
145
|
+
async isReady() {
|
|
146
|
+
const state = await this.loadState();
|
|
147
|
+
if (!state?.setupComplete) return false;
|
|
148
|
+
if (this.isStale(state)) this.kickBackgroundVerify();
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Get the cached setup state without running any checks.
|
|
153
|
+
* Returns null if no state has been stored yet.
|
|
154
|
+
*/
|
|
155
|
+
async getState() {
|
|
156
|
+
return this.loadState();
|
|
157
|
+
}
|
|
158
|
+
// ── Status checks (run on demand) ────────────────────────────────────
|
|
159
|
+
/**
|
|
160
|
+
* Check all registered components - runs actual system commands.
|
|
161
|
+
* Updates the cached state with fresh results.
|
|
162
|
+
*/
|
|
163
|
+
async checkAll() {
|
|
164
|
+
const components = await checkAll(this.executor);
|
|
165
|
+
const missing = components.filter((c) => this.required.includes(c.name) && !c.healthy).map((c) => c.name);
|
|
166
|
+
await this.updateStateFromChecks(components);
|
|
167
|
+
return { components, ready: missing.length === 0, missing };
|
|
168
|
+
}
|
|
169
|
+
/** Check only the components required for this runtime mode. */
|
|
170
|
+
async checkRequired() {
|
|
171
|
+
const components = await checkComponents(this.executor, this.required);
|
|
172
|
+
const missing = components.filter((c) => !c.healthy).map((c) => c.name);
|
|
173
|
+
await this.updateStateFromChecks(components);
|
|
174
|
+
return { components, ready: missing.length === 0, missing };
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Check whether a specific feature is ready.
|
|
178
|
+
*
|
|
179
|
+
* Fast path: if cached state shows all prerequisites installed,
|
|
180
|
+
* returns immediately without running system commands.
|
|
181
|
+
*/
|
|
182
|
+
async checkFeature(feature) {
|
|
183
|
+
if (this.assumeInstalled) {
|
|
184
|
+
return {
|
|
185
|
+
feature,
|
|
186
|
+
ready: true,
|
|
187
|
+
missing: [],
|
|
188
|
+
message: `${feature} assumed installed`
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
const rule = this.rules.find((r) => r.feature === feature);
|
|
192
|
+
if (!rule) {
|
|
193
|
+
return {
|
|
194
|
+
feature,
|
|
195
|
+
ready: true,
|
|
196
|
+
missing: [],
|
|
197
|
+
message: `No prerequisites for "${feature}"`
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
const required = resolveSystemComponentInstallPlan(rule.requires);
|
|
201
|
+
const state = await this.loadState();
|
|
202
|
+
if (state?.setupComplete) {
|
|
203
|
+
const allPresent = required.every(
|
|
204
|
+
(name) => state.components[name]?.healthy === true
|
|
205
|
+
);
|
|
206
|
+
if (allPresent) {
|
|
207
|
+
if (this.isStale(state)) this.kickBackgroundVerify();
|
|
208
|
+
return {
|
|
209
|
+
feature,
|
|
210
|
+
ready: true,
|
|
211
|
+
missing: [],
|
|
212
|
+
message: `${feature} is ready`
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
const statuses = await checkComponents(this.executor, required);
|
|
217
|
+
const unhealthy = statuses.filter((s) => !s.healthy);
|
|
218
|
+
return {
|
|
219
|
+
feature,
|
|
220
|
+
ready: unhealthy.length === 0,
|
|
221
|
+
missing: unhealthy,
|
|
222
|
+
message: unhealthy.length === 0 ? `${feature} is ready` : `${rule.message} - missing: ${unhealthy.map((s) => s.name).join(", ")}`
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Require a feature to be ready, or throw.
|
|
227
|
+
*
|
|
228
|
+
* Fast path reads cached state. Use before operations:
|
|
229
|
+
* await system.requireFeature("deploy");
|
|
230
|
+
*/
|
|
231
|
+
async requireFeature(feature) {
|
|
232
|
+
const readiness = await this.checkFeature(feature);
|
|
233
|
+
if (!readiness.ready) {
|
|
234
|
+
throw new Error(readiness.message);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Ensure a feature is ready: check prerequisites, install missing ones, re-validate.
|
|
239
|
+
*
|
|
240
|
+
* This is the operational path used by deploy/build flows when they can safely
|
|
241
|
+
* self-heal missing system components instead of hard-failing immediately.
|
|
242
|
+
*/
|
|
243
|
+
async ensureFeature(feature, onLog, config) {
|
|
244
|
+
if (this.assumeInstalled) return;
|
|
245
|
+
const logFn = onLog ?? (() => {
|
|
246
|
+
});
|
|
247
|
+
const installerConfig = config ?? this.installerConfig;
|
|
248
|
+
const readiness = await this.checkFeature(feature);
|
|
249
|
+
if (readiness.ready) return;
|
|
250
|
+
await this.ensureNamedComponents(
|
|
251
|
+
readiness.missing.map((component) => component.name),
|
|
252
|
+
logFn,
|
|
253
|
+
installerConfig,
|
|
254
|
+
`Checking required system components for ${feature}...`,
|
|
255
|
+
(names) => `${this.rules.find((rule) => rule.feature === feature)?.message ?? feature} - missing: ${names.join(", ")}`
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
async ensureComponents(names, onLog, config) {
|
|
259
|
+
if (this.assumeInstalled) return;
|
|
260
|
+
const logFn = onLog ?? (() => {
|
|
261
|
+
});
|
|
262
|
+
const installerConfig = config ?? this.installerConfig;
|
|
263
|
+
await this.ensureNamedComponents(
|
|
264
|
+
names,
|
|
265
|
+
logFn,
|
|
266
|
+
installerConfig,
|
|
267
|
+
"Checking required system components...",
|
|
268
|
+
(missingNames) => `Required components are still not ready: ${missingNames.join(", ")}`
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
// ── Installation ─────────────────────────────────────────────────────
|
|
272
|
+
/**
|
|
273
|
+
* Install a single component with streamed logs.
|
|
274
|
+
*/
|
|
275
|
+
async installComponent(name, onLog) {
|
|
276
|
+
const logFn = onLog ?? (() => {
|
|
277
|
+
});
|
|
278
|
+
return this.runInstaller(name, logFn, this.installerConfig);
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Full setup: check → install missing → validate → cache state.
|
|
282
|
+
*
|
|
283
|
+
* This is the main provisioning entrypoint called from the dashboard
|
|
284
|
+
* setup wizard. The InstallerConfig should be pre-collected from the
|
|
285
|
+
* user (ACME email, domain, etc.) before calling this.
|
|
286
|
+
*/
|
|
287
|
+
async setup(onLog, config) {
|
|
288
|
+
const logFn = onLog ?? (() => {
|
|
289
|
+
});
|
|
290
|
+
const installerConfig = config ?? this.installerConfig;
|
|
291
|
+
logFn(info(`Starting ${this.mode} server setup...`));
|
|
292
|
+
logFn(info(`Required components: ${this.required.join(", ")}`));
|
|
293
|
+
logFn(info("Checking installed components..."));
|
|
294
|
+
const initial = await this.checkRequired();
|
|
295
|
+
const alreadyInstalled = initial.components.filter((c) => c.healthy).map((c) => c.name);
|
|
296
|
+
if (alreadyInstalled.length > 0) {
|
|
297
|
+
logFn(info(`Already installed: ${alreadyInstalled.join(", ")}`));
|
|
298
|
+
}
|
|
299
|
+
if (initial.ready) {
|
|
300
|
+
logFn(info("All components are already installed - nothing to do"));
|
|
301
|
+
await this.markSetupComplete();
|
|
302
|
+
return {
|
|
303
|
+
installed: [],
|
|
304
|
+
skipped: alreadyInstalled,
|
|
305
|
+
failed: [],
|
|
306
|
+
ready: true
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
logFn(info(`Missing: ${initial.missing.join(", ")}`));
|
|
310
|
+
const { installed, failed } = await this.installMany(
|
|
311
|
+
initial.missing,
|
|
312
|
+
logFn,
|
|
313
|
+
installerConfig,
|
|
314
|
+
false
|
|
315
|
+
);
|
|
316
|
+
logFn(info("\nValidating installation..."));
|
|
317
|
+
const final = await this.checkRequired();
|
|
318
|
+
if (final.ready) {
|
|
319
|
+
logFn(info("Server setup complete - all components healthy"));
|
|
320
|
+
await this.markSetupComplete();
|
|
321
|
+
} else {
|
|
322
|
+
logFn({
|
|
323
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
324
|
+
message: `Setup incomplete - still missing: ${final.missing.join(", ")}`,
|
|
325
|
+
level: "warn"
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
return {
|
|
329
|
+
installed,
|
|
330
|
+
skipped: alreadyInstalled,
|
|
331
|
+
failed,
|
|
332
|
+
ready: final.ready
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
// ── State management ─────────────────────────────────────────────────
|
|
336
|
+
/**
|
|
337
|
+
* Invalidate the cached state.
|
|
338
|
+
*
|
|
339
|
+
* Call this when an operation fails because a component is missing
|
|
340
|
+
* (e.g., Docker daemon went down). The next `isReady()` call will
|
|
341
|
+
* return false, and `requireFeature()` will re-check.
|
|
342
|
+
*/
|
|
343
|
+
async invalidate() {
|
|
344
|
+
this.cachedState = null;
|
|
345
|
+
await this.stateStore.clear();
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Force re-verification: run all checks and update state.
|
|
349
|
+
* Called automatically when cache is stale, or manually by the user.
|
|
350
|
+
*/
|
|
351
|
+
async verify() {
|
|
352
|
+
const result = await this.checkAll();
|
|
353
|
+
return result;
|
|
354
|
+
}
|
|
355
|
+
// ── Utilities ────────────────────────────────────────────────────────
|
|
356
|
+
getRules() {
|
|
357
|
+
return [...this.rules];
|
|
358
|
+
}
|
|
359
|
+
getRequired() {
|
|
360
|
+
return [...this.required];
|
|
361
|
+
}
|
|
362
|
+
// ── Internal state helpers ───────────────────────────────────────────
|
|
363
|
+
async loadState() {
|
|
364
|
+
if (this.cachedState) return this.cachedState;
|
|
365
|
+
this.cachedState = await this.stateStore.get();
|
|
366
|
+
return this.cachedState;
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Run the staleness re-verification behind the caller — one at a time.
|
|
370
|
+
*
|
|
371
|
+
* The dedup is the point: a single deploy gates several features in a row, and
|
|
372
|
+
* every request calls isReady(), so an un-guarded kick would stack one full
|
|
373
|
+
* checkAll per call — each fanning 4 concurrent probes onto the same ssh
|
|
374
|
+
* connection, against sshd's MaxSessions (see mapWithConcurrency in checks.ts).
|
|
375
|
+
*/
|
|
376
|
+
kickBackgroundVerify() {
|
|
377
|
+
if (this.verifyInFlight) return;
|
|
378
|
+
this.verifyInFlight = this.verify().catch(() => {
|
|
379
|
+
}).finally(() => {
|
|
380
|
+
this.verifyInFlight = null;
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
isStale(state) {
|
|
384
|
+
if (!state.lastVerifiedAt) return true;
|
|
385
|
+
const age = Date.now() - new Date(state.lastVerifiedAt).getTime();
|
|
386
|
+
return age > CACHE_TTL_MS;
|
|
387
|
+
}
|
|
388
|
+
async updateStateFromChecks(components) {
|
|
389
|
+
const existing = await this.loadState() ?? this.emptyState();
|
|
390
|
+
for (const c of components) {
|
|
391
|
+
existing.components[c.name] = {
|
|
392
|
+
installed: c.installed,
|
|
393
|
+
version: c.version,
|
|
394
|
+
running: c.running,
|
|
395
|
+
healthy: c.healthy,
|
|
396
|
+
installedAt: existing.components[c.name]?.installedAt
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
const allRequired = this.required.every(
|
|
400
|
+
(name) => existing.components[name]?.installed
|
|
401
|
+
);
|
|
402
|
+
existing.setupComplete = allRequired;
|
|
403
|
+
const checked = new Set(components.map((c) => c.name));
|
|
404
|
+
const coveredAll = this.required.every(
|
|
405
|
+
(name) => checked.has(name) || !COMPONENT_CHECKS[name]
|
|
406
|
+
);
|
|
407
|
+
if (coveredAll) {
|
|
408
|
+
existing.lastVerifiedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
409
|
+
}
|
|
410
|
+
existing.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
411
|
+
this.cachedState = existing;
|
|
412
|
+
await this.stateStore.set(existing);
|
|
413
|
+
}
|
|
414
|
+
async markComponentInstalled(name, version) {
|
|
415
|
+
const state = await this.loadState() ?? this.emptyState();
|
|
416
|
+
state.components[name] = {
|
|
417
|
+
installed: true,
|
|
418
|
+
version,
|
|
419
|
+
healthy: false,
|
|
420
|
+
installedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
421
|
+
};
|
|
422
|
+
state.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
423
|
+
this.cachedState = state;
|
|
424
|
+
await this.stateStore.set(state);
|
|
425
|
+
}
|
|
426
|
+
async markSetupComplete() {
|
|
427
|
+
const state = await this.loadState() ?? this.emptyState();
|
|
428
|
+
state.setupComplete = true;
|
|
429
|
+
state.lastVerifiedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
430
|
+
state.updatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
431
|
+
this.cachedState = state;
|
|
432
|
+
await this.stateStore.set(state);
|
|
433
|
+
}
|
|
434
|
+
emptyState() {
|
|
435
|
+
return {
|
|
436
|
+
setupComplete: false,
|
|
437
|
+
mode: this.mode,
|
|
438
|
+
components: {},
|
|
439
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
440
|
+
};
|
|
441
|
+
}
|
|
442
|
+
async runInstaller(name, logFn, installerConfig) {
|
|
443
|
+
const installer = COMPONENT_INSTALLERS[name];
|
|
444
|
+
if (!installer) {
|
|
445
|
+
logFn(info(`No installer available for "${name}"`));
|
|
446
|
+
return {
|
|
447
|
+
component: name,
|
|
448
|
+
success: false,
|
|
449
|
+
error: `No installer for "${name}"`
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
const result = await installer(this.executor, logFn, installerConfig);
|
|
453
|
+
if (result.success) {
|
|
454
|
+
await this.markComponentInstalled(name, result.version);
|
|
455
|
+
}
|
|
456
|
+
return result;
|
|
457
|
+
}
|
|
458
|
+
async installMany(names, logFn, installerConfig, stopOnFailure) {
|
|
459
|
+
const installed = [];
|
|
460
|
+
const failed = [];
|
|
461
|
+
for (const name of names) {
|
|
462
|
+
logFn(info(`
|
|
463
|
+
\u2500\u2500 Installing ${name} ${"\u2500".repeat(50)}`));
|
|
464
|
+
const result = await this.runInstaller(name, logFn, installerConfig);
|
|
465
|
+
if (result.success) {
|
|
466
|
+
installed.push(result);
|
|
467
|
+
continue;
|
|
468
|
+
}
|
|
469
|
+
failed.push(result);
|
|
470
|
+
logFn(info(`Failed to install ${name}: ${result.error}`));
|
|
471
|
+
if (stopOnFailure) break;
|
|
472
|
+
}
|
|
473
|
+
return { installed, failed };
|
|
474
|
+
}
|
|
475
|
+
async ensureNamedComponents(names, logFn, installerConfig, heading, errorMessage) {
|
|
476
|
+
const required = resolveSystemComponentInstallPlan(names);
|
|
477
|
+
const critical = async () => {
|
|
478
|
+
const statuses = await checkComponents(this.executor, required);
|
|
479
|
+
const missing = statuses.filter((status) => !status.healthy);
|
|
480
|
+
if (missing.length === 0) {
|
|
481
|
+
await this.updateStateFromChecks(statuses);
|
|
482
|
+
return;
|
|
483
|
+
}
|
|
484
|
+
logFn(info(heading));
|
|
485
|
+
logFn(
|
|
486
|
+
info(
|
|
487
|
+
`Missing: ${missing.map((component) => component.name).join(", ")}`
|
|
488
|
+
)
|
|
489
|
+
);
|
|
490
|
+
const { failed } = await this.installMany(
|
|
491
|
+
missing.map((component) => component.name),
|
|
492
|
+
logFn,
|
|
493
|
+
installerConfig,
|
|
494
|
+
true
|
|
495
|
+
);
|
|
496
|
+
if (failed.length > 0) {
|
|
497
|
+
throw new Error(
|
|
498
|
+
failed[0].error ?? `Failed to install ${failed[0].component}`
|
|
499
|
+
);
|
|
500
|
+
}
|
|
501
|
+
const recheck = await checkComponents(this.executor, required);
|
|
502
|
+
await this.updateStateFromChecks(recheck);
|
|
503
|
+
const unhealthy = recheck.filter((status) => !status.healthy);
|
|
504
|
+
if (unhealthy.length > 0) {
|
|
505
|
+
throw new Error(errorMessage(unhealthy.map((status) => status.name)));
|
|
506
|
+
}
|
|
507
|
+
};
|
|
508
|
+
return this.provisionLock ? this.provisionLock.run(critical) : critical();
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
function info(message) {
|
|
512
|
+
return { timestamp: (/* @__PURE__ */ new Date()).toISOString(), message, level: "info" };
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
export {
|
|
516
|
+
SystemManager
|
|
517
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
":" //# ; exec "$(command -v node || command -v bun)" "$0" "$@"
|
|
3
|
+
import { createRequire as __ospCreateRequire } from "node:module";
|
|
4
|
+
const require = __ospCreateRequire(import.meta.url);
|
|
5
|
+
|
|
6
|
+
// ../../packages/adapters/src/system/edge-exec-error.ts
|
|
7
|
+
var EDGE_DOWN_MARKER = "the edge container is not running";
|
|
8
|
+
function isEdgeDownFailure(text) {
|
|
9
|
+
return /is restarting, wait until the container is running/i.test(text) || /container .* is not running/i.test(text) || /\bis not running\b/i.test(text) || /No such container/i.test(text) || /container .* is paused/i.test(text) || /invalid PID number/i.test(text);
|
|
10
|
+
}
|
|
11
|
+
function explainEdgeDown(opts) {
|
|
12
|
+
const { container, status, reason } = opts;
|
|
13
|
+
const state = status?.trim() ? ` (${status.trim()})` : "";
|
|
14
|
+
const crashLooping = status?.trim() === "restarting";
|
|
15
|
+
const consequence = crashLooping ? `it is crash-looping, so nothing that runs through the edge on this server can work \u2014 certificate issuance, config reloads and route changes all go through it` : `nothing that runs through the edge on this server can work until it is up \u2014 certificate issuance, config reloads and route changes all go through it`;
|
|
16
|
+
const cause = reason?.trim() ? `OpenResty is refusing to start: ${reason.trim().replace(/\s+/g, " ")}. Fix that, then \`docker start ${container}\` and retry.` : `Run \`docker logs --tail 40 ${container}\` on the server for the reason, then retry.`;
|
|
17
|
+
return `${EDGE_DOWN_MARKER} ("${container}")${state} \u2014 ${consequence}. ${cause}`;
|
|
18
|
+
}
|
|
19
|
+
function edgeDownExplanation(text) {
|
|
20
|
+
if (!text) return null;
|
|
21
|
+
const line = text.split("\n").map((l) => l.trim()).find((l) => l.includes(EDGE_DOWN_MARKER));
|
|
22
|
+
return line || null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export {
|
|
26
|
+
isEdgeDownFailure,
|
|
27
|
+
explainEdgeDown,
|
|
28
|
+
edgeDownExplanation
|
|
29
|
+
};
|