Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 58 additions & 60 deletions check-prereqs
Original file line number Diff line number Diff line change
Expand Up @@ -7,114 +7,112 @@ printf "See https://github.com/Worklytics/psoxy#prerequisites for more informati

HOMEBREW_AVAILABLE=`brew -v &> /dev/null`

RED='\e[0;31m'
BLUE='\e[0;34m'
NC='\e[0m' # No Color
# Source centralized color scheme
source "$(dirname "$0")/set-term-colorscheme.sh"

if ! git --version &> /dev/null ; then
printf "${RED}Git not installed.${NC} Not entirely sure how you got here without it, but to install see https://git-scm.com/book/en/v2/Getting-Started-Installing-Git\n"
if $HOMEBREW_AVAILABLE; then printf " or, as you have Homebrew available, run ${BLUE}brew install git${NC}\n"; fi
printf "${ERROR}Git not installed.${NC} Not entirely sure how you got here without it, but to install see https://git-scm.com/book/en/v2/Getting-Started-Installing-Git\n"
if $HOMEBREW_AVAILABLE; then printf " or, as you have Homebrew available, run ${CODE}brew install git${NC}\n"; fi
exit 1
fi

if ! terraform -v &> /dev/null ; then
printf "${RED}Terraform CLI not available.${NC} Psoxy examples / deployment scripts require it. See ${BLUE}https://developer.hashicorp.com/terraform/downloads${NC} for installation options\n"
printf "${ERROR}Terraform CLI not available.${NC} Psoxy examples / deployment scripts require it. See ${CODE}https://developer.hashicorp.com/terraform/downloads${NC} for installation options\n"
exit 1
fi

# Check Maven installation

if ! mvn -v &> /dev/null ; then
printf "${RED}Maven not installed.${NC} See https://maven.apache.org/install.html\n"
if $HOMEBREW_AVAILABLE; then printf " or, as you have Homebrew available, run ${BLUE}brew install maven${NC}\n"; fi
exit 1
fi


MVN_VERSION=`mvn -v | grep "Apache Maven"`
MVN_VERSION_MAJOR_MINOR=$(echo $MVN_VERSION | sed -n 's/^Apache Maven \([0-9]*\.[0-9]*\).*$/\1/p')
printf "Your Maven version is ${BLUE}${MVN_VERSION}${NC}.\n"

# Parse Maven version components
MVN_MAJOR=$(echo "$MVN_VERSION_MAJOR_MINOR" | cut -d. -f1)
MVN_MINOR=$(echo "$MVN_VERSION_MAJOR_MINOR" | cut -d. -f2)
if (( MVN_MAJOR < 3 || (MVN_MAJOR == 3 && MVN_MINOR < 6) )); then
printf "${RED}This Maven version appears to be unsupported.${NC} Psoxy requires a supported version of Maven 3.6 or later.\n"
printf "We recommend you upgrade. See https://maven.apache.org/install.html\n"
printf "Maven is used to build the package that will be deployed to your host platform as an AWS lambda or a GCP Cloud Function\n"
fi

printf "\n"

# Check Java installation
printf "${WARNING}Maven not installed.${NC} It is REQUIRED unless you will use a pre-built JAR. To install, see https://maven.apache.org/install.html\n"
if $HOMEBREW_AVAILABLE; then printf " or, as you have Homebrew available, run ${CODE}brew install maven${NC}\n"; fi
printf " (Using a prebuilt jar requires adding ${CODE}deployment_bundle=""${NC} to your ${CODE}terraform.tfvars${NC} file, and filling with s3/gcs uri for your desired JAR)\n"
else
MVN_VERSION=`mvn -v | grep "Apache Maven"`
MVN_VERSION_MAJOR_MINOR=$(echo $MVN_VERSION | sed -n 's/^Apache Maven \([0-9]*\.[0-9]*\).*$/\1/p')
printf "Your Maven version is ${CODE}${MVN_VERSION}${NC}.\n"

