Skip to content

Commit 9d1c5fa

Browse files
committed
Add www (landing page) support to setup.sh and deploy.sh
1 parent c494502 commit 9d1c5fa

2 files changed

Lines changed: 32 additions & 8 deletions

File tree

cloud/deploy/deploy.sh

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ print_info() { echo -e "${BLUE}ℹ${NC} $1"; }
2121
DO_PULL=false
2222
RESTART_ONLY=false
2323
FORCE=false
24-
BUILD_TARGET="both" # api, web, or both
24+
BUILD_TARGET="all" # api, web, www, or all
2525

2626
while [[ $# -gt 0 ]]; do
2727
case $1 in
@@ -31,11 +31,11 @@ while [[ $# -gt 0 ]]; do
3131
--build)
3232
if [[ -n "$2" && ! "$2" =~ ^-- ]]; then
3333
case $2 in
34-
api|web|both) BUILD_TARGET="$2"; shift 2 ;;
35-
*) print_error "Invalid --build option: $2 (use: api, web, or both)"; exit 1 ;;
34+
api|web|www|all) BUILD_TARGET="$2"; shift 2 ;;
35+
*) print_error "Invalid --build option: $2 (use: api, web, www, or all)"; exit 1 ;;
3636
esac
3737
else
38-
BUILD_TARGET="both"; shift
38+
BUILD_TARGET="all"; shift
3939
fi
4040
;;
4141
--help|-h)
@@ -44,7 +44,7 @@ while [[ $# -gt 0 ]]; do
4444
echo "Options:"
4545
echo " --pull Pull latest from git (production deployment)"
4646
echo " --restart-only Skip build, just restart containers"
47-
echo " --build [TARGET] Build target: api, web, or both (default: both)"
47+
echo " --build [TARGET] Build target: api, web, www, or all (default: all)"
4848
echo " --force, -f Don't ask for confirmation"
4949
echo " --help, -h Show this help"
5050
exit 0
@@ -182,22 +182,26 @@ docker compose pull postgres redis minio
182182

183183
# Step 3: Build images (unless --restart-only)
184184
if [ "$RESTART_ONLY" = false ]; then
185-
if [ "$BUILD_TARGET" = "api" ] || [ "$BUILD_TARGET" = "both" ]; then
185+
if [ "$BUILD_TARGET" = "api" ] || [ "$BUILD_TARGET" = "all" ]; then
186186
print_step "Building API image..."
187187
docker compose build --no-cache api
188188
fi
189-
if [ "$BUILD_TARGET" = "web" ] || [ "$BUILD_TARGET" = "both" ]; then
189+
if [ "$BUILD_TARGET" = "web" ] || [ "$BUILD_TARGET" = "all" ]; then
190190
print_step "Building Web (Blazor WASM) image..."
191191
docker compose build --no-cache web
192192
fi
193+
if [ "$BUILD_TARGET" = "www" ] || [ "$BUILD_TARGET" = "all" ]; then
194+
print_step "Building WWW (landing page) image..."
195+
docker compose build --no-cache www
196+
fi
193197
print_success "Build complete ($BUILD_TARGET)"
194198
else
195199
print_info "Restart only (skipping build)"
196200
fi
197201

198202
# Step 4: Stop old containers
199203
print_step "Stopping containers..."
200-
docker compose stop api web nginx
204+
docker compose stop api web www nginx
201205

202206
# Step 5: Start new containers
203207
print_step "Starting containers..."

cloud/deploy/setup.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,17 @@ if docker images lrmcloud-web --format '{{.ID}}' | grep -q .; then
629629
fi
630630
fi
631631

632+
# Check if WWW (landing page) image needs rebuild
633+
REBUILD_WWW=false
634+
if docker images lrmcloud-www --format '{{.ID}}' | grep -q .; then
635+
echo ""
636+
echo -e "${BLUE}WWW (landing page) image already exists.${NC}"
637+
read -p "Rebuild WWW image? [y/N]: " REBUILD_RESPONSE
638+
if [ "$REBUILD_RESPONSE" = "y" ] || [ "$REBUILD_RESPONSE" = "Y" ]; then
639+
REBUILD_WWW=true
640+
fi
641+
fi
642+
632643
# Pull latest images
633644
print_step "Pulling latest Docker images..."
634645
docker compose pull
@@ -651,6 +662,15 @@ elif ! docker images lrmcloud-web --format '{{.ID}}' | grep -q .; then
651662
docker compose build web
652663
fi
653664

665+
# Build WWW if needed (first time or rebuild requested)
666+
if [ "$REBUILD_WWW" = true ]; then
667+
print_step "Rebuilding WWW (landing page) image..."
668+
docker compose build www --no-cache
669+
elif ! docker images lrmcloud-www --format '{{.ID}}' | grep -q .; then
670+
print_step "Building WWW (landing page) image..."
671+
docker compose build www
672+
fi
673+
654674
# Check if Redis or MinIO passwords changed - need force-recreate
655675
RECREATE_SERVICES=""
656676
if [ -n "$OLD_REDIS_PASSWORD" ] && [ "$REDIS_PASSWORD" != "$OLD_REDIS_PASSWORD" ]; then

0 commit comments

Comments
 (0)