MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / mainEntryClickHouseDockerInit

Function mainEntryClickHouseDockerInit

programs/docker-init/docker-init.cpp:767–1078  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

765
766int mainEntryClickHouseDockerInit(int argc, char ** argv);
767int mainEntryClickHouseDockerInit(int argc, char ** argv)
768{
769 g_clickhouse_binary = (argc > 0 && argv[0][0] != '\0') ? argv[0] : "clickhouse";
770
771 bool keeper_mode = false;
772 bool show_help = false;
773 bool separator_seen = false;
774 std::vector<std::string> extra_args;
775
776 for (int i = 1; i < argc; ++i)
777 {
778 std::string_view arg = argv[i];
779
780 if (!separator_seen && (arg == "--help" || arg == "-h"))
781 {
782 show_help = true;
783 break;
784 }
785 else if (!separator_seen && arg == "--keeper")
786 keeper_mode = true;
787 else if (!separator_seen && arg == "--")
788 separator_seen = true;
789 else
790 extra_args.emplace_back(arg);
791 }
792
793 if (show_help)
794 {
795 std::cout
796 << "Usage: clickhouse docker-init [--keeper] [-- <extra-args>...]\n"
797 "Docker entrypoint for distroless ClickHouse images.\n"
798 "\nOptions:\n"
799 " --keeper Start ClickHouse Keeper instead of server\n"
800 " --help Show this help message\n"
801 "\nEnvironment variables (server mode):\n"
802 " CLICKHOUSE_CONFIG Path to config file "
803 "(default: /etc/clickhouse-server/config.xml)\n"
804 " CLICKHOUSE_RUN_AS_ROOT Run as root (0/1)\n"
805 " CLICKHOUSE_DO_NOT_CHOWN Skip chown operations (0/1)\n"
806 " CLICKHOUSE_UID Override UID to run as\n"
807 " CLICKHOUSE_GID Override GID to run as\n"
808 " CLICKHOUSE_USER Default user name (default: default)\n"
809 " CLICKHOUSE_PASSWORD Default user password\n"
810 " CLICKHOUSE_PASSWORD_FILE File containing password\n"
811 " CLICKHOUSE_DB Database to create on init\n"
812 " CLICKHOUSE_DEFAULT_ACCESS_MANAGEMENT Enable access management (0/1)\n"
813 " CLICKHOUSE_SKIP_USER_SETUP Skip user setup (0/1)\n"
814 " CLICKHOUSE_ALWAYS_RUN_INITDB_SCRIPTS Always run init scripts\n"
815 " CLICKHOUSE_INIT_TIMEOUT Max retries for server readiness (default: 1000)\n"
816 " CLICKHOUSE_WATCHDOG_ENABLE Enable watchdog (default: 0)\n"
817 "\nEnvironment variables (keeper mode):\n"
818 " KEEPER_CONFIG Path to keeper config file\n"
819 " CLICKHOUSE_DATA_DIR Data directory (default: /var/lib/clickhouse)\n"
820 " LOG_DIR Log directory (default: /var/log/clickhouse-keeper)\n";
821 return 0;
822 }
823
824 /// --- Passthrough mode ---

Callers

nothing calls this directly

Calls 15

buildArgvFunction · 0.85
getEnvFunction · 0.85
createDirectoryAndChownFunction · 0.85
chdirFunction · 0.85
extractConfigValueFunction · 0.85
extractConfigValuesFunction · 0.85
manageClickHouseUserFunction · 0.85
initClickHouseDBFunction · 0.85
parent_pathMethod · 0.80
sigactionClass · 0.70
findFunction · 0.50
to_stringFunction · 0.50

Tested by

no test coverage detected