# Parse Maven version components
MVN_MAJOR=$(echo "$MVN_VERSION_MAJOR_MINOR" | cut -d. -f1)
MVN_MINOR=$(echo "$MVN_VERSION_MAJOR_MINOR" | cut -d. -f2)
if (( MVN_MAJOR < 3 || (MVN_MAJOR == 3 && MVN_MINOR < 6) )); then
printf "${ERROR}This Maven version appears to be unsupported.${NC} Psoxy requires a supported version of Maven 3.6 or later.\n"
printf "We recommend you upgrade. See https://maven.apache.org/install.html\n"
printf "Maven is used to build the package that will be deployed to your host platform as an AWS lambda or a GCP Cloud Function\n"
fi

JAVA_VERSION=`mvn -v | grep Java`
JAVA_VERSION_MAJOR=$(echo $JAVA_VERSION | sed -n 's/^Java version: \([0-9]*\).*/\1/p')
printf "\n"

printf "Your Maven installation uses ${BLUE}${JAVA_VERSION}${NC}.\n"
# Check Java installation
JAVA_VERSION=`mvn -v | grep Java`
JAVA_VERSION_MAJOR=$(echo $JAVA_VERSION | sed -n 's/^Java version: \([0-9]*\).*/\1/p')

if [[ "$JAVA_VERSION_MAJOR" != 17 && "$JAVA_VERSION_MAJOR" != 21 && "$JAVA_VERSION_MAJOR" != 23 && "$JAVA_VERSION_MAJOR" != 24 ]]; then
printf "${RED}This Java version appears to be unsupported. You should upgrade it, or may have compile errors.${NC} Psoxy requires an Oracle-supported version of Java 17 or later; as of April 2025, this includes Java 17, 21, or 24. See https://maven.apache.org/install.html\n"
if $HOMEBREW_AVAILABLE; then printf "or as you have Homebrew available, run ${BLUE}brew install openjdk@17${NC}\n"; fi
printf "If you have an alternative JDK installed, then you must update your ${BLUE}JAVA_HOME${NC} environment variable to point to it.\n"
fi
printf "Your Maven installation uses ${CODE}${JAVA_VERSION}${NC}.\n"

printf "\n"
if [[ "$JAVA_VERSION_MAJOR" != 17 && "$JAVA_VERSION_MAJOR" != 21 && "$JAVA_VERSION_MAJOR" != 23 && "$JAVA_VERSION_MAJOR" != 24 ]]; then
printf "${ERROR}This Java version appears to be unsupported. You should upgrade it, or may have compile errors.${NC} Psoxy requires an Oracle-supported version of Java 17 or later; as of April 2025, this includes Java 17, 21, or 24. See https://maven.apache.org/install.html\n"
if $HOMEBREW_AVAILABLE; then printf "or as you have Homebrew available, run ${CODE}brew install openjdk@17${NC}\n"; fi
printf "If you have an alternative JDK installed, then you must update your ${CODE}JAVA_HOME${NC} environment variable to point to it.\n"
fi

# if java > 23, then mvn must be 3.9.10+
if (( JAVA_VERSION_MAJOR > 23 )); then
# Parse full Maven version for patch comparison
MVN_VERSION_FULL=$(echo "$MVN_VERSION" | sed -n 's/^Apache Maven \([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/p')
MVN_PATCH=$(echo "$MVN_VERSION_FULL" | cut -d. -f3)
if (( MVN_MAJOR < 3 || (MVN_MAJOR == 3 && MVN_MINOR < 9) || (MVN_MAJOR == 3 && MVN_MINOR == 9 && MVN_PATCH < 10) )); then
printf "${RED}Maven < 3.9.10 has compatibility issues with Java 24.${NC} If you're using Java 24, psoxy will NOT build correctly unless you upgrade Maven to 3.9.10 or later.\n"
printf "See https://maven.apache.org/install.html\n"
printf "\n"

