Skip to content

Commit 11a0728

Browse files
committed
k
1 parent a20e7c9 commit 11a0728

File tree

2 files changed

+85
-17
lines changed

2 files changed

+85
-17
lines changed

deployment/docker_compose/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ To set up Onyx there are several options, Onyx supports the following for deploy
66
- Note, don't forget to copy over the env.template file to .env and edit the necessary values
77
3. For large scale deployments leveraging Kubernetes, there are two options, Helm or Terraform.
88

9+
This README focuses on the easiest guided deployment via install.sh.
10+
911
**For more detailed guides, please refer to the documentation: https://docs.onyx.app/deployment/overview**
1012

1113
## install.sh script
@@ -26,3 +28,20 @@ and where it is stored will depend on your Docker setup. You can always delete t
2628
the install.sh script with --delete-data.
2729

2830
To shut down the deployment without deleting, use install.sh --shutdown.
31+
32+
### Upgrading the deployment
33+
Onyx maintains backwards compatibility across all minor versions following SemVer. If following the install.sh script (or through Docker Compose), you can
34+
upgrade it by first bringing down the containers. To do this, use `install.sh --shutdown`
35+
(or `docker compose down` from the directory with the docker-compose.yml file).
36+
37+
After the containers are stopped, you can safely upgrade by either re-running the `install.sh` script (if you left the values as default which is latest,
38+
then it will automatically update to latest each time the script is run). If you are more comfortable running docker compose commands, you can also run
39+
commands directly from the directory with the docker-compose.yml file. First verify the version you want in the environment file (see below),
40+
(if using `latest` tag, be sure to run `docker compose pull`) and run `docker compose up` to restart the services on the latest version
41+
42+
### Environment variables
43+
The Docker Compose files try to look for a .env file in the same directory. The `install.sh` script sets it up from a file called env.template which is
44+
downloaded during the initial setup. Feel free to edit the .env file to customize your deployment. The most important / common changed values are
45+
located near the top of the file.
46+
47+
IMAGE_TAG is the version of Onyx to run. It is recommended to leave it as latest to get all updates with each redeployment.

deployment/docker_compose/install.sh

