()
| 789 | |
| 790 | |
| 791 | def main() -> None: |
| 792 | global _fg_compose_workdir |
| 793 | |
| 794 | args = parse_args() |
| 795 | |
| 796 | workdir = Path(args.workdir) if args.workdir else Path.cwd() / "onlyboxes" |
| 797 | workdir = workdir.resolve() |
| 798 | |
| 799 | tag = args.tag |
| 800 | if not tag: |
| 801 | info("Resolving latest release tag from GitHub...") |
| 802 | tag = resolve_latest_tag() |
| 803 | info(f"Latest release tag: {tag}") |
| 804 | http_port = args.console_http_port |
| 805 | grpc_port = args.console_grpc_port |
| 806 | |
| 807 | admin_password = generate_password() |
| 808 | hash_key = generate_hash_key() |
| 809 | api_key = "obxk_" + secrets.token_hex(32) |
| 810 | |
| 811 | sc = StepCounter() |
| 812 | |
| 813 | print_banner() |
| 814 | |
| 815 | # --- Step: Environment detection --- |
| 816 | sc.next("Environment detection") |
| 817 | plan = detect_environment(args) |
| 818 | |
| 819 | # --- Execution plan summary --- |
| 820 | print(f""" |
| 821 | {'=' * 56} |
| 822 | Execution Plan |
| 823 | {'=' * 56} |
| 824 | |
| 825 | Tag: {tag} |
| 826 | Workdir: {workdir} |
| 827 | HTTP port: {http_port} |
| 828 | gRPC port: {grpc_port} |
| 829 | |
| 830 | Console: {plan.console_start} |
| 831 | Worker runtime: {plan.worker_runtime} |
| 832 | Worker: {plan.worker_start} |
| 833 | """) |
| 834 | |
| 835 | if not args.yes and sys.stdin.isatty(): |
| 836 | try: |
| 837 | answer = input("Proceed? [Y/n] ").strip().lower() |
| 838 | except (EOFError, KeyboardInterrupt): |
| 839 | print() |
| 840 | sys.exit(1) |
| 841 | if answer and answer not in ("y", "yes"): |
| 842 | print("Aborted.") |
| 843 | sys.exit(0) |
| 844 | |
| 845 | # --- Step: Prepare working directory --- |
| 846 | sc.next("Prepare working directory") |
| 847 | prepare_workdir(workdir, plan) |
| 848 |
no test coverage detected