@@ -12,6 +12,7 @@ source .env
1212MODE_CHOICE=" "
1313IS_MAINLAND=" "
1414ENABLE_TERMINAL=" "
15+ VERSION_CHOICE=" "
1516
1617while [[ $# -gt 0 ]]; do
1718 case " $1 " in
@@ -27,6 +28,10 @@ while [[ $# -gt 0 ]]; do
2728 ENABLE_TERMINAL=" $2 "
2829 shift 2
2930 ;;
31+ --version)
32+ VERSION_CHOICE=" $2 "
33+ shift 2
34+ ;;
3035 * )
3136 shift
3237 ;;
@@ -155,6 +160,7 @@ clean() {
155160 # export MINIO_SECRET_KEY=
156161 export DEPLOYMENT_MODE=
157162 export COMPOSE_FILE_SUFFIX=
163+ export DEPLOYMENT_VERSION=
158164}
159165
160166# Function to create a directory and set permissions
@@ -231,16 +237,22 @@ install() {
231237 fi
232238
233239 # Start infrastructure services
234- if ! docker-compose -p nexent-commercial -f " docker-compose${COMPOSE_FILE_SUFFIX} " up -d $INFRA_SERVICES ; then
240+ if ! docker-compose -p nexent -f " docker-compose${COMPOSE_FILE_SUFFIX} " up -d $INFRA_SERVICES ; then
235241 echo " ❌ ERROR Failed to start infrastructure services"
236242 ERROR_OCCURRED=1
237243 return 1
238244 fi
239245
240- if ! docker-compose -p nexent-commercial -f " docker-compose-supabase${COMPOSE_FILE_SUFFIX} " up -d; then
241- echo " ❌ ERROR Failed to start supabase services"
242- ERROR_OCCURRED=1
243- return 1
246+ # Only install docker-compose-supabase if DEPLOYMENT_VERSION is "full"
247+ if [ " $DEPLOYMENT_VERSION " = " full" ]; then
248+ echo " 🎯 Full version detected - installing Supabase services..."
249+ if ! docker-compose -p nexent -f " docker-compose-supabase${COMPOSE_FILE_SUFFIX} " up -d; then
250+ echo " ❌ ERROR Failed to start supabase services"
251+ ERROR_OCCURRED=1
252+ return 1
253+ fi
254+ else
255+ echo " ⚡ Speed version detected - skipping Supabase services"
244256 fi
245257
246258 echo " "
@@ -250,13 +262,13 @@ install() {
250262 # Always generate a new ELASTICSEARCH_API_KEY for each deployment.
251263 echo " 🔑 Generating ELASTICSEARCH_API_KEY..."
252264 # Wait for elasticsearch health check
253- while ! ${docker_compose_command} -p nexent-commercial -f " docker-compose${COMPOSE_FILE_SUFFIX} " ps nexent-elasticsearch | grep -q " healthy" ; do
265+ while ! ${docker_compose_command} -p nexent -f " docker-compose${COMPOSE_FILE_SUFFIX} " ps nexent-elasticsearch | grep -q " healthy" ; do
254266 echo " ⏳ Waiting for Elasticsearch to become healthy..."
255267 sleep 10
256268 done
257269
258270 # Generate API key
259- API_KEY_JSON=$( ${docker_compose_command} -p nexent-commercial -f " docker-compose${COMPOSE_FILE_SUFFIX} " exec -T nexent-elasticsearch curl -s -u " elastic:$ELASTIC_PASSWORD " " http://localhost:9200/_security/api_key" -H " Content-Type: application/json" -d ' {"name":"my_api_key","role_descriptors":{"my_role":{"cluster":["all"],"index":[{"names":["*"],"privileges":["all"]}]}}}' )
271+ API_KEY_JSON=$( ${docker_compose_command} -p nexent -f " docker-compose${COMPOSE_FILE_SUFFIX} " exec -T nexent-elasticsearch curl -s -u " elastic:$ELASTIC_PASSWORD " " http://localhost:9200/_security/api_key" -H " Content-Type: application/json" -d ' {"name":"my_api_key","role_descriptors":{"my_role":{"cluster":["all"],"index":[{"names":["*"],"privileges":["all"]}]}}}' )
260272
261273 # Extract API key and add to .env
262274 ELASTICSEARCH_API_KEY=$( echo " $API_KEY_JSON " | grep -o ' "encoded":"[^"]*"' | awk -F' "' ' {print $4}' )
@@ -284,7 +296,7 @@ install() {
284296 # Start core services
285297 if [ " $DEPLOYMENT_MODE " != " infrastructure" ]; then
286298 echo " 👀 Starting core services..."
287- if ! docker-compose -p nexent-commercial -f " docker-compose${COMPOSE_FILE_SUFFIX} " up -d nexent nexent-web nexent-data-process; then
299+ if ! docker-compose -p nexent -f " docker-compose${COMPOSE_FILE_SUFFIX} " up -d nexent nexent-web nexent-data-process; then
288300 echo " ❌ ERROR Failed to start core services"
289301 ERROR_OCCURRED=1
290302 return 1
@@ -336,6 +348,37 @@ update_env_var() {
336348
337349}
338350
351+ # Add deployment version selection function
352+ select_deployment_version () {
353+ echo " 🚀 Please select deployment version:"
354+ echo " 1) ⚡ Speed version - Lightweight deployment with essential features"
355+ echo " 2) 🎯 Full version - Full-featured deployment with all capabilities"
356+ if [ -n " $VERSION_CHOICE " ]; then
357+ version_choice=" $VERSION_CHOICE "
358+ echo " 👉 Using version_choice from argument: $version_choice "
359+ else
360+ read -p " 👉 Enter your choice [1/2] (default: 1): " version_choice
361+ fi
362+
363+ case $version_choice in
364+ 2)
365+ export DEPLOYMENT_VERSION=" full"
366+ echo " ✅ Selected complete version 🎯"
367+ ;;
368+ * )
369+ export DEPLOYMENT_VERSION=" speed"
370+ echo " ✅ Selected speed version ⚡"
371+ ;;
372+ esac
373+
374+ # Save the version choice to .env file
375+ update_env_var " DEPLOYMENT_VERSION" " $DEPLOYMENT_VERSION "
376+
377+ echo " "
378+ echo " --------------------------------"
379+ echo " "
380+ }
381+
339382choose_image_env () {
340383 if [ -n " $IS_MAINLAND " ]; then
341384 is_mainland=" $IS_MAINLAND "
@@ -401,7 +444,7 @@ setup_package_install_script() {
401444wait_for_elasticsearch_healthy () {
402445 local retries=0
403446 local max_retries=${1:- 60} # Default 10 minutes, can be overridden
404- while ! docker-compose -p nexent-commercial -f " docker-compose${COMPOSE_FILE_SUFFIX} " ps nexent-elasticsearch | grep -q " healthy" && [ $retries -lt $max_retries ]; do
447+ while ! docker-compose -p nexent -f " docker-compose${COMPOSE_FILE_SUFFIX} " ps nexent-elasticsearch | grep -q " healthy" && [ $retries -lt $max_retries ]; do
405448 echo " ⏳ Waiting for Elasticsearch to become healthy... (attempt $(( retries + 1 )) /$max_retries )"
406449 sleep 10
407450 retries=$(( retries + 1 ))
@@ -436,7 +479,10 @@ generate_env_for_infrastructure() {
436479
437480 # Make sure the script is executable and run it
438481 chmod +x generate_env.sh
439- ./generate_env.sh
482+
483+ # Export DEPLOYMENT_VERSION to ensure generate_env.sh can access it
484+ export DEPLOYMENT_VERSION
485+
440486 if ./generate_env.sh; then
441487 echo " --------------------------------"
442488 echo " "
@@ -635,7 +681,8 @@ echo ""
635681main_deploy () {
636682 # Start deployment
637683
638- # Select deployment mode and checks
684+ # Select deployment version and mode
685+ select_deployment_version || { echo " ❌ Deployment version selection failed" ; exit 1; }
639686 select_deployment_mode || { echo " ❌ Deployment mode selection failed" ; exit 1; }
640687 select_terminal_tool || { echo " ❌ Terminal tool configuration failed" ; exit 1; }
641688
@@ -671,7 +718,7 @@ main_deploy() {
671718 echo " 🔧 Terminal tool enabled - openssh-server will be included in infrastructure"
672719 fi
673720
674- if ! docker-compose -p nexent-commercial -f " docker-compose${COMPOSE_FILE_SUFFIX} " up -d $INFRA_SERVICES ; then
721+ if ! docker-compose -p nexent -f " docker-compose${COMPOSE_FILE_SUFFIX} " up -d $INFRA_SERVICES ; then
675722 echo " ❌ ERROR Failed to start infrastructure services"
676723 exit 1
677724 fi
0 commit comments