# if java > 23, then mvn must be 3.9.10+
if (( JAVA_VERSION_MAJOR > 23 )); then
# Parse full Maven version for patch comparison
MVN_VERSION_FULL=$(echo "$MVN_VERSION" | sed -n 's/^Apache Maven \([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/p')
MVN_PATCH=$(echo "$MVN_VERSION_FULL" | cut -d. -f3)
if (( MVN_MAJOR < 3 || (MVN_MAJOR == 3 && MVN_MINOR < 9) || (MVN_MAJOR == 3 && MVN_MINOR == 9 && MVN_PATCH < 10) )); then
printf "${ERROR}Maven < 3.9.10 has compatibility issues with Java 24.${NC} If you're using Java 24, psoxy will NOT build correctly unless you upgrade Maven to 3.9.10 or later.\n"
printf "See https://maven.apache.org/install.html\n"
fi
fi

printf "\n"
fi

printf "\n"

# Check NPM installation

if ! npm -v &> /dev/null ; then
printf "${RED}NodeJS (node) and Node Package Manager (npm) are not installed but are required for the local test tooling to work. ${NC} While this is optional, we recommend you install them to be able to test your instances. See https://nodejs.org/\n"
if $HOMEBREW_AVAILABLE; then printf " or, as you have Homebrew available, run ${BLUE}brew install node${NC}\n"; fi
printf "${WARNING}NodeJS (node) and Node Package Manager (npm) are not installed but are required for the local test tooling to work. ${NC} While this is optional, we recommend you install them to be able to test your instances. See https://nodejs.org/\n"
if $HOMEBREW_AVAILABLE; then printf " or, as you have Homebrew available, run ${CODE}brew install node${NC}\n"; fi
fi


# Check AWS installation
AWSCLI_REASON="Required if deploying to AWS."
if ! aws --version &> /dev/null ; then
printf "${RED}AWS CLI is not installed.${NC} ${AWSCLI_REASON} See https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html\n"
if $HOMEBREW_AVAILABLE; then printf " or, as you have Homebrew available, run ${BLUE}brew install awscli${NC}\n"; fi
printf "${ERROR}AWS CLI is not installed.${NC} ${AWSCLI_REASON} See https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html\n"
if $HOMEBREW_AVAILABLE; then printf " or, as you have Homebrew available, run ${CODE}brew install awscli${NC}\n"; fi
else
printf "AWS CLI version ${BLUE}`aws --version`${NC} is installed.\n"
printf "AWS CLI version ${CODE}`aws --version`${NC} is installed.\n"
printf ""
printf "\t- make sure ${BLUE}aws sts get-caller-identity${NC} returns the user/role/account you expect. $AWSCLI_REASON\n"
printf "\t- make sure ${CODE}aws sts get-caller-identity${NC} returns the user/role/account you expect. $AWSCLI_REASON\n"
fi

printf "\n"

# Check GCloud CLI installation
GCLOUD_REASON="Required if deploying to GCP or using Google Workspace data sources."
if ! gcloud --version &> /dev/null ; then
printf "${RED}Google Cloud SDK is not installed.${NC} ${GCLOUD_REASON} See https://cloud.google.com/sdk/docs/install\n"
if $HOMEBREW_AVAILABLE; then printf " or, as you have Homebrew available, run ${BLUE}brew install --cask google-cloud-sdk${NC}\n"; fi
printf "${ERROR}Google Cloud SDK is not installed.${NC} ${GCLOUD_REASON} See https://cloud.google.com/sdk/docs/install\n"
if $HOMEBREW_AVAILABLE; then printf " or, as you have Homebrew available, run ${CODE}brew install --cask google-cloud-sdk${NC}\n"; fi
else
printf "Google Cloud SDK version ${BLUE}`gcloud --version 2> /dev/null | head -n 1`${NC} is installed.\n"
printf "\t- make sure ${BLUE}gcloud auth list --filter=\"status:ACTIVE\"${NC} returns the account you expect. $GCLOUD_REASON\n"
printf "Google Cloud SDK version ${CODE}`gcloud --version 2> /dev/null | head -n 1`${NC} is installed.\n"
printf "\t- make sure ${CODE}gcloud auth list --filter=\"status:ACTIVE\"${NC} returns the account you expect. $GCLOUD_REASON\n"
fi

