diff --git a/bin/wild-setup-docs b/bin/wild-setup-docs new file mode 100755 index 0000000..8c2193a --- /dev/null +++ b/bin/wild-setup-docs @@ -0,0 +1,73 @@ +#!/bin/bash + +set -e +set -o pipefail + +# Parse arguments +UPDATE=false + +while [[ $# -gt 0 ]]; do + case $1 in + --update) + UPDATE=true + shift + ;; + -h|--help) + echo "Usage: $0 [--update]" + echo "" + echo "Copy Wild-Cloud documentation to the current cloud directory." + echo "" + echo "Options:" + echo " --update Update existing docs (overwrite)" + echo " -h, --help Show this help message" + echo "" + exit 0 + ;; + -*) + echo "Unknown option $1" + echo "Usage: $0 [--update]" + exit 1 + ;; + *) + echo "Unexpected argument: $1" + echo "Usage: $0" + exit 1 + ;; + esac +done + +# Initialize Wild-Cloud environment +if [ -z "${WC_ROOT}" ]; then + echo "WC_ROOT is not set." + exit 1 +else + source "${WC_ROOT}/scripts/common.sh" + init_wild_env +fi + +DOCS_DEST="${WC_HOME}/docs" + +# Check if docs already exist +if [ -d "${DOCS_DEST}" ] && [ "${UPDATE}" = false ]; then + echo "Documentation already exists at ${DOCS_DEST}" + read -p "Do you want to update documentation files? (y/N): " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + UPDATE=true + else + echo "Skipping documentation update." + exit 0 + fi +fi + +# Copy docs directory from root to WC_HOME +if [ -d "${WC_ROOT}/docs" ]; then + if [ "${UPDATE}" = true ] && [ -d "${DOCS_DEST}" ]; then + rm -rf "${DOCS_DEST}" + fi + cp -r "${WC_ROOT}/docs" "${DOCS_DEST}" + print_success "Documentation copied to ${DOCS_DEST}" +else + print_error "Source docs directory not found: ${WC_ROOT}/docs" + exit 1 +fi \ No newline at end of file diff --git a/docs/guides/app-workflow.md b/docs/guides/app-workflow.md new file mode 100644 index 0000000..d38f27a --- /dev/null +++ b/docs/guides/app-workflow.md @@ -0,0 +1,46 @@ +# Wild-Cloud App Workflow + +The Wild-cloud app workflow consists of three steps: + +1. **Fetch** - Download raw app templates to cache +2. **Config** - Apply your local configuration to templates +3. **Deploy** - Deploy configured app to Kubernetes + +## Commands + +To list all available apps: + +```bash +wild-apps-list +``` + +To fetch an app template to cache: + +```bash +wild-app-fetch +``` + +To apply your configuration to a cached app (automatically fetches if not cached): + +```bash +wild-app-config +``` + +To deploy a configured app to Kubernetes: + +```bash +wild-app-deploy +``` + +## Quick Setup + +For a complete app setup and deployment: + +```bash +wild-app-config # Fetches if needed, then configures +wild-app-deploy # Deploys to Kubernetes +``` + +## App Directory Structure + +Your wild-cloud apps are stored in the `apps/` directory. You can change them however you like. You should keep them all in git and make commits anytime you change something. Some `wild` commands will overwrite files in your app directory (like when you are updating apps, or updating your configuration) so you'll want to review any changes made to your files after using them using `git`. \ No newline at end of file diff --git a/setup/home-scaffold/docs/node-setup.md b/docs/guides/node-setup.md similarity index 100% rename from setup/home-scaffold/docs/node-setup.md rename to docs/guides/node-setup.md diff --git a/setup/cluster/cert-manager/install.sh b/setup/cluster/cert-manager/install.sh index 2cde8c5..3d28aae 100755 --- a/setup/cluster/cert-manager/install.sh +++ b/setup/cluster/cert-manager/install.sh @@ -2,13 +2,15 @@ set -e set -o pipefail -if [ -z "${WC_HOME}" ]; then - echo "Please source the wildcloud environment first. (e.g., \`source ./env.sh\`)" +# Initialize Wild-Cloud environment +if [ -z "${WC_ROOT}" ]; then + print "WC_ROOT is not set." exit 1 +else + source "${WC_ROOT}/scripts/common.sh" + init_wild_env fi -source "${WC_ROOT}/bin/wild-common.sh" - CLUSTER_SETUP_DIR="${WC_HOME}/setup/cluster" CERT_MANAGER_DIR="${CLUSTER_SETUP_DIR}/cert-manager" diff --git a/setup/cluster/coredns/install.sh b/setup/cluster/coredns/install.sh index f11bbb9..fa67e5f 100755 --- a/setup/cluster/coredns/install.sh +++ b/setup/cluster/coredns/install.sh @@ -2,13 +2,15 @@ set -e set -o pipefail -if [ -z "${WC_HOME}" ]; then - echo "Please source the wildcloud environment first. (e.g., \`source ./env.sh\`)" +# Initialize Wild-Cloud environment +if [ -z "${WC_ROOT}" ]; then + print "WC_ROOT is not set." exit 1 +else + source "${WC_ROOT}/scripts/common.sh" + init_wild_env fi -source "${WC_ROOT}/bin/wild-common.sh" - CLUSTER_SETUP_DIR="${WC_HOME}/setup/cluster" COREDNS_DIR="${CLUSTER_SETUP_DIR}/coredns" diff --git a/setup/cluster/longhorn/install.sh b/setup/cluster/longhorn/install.sh index bf63898..4e8efc4 100755 --- a/setup/cluster/longhorn/install.sh +++ b/setup/cluster/longhorn/install.sh @@ -11,8 +11,6 @@ else init_wild_env fi -source "${WC_ROOT}/bin/wild-common.sh" - CLUSTER_SETUP_DIR="${WC_HOME}/setup/cluster" LONGHORN_DIR="${CLUSTER_SETUP_DIR}/longhorn"