diff --git a/airflow/docker.go b/airflow/docker.go index 80d82e679..7f5cde6b3 100644 --- a/airflow/docker.go +++ b/airflow/docker.go @@ -91,7 +91,7 @@ func generateConfig(projectName, airflowHome string) (string, error) { AirflowImage: imageName(projectName, "latest"), AirflowHome: airflowHome, AirflowUser: "astro", - AirflowWebserverPort: "8080", + AirflowWebserverPort: config.CFG.WebserverPort.GetString(), } buff := new(bytes.Buffer) @@ -180,8 +180,8 @@ func Start(airflowHome string) error { return errors.Wrap(err, messages.COMPOSE_RECREATE_ERROR) } } - fmt.Println(messages.COMPOSE_LINK_WEBSERVER) - fmt.Println(messages.COMPOSE_LINK_POSTGRES) + fmt.Printf(messages.COMPOSE_LINK_WEBSERVER+"\n", config.CFG.WebserverPort.GetString()) + fmt.Printf(messages.COMPOSE_LINK_POSTGRES, config.CFG.PostgresPort.GetString()) return nil } diff --git a/airflow/include/composeyml.go b/airflow/include/composeyml.go index 0f5ac7822..8a958c07d 100644 --- a/airflow/include/composeyml.go +++ b/airflow/include/composeyml.go @@ -72,12 +72,15 @@ services: - scheduler - postgres environment: + AIRFLOW__WEBSERVER__WEB_SERVER_PORT: {{ .AirflowWebserverPort }} AIRFLOW__CORE__EXECUTOR: LocalExecutor AIRFLOW__CORE__SQL_ALCHEMY_CONN: postgresql://{{ .PostgresUser }}:{{ .PostgresPassword }}@{{ .PostgresHost }}:{{ .PostgresPort }} AIRFLOW__CORE__LOAD_EXAMPLES: "False" AIRFLOW__CORE__FERNET_KEY: "d6Vefz3G9U_ynXB3cr7y_Ak35tAHkEGAVxuz_B-jzWw=" ports: - {{ .AirflowWebserverPort }}:{{ .AirflowWebserverPort }} + expose: + - {{ .AirflowWebserverPort }} volumes: - {{ .AirflowHome }}/dags:/usr/local/airflow/dags:ro - {{ .AirflowHome }}/plugins:/usr/local/airflow/plugins:ro diff --git a/config/config.go b/config/config.go index a52dcfb9a..736d9225d 100644 --- a/config/config.go +++ b/config/config.go @@ -36,11 +36,11 @@ var ( // CFG Houses configuration meta CFG = cfgs{ - Contexts: newCfg("contexts", ""), CloudAPIProtocol: newCfg("cloud.api.protocol", "https"), CloudAPIPort: newCfg("cloud.api.port", "443"), CloudAPIToken: newCfg("cloud.api.token", ""), Context: newCfg("context", ""), + Contexts: newCfg("contexts", ""), LocalHouston: newCfg("local.houston", ""), LocalOrbit: newCfg("local.orbit", ""), PostgresUser: newCfg("postgres.user", "postgres"), @@ -50,6 +50,7 @@ var ( ProjectDeployment: newCfg("project.deployment", ""), ProjectName: newCfg("project.name", ""), ProjectWorkspace: newCfg("project.workspace", ""), + WebserverPort: newCfg("webserver.port", "8080"), } // viperHome is the viper object in the users home directory diff --git a/config/types.go b/config/types.go index 3aeaac32e..ce80349dd 100644 --- a/config/types.go +++ b/config/types.go @@ -8,11 +8,11 @@ type cfg struct { // cfgs houses all configurations for an astro project type cfgs struct { - Contexts cfg CloudAPIProtocol cfg CloudAPIPort cfg CloudAPIToken cfg Context cfg + Contexts cfg LocalEnabled cfg LocalHouston cfg LocalOrbit cfg @@ -23,6 +23,7 @@ type cfgs struct { ProjectName cfg ProjectDeployment cfg ProjectWorkspace cfg + WebserverPort cfg } // Creates a new cfg struct diff --git a/messages/messages.go b/messages/messages.go index 7a2c648b3..0495df870 100644 --- a/messages/messages.go +++ b/messages/messages.go @@ -38,8 +38,8 @@ var ( COMPOSE_PAUSE_ERROR = "Error pausing project containers" COMPOSE_RECREATE_ERROR = "Error building, (re)creating or starting project containers" COMPOSE_PUSHING_IMAGE_PROMPT = "Pushing image to Astronomer registry" - COMPOSE_LINK_WEBSERVER = "Airflow Webserver: http://localhost:8080/admin/" - COMPOSE_LINK_POSTGRES = "Postgres Database: localhost:5432/postgres" + COMPOSE_LINK_WEBSERVER = "Airflow Webserver: http://localhost:%s/admin/" + COMPOSE_LINK_POSTGRES = "Postgres Database: localhost:%s/postgres" HOUSTON_BASIC_AUTH_DISABLED = "Basic authentication is disabled, conact administrator or defer back to oAuth" HOUSTON_DEPLOYMENT_HEADER = "Authenticated to %s \n\n"