printf "\n"

# Check Azure CLI installation
AZCLI_REASON="Required if deploying to Azure or using Microsoft 365 data sources."
if ! az --version &> /dev/null ; then
printf "${RED}Azure CLI is not installed.${NC} ${AZCLI_REASON} See https://docs.microsoft.com/en-us/cli/azure/install-azure-cli\n"
if $HOMEBREW_AVAILABLE; then printf " or, as you have Homebrew available, run ${BLUE}brew install azure-cli${NC}\n"; fi
printf "${ERROR}Azure CLI is not installed.${NC} ${AZCLI_REASON} See https://docs.microsoft.com/en-us/cli/azure/install-azure-cli\n"
if $HOMEBREW_AVAILABLE; then printf " or, as you have Homebrew available, run ${CODE}brew install azure-cli${NC}\n"; fi
else
# how can pipe to sed or something to strip extra whitespace out?
printf "Azure CLI version ${BLUE}`az --version --only-show-errors | head -n 1`${NC} is installed.\n"
printf "\t- make sure ${BLUE}az account show${NC} is the user/tenant you expect. If not, ${BLUE}az login --allow-no-subscription${NC} to authenticate. $AZCLI_REASON\n"
printf "Azure CLI version ${CODE}`az --version --only-show-errors | head -n 1`${NC} is installed.\n"
printf "\t- make sure ${CODE}az account show${NC} is the user/tenant you expect. If not, ${CODE}az login --allow-no-subscription${NC} to authenticate. $AZCLI_REASON\n"
fi

