@@ -357,39 +357,35 @@ choose_beta_env() {
357357
358358# Function to pull required images
359359pull_required_images () {
360- if [ " $ENABLE_TERMINAL_TOOL " = " true" ]; then
361- echo " π³ Pulling openssh-server image for Terminal tool..."
362- if ! docker pull " $OPENSSH_SERVER_IMAGE " ; then
363- echo " β ERROR Failed to pull openssh-server image: $OPENSSH_SERVER_IMAGE "
364- ERROR_OCCURRED=1
365- return 1
366- fi
367- echo " β
Successfully pulled openssh-server image"
368- echo " "
369- echo " --------------------------------"
370- echo " "
360+ echo " π³ Pulling openssh-server image for Terminal tool..."
361+ if ! docker pull " $OPENSSH_SERVER_IMAGE " ; then
362+ echo " β ERROR Failed to pull openssh-server image: $OPENSSH_SERVER_IMAGE "
363+ ERROR_OCCURRED=1
364+ return 1
371365 fi
366+ echo " β
Successfully pulled openssh-server image"
367+ echo " "
368+ echo " --------------------------------"
369+ echo " "
372370}
373371
374372
375373
376374# Function to setup package installation script
377375setup_package_install_script () {
378- if [ " $ENABLE_TERMINAL_TOOL " = " true" ]; then
379- echo " π Setting up package installation script..."
380- mkdir -p " openssh-server/config/custom-cont-init.d"
381-
382- # Copy the fixed installation script
383- if [ -f " openssh-install-script.sh" ]; then
384- cp " openssh-install-script.sh" " openssh-server/config/custom-cont-init.d/openssh-start-script"
385- chmod +x " openssh-server/config/custom-cont-init.d/openssh-start-script"
386- echo " β
Package installation script created/updated"
387- else
388- echo " β ERROR openssh-install-script.sh not found"
389- ERROR_OCCURRED=1
390- return 1
391- fi
392- fi
376+ echo " π Setting up package installation script..."
377+ mkdir -p " openssh-server/config/custom-cont-init.d"
378+
379+ # Copy the fixed installation script
380+ if [ -f " openssh-install-script.sh" ]; then
381+ cp " openssh-install-script.sh" " openssh-server/config/custom-cont-init.d/openssh-start-script"
382+ chmod +x " openssh-server/config/custom-cont-init.d/openssh-start-script"
383+ echo " β
Package installation script created/updated"
384+ else
385+ echo " β ERROR openssh-install-script.sh not found"
386+ ERROR_OCCURRED=1
387+ return 1
388+ fi
393389}
394390
395391# Function to wait for Elasticsearch to become healthy
@@ -650,30 +646,46 @@ echo ""
650646# Main deployment function
651647main_deploy () {
652648 # Start deployment
649+
650+ # Select deployment mode and checks
653651 select_deployment_mode || { echo " β Deployment mode selection failed" ; exit 1; }
652+ select_terminal_tool || { echo " β Terminal tool configuration failed" ; exit 1; }
654653
655- # Special handling for infrastructure mode
656- if [ " $DEPLOYMENT_MODE " = " infrastructure" ]; then
657- echo " ποΈ Infrastructure mode detected - preparing infrastructure services..."
654+ # Choose image environment before generating keys that need Docker images
655+ if [ " $DEPLOYMENT_MODE " = " beta" ]; then
656+ choose_beta_env || { echo " β Beta environment setup failed" ; exit 1; }
657+ else
658+ choose_image_env || { echo " β Image environment setup failed" ; exit 1; }
659+ fi
658660
659- # Set up basic environment and permissions first
660- add_permission || { echo " β Permission setup failed" ; exit 1; }
661+ # Add permission
662+ add_permission || { echo " β Permission setup failed" ; exit 1; }
661663
662- # Choose image environment (required for Docker images)
663- echo " π Selecting image environment for infrastructure services ..."
664- choose_image_env || { echo " β Image environment setup failed" ; exit 1; }
664+ # Generate MinIO keys first to avoid docker-compose warnings
665+ echo " π Pre-generating MinIO keys to avoid docker-compose warnings ..."
666+ generate_minio_ak_sk || { echo " β MinIO key generation failed" ; exit 1; }
665667
666- # Generate MinIO keys first to avoid docker-compose warnings
667- echo " π Pre-generating MinIO keys to avoid docker-compose warnings... "
668- generate_minio_ak_sk || { echo " β MinIO key generation failed" ; exit 1; }
668+ if [ " $ENABLE_TERMINAL_TOOL " = " true " ] ; then
669+ # Pull required images before using them
670+ pull_required_images || { echo " β Required image pull failed" ; exit 1; }
669671
670- # Export MinIO keys to current environment for docker-compose
671- export MINIO_ACCESS_KEY
672- export MINIO_SECRET_KEY
672+ # Generate SSH keys for terminal tool (only needed if terminal tool is enabled)
673+ generate_ssh_keys || { echo " β SSH key generation failed" ; exit 1; }
674+ fi
675+
676+ # Special handling for infrastructure mode
677+ if [ " $DEPLOYMENT_MODE " = " infrastructure" ]; then
678+ echo " ποΈ Infrastructure mode detected - preparing infrastructure services..."
673679
674680 # Start infrastructure services (basic services only)
675681 echo " π§ Starting infrastructure services..."
676682 INFRA_SERVICES=" nexent-elasticsearch nexent-postgresql nexent-minio redis"
683+
684+ if [ " $ENABLE_TERMINAL_TOOL " = " true" ]; then
685+ INFRA_SERVICES=" $INFRA_SERVICES nexent-openssh-server"
686+ echo " π§ Terminal tool enabled - openssh-server will be included"
687+ fi
688+
677689 if ! docker-compose -p nexent -f " ${COMPOSE_FILE} " up -d $INFRA_SERVICES ; then
678690 echo " β ERROR Failed to start infrastructure services"
679691 exit 1
@@ -690,23 +702,6 @@ main_deploy() {
690702 return 0
691703 fi
692704
693- # Normal deployment flow for other modes
694- select_terminal_tool || { echo " β Terminal tool configuration failed" ; exit 1; }
695- add_permission || { echo " β Permission setup failed" ; exit 1; }
696-
697- # Choose image environment before generating keys that need Docker images
698- if [ " $DEPLOYMENT_MODE " = " beta" ]; then
699- choose_beta_env || { echo " β Beta environment setup failed" ; exit 1; }
700- else
701- choose_image_env || { echo " β Image environment setup failed" ; exit 1; }
702- fi
703-
704- # Pull required images before using them
705- pull_required_images || { echo " β Required image pull failed" ; exit 1; }
706-
707- # Generate SSH keys for terminal tool (only needed if terminal tool is enabled)
708- generate_ssh_keys || { echo " β SSH key generation failed" ; exit 1; }
709-
710705 # Install services and generate environment
711706 install || { echo " β Service installation failed" ; exit 1; }
712707
0 commit comments