Lines changed: 66 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ while [[ $# -gt 0 ]]; do
2222
echo "Usage: $0 [OPTIONS]"
2323
echo ""
2424
echo "Options:"
25-
echo " --shutdown Stop and remove Onyx containers"
25+
echo " --shutdown Stop (pause) Onyx containers"
2626
echo " --delete-data Remove all Onyx data (containers, volumes, and files)"
2727
echo " --help, -h Show this help message"
2828
echo ""
2929
echo "Examples:"
3030
echo " $0 # Install Onyx"
31-
echo " $0 --shutdown # Stop Onyx services"
31+
echo " $0 --shutdown # Pause Onyx services"
3232
echo " $0 --delete-data # Completely remove Onyx and all data"
3333
exit 0
3434
;;
@@ -98,9 +98,9 @@ if [ "$SHUTDOWN_MODE" = true ]; then
9898
exit 1
9999
fi
100100

101-
# Stop and remove containers
102-
$COMPOSE_CMD -f docker-compose.yml down
103-
print_success "Onyx containers stopped and removed"
101+
# Stop containers (without removing them)
102+
$COMPOSE_CMD -f docker-compose.yml stop
103+
print_success "Onyx containers stopped (paused)"
104104
else
105105
print_warning "docker-compose.yml not found in onyx_data/deployment"
106106
fi
@@ -205,7 +205,7 @@ else
205205
fi
206206

207207
# GitHub repo base URL - using docker-compose-easy branch
208-
GITHUB_RAW_URL="https://raw.githubusercontent.com/onyx-dot-app/onyx/docker-compose-easy/deployment/docker_compose"
208+
GITHUB_RAW_URL="https://raw.githubusercontent.com/onyx-dot-app/onyx/main/deployment/docker_compose"
209209

210210
# Check system requirements
211211
print_step "Verifying Docker installation"
@@ -361,7 +361,7 @@ else
361361
fi
362362

363363
# Download nginx config files
364-
NGINX_BASE_URL="https://raw.githubusercontent.com/onyx-dot-app/onyx/docker-compose-easy/deployment/data/nginx"
364+
NGINX_BASE_URL="https://raw.githubusercontent.com/onyx-dot-app/onyx/main/deployment/data/nginx"
365365

366366
# Download app.conf.template
367367
NGINX_CONFIG="onyx_data/data/nginx/app.conf.template"
@@ -567,8 +567,8 @@ echo ""
567567
cd onyx_data/deployment && $COMPOSE_CMD -f docker-compose.yml up -d && cd ../..
568568

569569
# Monitor container startup
570-
print_step "Verifying service health"
571-
print_info "Waiting for services to initialize (10 seconds)..."
570+
print_step "Verifying container health"
571+
print_info "Waiting for containers to initialize (10 seconds)..."
572572

573573
# Progress bar for waiting
574574
for i in {1..10}; do
@@ -616,25 +616,74 @@ if [ "$RESTART_ISSUES" = true ]; then
616616
exit 1
617617
fi
618618

619+
# Health check function
620+
check_onyx_health() {
621+
local max_attempts=600 # 10 minutes * 60 attempts per minute (every 1 second)
622+
local attempt=1
623+
624+
print_info "Checking Onyx service health..."
625+
echo "Containers are healthy, waiting for database migrations and service initialization to finish."
626+
echo ""
627+
628+
while [ $attempt -le $max_attempts ]; do
629+
# Check for successful HTTP responses (200, 301, 302, etc.)
630+
local http_code=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3000)
631+
if echo "$http_code" | grep -qE "^(200|301|302|303|307|308)$"; then
632+
return 0
633+
fi
634+
635+
# Show animated progress with time elapsed
636+
local elapsed=$((attempt))
637+
local minutes=$((elapsed / 60))
638+
local seconds=$((elapsed % 60))
639+
640+
# Create animated dots with fixed spacing (cycle through 1-3 dots)
641+
local dots=""
642+
case $((attempt % 3)) in
643+
0) dots=". " ;;
644+
1) dots=".. " ;;
645+
2) dots="..." ;;
646+
esac
647+
648+
# Clear line and show progress with fixed spacing
649+
printf "\r\033[KChecking Onyx service%s (%dm %ds elapsed)" "$dots" "$minutes" "$seconds"
650+
651+
sleep 1
652+
attempt=$((attempt + 1))
653+
done
654+
655+
echo "" # New line after the progress line
656+
return 1
657+
}
658+
619659
# Success message
620660
print_step "Installation Complete!"
621661
print_success "All containers are running successfully!"
622662
echo ""
623-
echo -e "${GREEN}${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
624-
echo -e "${GREEN}${BOLD} 🎉 Onyx containers are ready! 🎉${NC}"
625-
echo -e "${GREEN}${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
663+
664+
# Run health check
665+
if check_onyx_health; then
666+
echo ""
667+
echo -e "${GREEN}${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
668+
echo -e "${GREEN}${BOLD} 🎉 Onyx service is ready! 🎉${NC}"
669+
echo -e "${GREEN}${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
670+
else
671+
print_warning "Health check timed out after 10 minutes"
672+
print_info "Containers are running, but the web service may still be initializing (or something went wrong)"
673+
echo ""
674+
echo -e "${YELLOW}${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
675+
echo -e "${YELLOW}${BOLD} ⚠️ Onyx containers are running ⚠️${NC}"
676+
echo -e "${YELLOW}${BOLD}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
677+
fi
626678
echo ""
627679
print_info "Access Onyx at:"
628680
echo -e " ${BOLD}http://localhost:3000${NC}"
629681
echo ""
630-
print_warning "SYSTEM INITIALIZATION IN PROGRESS:"
631-
echo " • Containers are healthy, but full system startup may take 2-5 minutes"
632-
echo " • Database migrations and service initialization are still running"
633-
echo " • The web interface may not be immediately accessible"
634-
echo ""
635682
print_info "If authentication is enabled, you can create your admin account here:"
636683
echo " • Visit http://localhost:3000/auth/signup to create your admin account"
637684
echo " • The first user created will automatically have admin privileges"
638685
echo ""
686+
print_info "Refer to the README in the onyx_data directory for more information."
687+
echo ""
639688
print_info "For help or issues, contact: founders@onyx.app"
640689
echo ""

0 commit comments

Comments
 (0)