2 changes: 1 addition & 1 deletion google-workspace.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ provider "google" {


module "worklytics_connectors_google_workspace" {
source = "git::https://github.com/worklytics/psoxy//infra/modules/worklytics-connectors-google-workspace?ref=v0.5.16"
source = "git::https://github.com/worklytics/psoxy//infra/modules/worklytics-connectors-google-workspace?ref=v0.5.17"


providers = {
Expand Down
15 changes: 7 additions & 8 deletions init
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,26 @@
# ../../../tools/reset-example.sh

# colors
RED='\e[0;31m'
BLUE='\e[0;34m'
NC='\e[0m' # No Color
# Source centralized color scheme
source "$(dirname "$0")/set-term-colorscheme.sh"


EXPLICIT_REPO_CLONE_DIR=$1

TF_CONFIG_ROOT=`pwd`

if ! terraform -v &> /dev/null ; then
printf "${RED}Terraform not available; required for this Psoxy example. See https://github.com/Worklytics/psoxy#prerequisites ${NC}\n"
printf "${ERROR}Terraform not available; required for this Psoxy example. See https://github.com/Worklytics/psoxy#prerequisites ${NC}\n"
exit 1
fi

# initialize terraform, which downloads dependencies into `.terraform` directory
printf "Initializing ${BLUE}psoxy${NC} Terraform configuration ...\n"
printf "Initializing ${CODE}psoxy${NC} Terraform configuration ...\n"
terraform init

TF_INIT_EXIT_CODE=$?
if [[ $TF_INIT_EXIT_CODE -ne 0 ]]; then
printf "${RED}Terraform init failed. See above for details. Cannot continue to initialize example configuration.${NC}\n"
printf "${ERROR}Terraform init failed. See above for details. Cannot continue to initialize example configuration.${NC}\n"
exit 1
fi

Expand All @@ -53,9 +52,9 @@ if [[ -z "$EXPLICIT_REPO_CLONE_DIR" ]]; then
if [[ -d ".terraform/modules/psoxy/" ]]; then
REPO_CLONE_BASE_DIR=".terraform/modules/psoxy/"
else
printf "${RED}No explicit path to repo clone provided, and 'psoxy' module in Terraform configuration.${NC}\n"
printf "${ERROR}No explicit path to repo clone provided, and 'psoxy' module in Terraform configuration.${NC}\n"
printf "Try running this script with a Terraform module named 'psoxy' that references to GitHub repo https://github.com/Worklytics/psoxy, or pass the path to a clone of that as the first argument to the script.\n"
printf " eg ${BLUE}./init ~/code/psoxy${NC}\n"
printf " eg ${CODE}./init ~/code/psoxy${NC}\n"
exit 1
fi
else
Expand Down
6 changes: 3 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ terraform {

# general cases
module "worklytics_connectors" {
source = "git::https://github.com/worklytics/psoxy//infra/modules/worklytics-connectors?ref=v0.5.16"
source = "git::https://github.com/worklytics/psoxy//infra/modules/worklytics-connectors?ref=v0.5.17"

enabled_connectors = var.enabled_connectors
chat_gpt_enterprise_example_workspace_id = var.chat_gpt_enterprise_example_workspace_id
Expand Down Expand Up @@ -103,7 +103,7 @@ locals {
}

module "psoxy" {
source = "git::https://github.com/worklytics/psoxy//infra/modules/aws-host?ref=v0.5.16"
source = "git::https://github.com/worklytics/psoxy//infra/modules/aws-host?ref=v0.5.17"

environment_name = var.environment_name
aws_account_id = var.aws_account_id
Expand Down Expand Up @@ -176,7 +176,7 @@ locals {
module "connection_in_worklytics" {
for_each = local.all_instances

source = "git::https://github.com/worklytics/psoxy//infra/modules/worklytics-psoxy-connection-aws?ref=v0.5.16"
source = "git::https://github.com/worklytics/psoxy//infra/modules/worklytics-psoxy-connection-aws?ref=v0.5.17"

proxy_instance_id = each.key
worklytics_host = var.worklytics_host
Expand Down
8 changes: 4 additions & 4 deletions msft-365.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# BEGIN MSFT

module "worklytics_connectors_msft_365" {
source = "git::https://github.com/worklytics/psoxy//infra/modules/worklytics-connectors-msft-365?ref=v0.5.16"
source = "git::https://github.com/worklytics/psoxy//infra/modules/worklytics-connectors-msft-365?ref=v0.5.17"


enabled_connectors = var.enabled_connectors
Expand Down Expand Up @@ -47,7 +47,7 @@ data "aws_region" "current" {
module "cognito_identity_pool" {
count = local.msft_365_enabled ? 1 : 0 # only provision identity pool if MSFT-365 connectors are enabled

source = "git::https://github.com/worklytics/psoxy//infra/modules/aws-cognito-pool?ref=v0.5.16"
source = "git::https://github.com/worklytics/psoxy//infra/modules/aws-cognito-pool?ref=v0.5.17"

developer_provider_name = local.developer_provider_name
name = "${local.env_qualifier}-azure-ad-federation"
Expand All @@ -69,7 +69,7 @@ locals {
module "cognito_identity" {
count = local.msft_365_enabled ? 1 : 0 # only provision identity pool if MSFT-365 connectors are enabled

source = "git::https://github.com/worklytics/psoxy//infra/modules/aws-cognito-identity-cli?ref=v0.5.16"
source = "git::https://github.com/worklytics/psoxy//infra/modules/aws-cognito-identity-cli?ref=v0.5.17"


aws_region = data.aws_region.current.id
Expand Down Expand Up @@ -106,7 +106,7 @@ locals {
module "msft_connection_auth_federation" {
for_each = local.provision_entraid_apps ? local.enabled_to_entraid_object : local.shared_to_entraid_object

source = "git::https://github.com/worklytics/psoxy//infra/modules/azuread-federated-credentials?ref=v0.5.16"
source = "git::https://github.com/worklytics/psoxy//infra/modules/azuread-federated-credentials?ref=v0.5.17"

application_id = each.value.connector_id
display_name = "${local.env_qualifier}AccessFromAWS"
Expand Down