aidevops 2.52.1 → 2.53.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/VERSION +1 -1
- package/aidevops.sh +15 -9
- package/package.json +4 -4
- package/scripts/npm-postinstall.js +6 -7
- package/setup.sh +1 -1
- package/templates/deploy-templates.sh +144 -0
- package/templates/home/.agent/README.md +33 -0
- package/templates/home/AGENTS.md +96 -0
- package/templates/home/git/.agent/README.md +48 -0
- package/templates/home/git/AGENTS.md +97 -0
- package/templates/standard-functions.sh +179 -0
- package/templates/wordpress-performance-workflow.md +217 -0
- package/.agent/AGENTS.md +0 -614
- package/.agent/accounts.md +0 -65
- package/.agent/aidevops/add-new-mcp-to-aidevops.md +0 -456
- package/.agent/aidevops/api-integrations.md +0 -335
- package/.agent/aidevops/architecture.md +0 -510
- package/.agent/aidevops/configs.md +0 -274
- package/.agent/aidevops/docs.md +0 -244
- package/.agent/aidevops/extension.md +0 -311
- package/.agent/aidevops/mcp-integrations.md +0 -340
- package/.agent/aidevops/mcp-troubleshooting.md +0 -162
- package/.agent/aidevops/memory-patterns.md +0 -172
- package/.agent/aidevops/providers.md +0 -217
- package/.agent/aidevops/recommendations.md +0 -321
- package/.agent/aidevops/requirements.md +0 -301
- package/.agent/aidevops/resources.md +0 -214
- package/.agent/aidevops/security-requirements.md +0 -174
- package/.agent/aidevops/security.md +0 -350
- package/.agent/aidevops/service-links.md +0 -400
- package/.agent/aidevops/services.md +0 -357
- package/.agent/aidevops/setup.md +0 -153
- package/.agent/aidevops/troubleshooting.md +0 -389
- package/.agent/aidevops.md +0 -124
- package/.agent/build-plus.md +0 -244
- package/.agent/content/guidelines.md +0 -109
- package/.agent/content.md +0 -87
- package/.agent/health.md +0 -59
- package/.agent/legal.md +0 -59
- package/.agent/loop-state/full-loop.local.md +0 -16
- package/.agent/loop-state/ralph-loop.local.md +0 -10
- package/.agent/marketing.md +0 -440
- package/.agent/memory/README.md +0 -260
- package/.agent/onboarding.md +0 -796
- package/.agent/plan-plus.md +0 -245
- package/.agent/research.md +0 -100
- package/.agent/sales.md +0 -333
- package/.agent/scripts/101domains-helper.sh +0 -701
- package/.agent/scripts/add-missing-returns.sh +0 -140
- package/.agent/scripts/agent-browser-helper.sh +0 -311
- package/.agent/scripts/agno-setup.sh +0 -712
- package/.agent/scripts/ahrefs-mcp-wrapper.js +0 -168
- package/.agent/scripts/aidevops-update-check.sh +0 -71
- package/.agent/scripts/ampcode-cli.sh +0 -522
- package/.agent/scripts/auto-version-bump.sh +0 -156
- package/.agent/scripts/autogen-helper.sh +0 -512
- package/.agent/scripts/beads-sync-helper.sh +0 -596
- package/.agent/scripts/closte-helper.sh +0 -5
- package/.agent/scripts/cloudron-helper.sh +0 -321
- package/.agent/scripts/codacy-cli-chunked.sh +0 -581
- package/.agent/scripts/codacy-cli.sh +0 -442
- package/.agent/scripts/code-audit-helper.sh +0 -5
- package/.agent/scripts/coderabbit-cli.sh +0 -417
- package/.agent/scripts/coderabbit-pro-analysis.sh +0 -238
- package/.agent/scripts/commands/code-simplifier.md +0 -86
- package/.agent/scripts/commands/full-loop.md +0 -246
- package/.agent/scripts/commands/postflight-loop.md +0 -103
- package/.agent/scripts/commands/recall.md +0 -182
- package/.agent/scripts/commands/remember.md +0 -132
- package/.agent/scripts/commands/save-todo.md +0 -175
- package/.agent/scripts/commands/session-review.md +0 -154
- package/.agent/scripts/comprehensive-quality-fix.sh +0 -106
- package/.agent/scripts/context-builder-helper.sh +0 -522
- package/.agent/scripts/coolify-cli-helper.sh +0 -674
- package/.agent/scripts/coolify-helper.sh +0 -380
- package/.agent/scripts/crawl4ai-examples.sh +0 -401
- package/.agent/scripts/crawl4ai-helper.sh +0 -1078
- package/.agent/scripts/crewai-helper.sh +0 -681
- package/.agent/scripts/dev-browser-helper.sh +0 -513
- package/.agent/scripts/dns-helper.sh +0 -396
- package/.agent/scripts/domain-research-helper.sh +0 -917
- package/.agent/scripts/dspy-helper.sh +0 -285
- package/.agent/scripts/dspyground-helper.sh +0 -291
- package/.agent/scripts/eeat-score-helper.sh +0 -1242
- package/.agent/scripts/efficient-return-fix.sh +0 -92
- package/.agent/scripts/extract-opencode-prompts.sh +0 -128
- package/.agent/scripts/find-missing-returns.sh +0 -113
- package/.agent/scripts/fix-auth-headers.sh +0 -104
- package/.agent/scripts/fix-common-strings.sh +0 -254
- package/.agent/scripts/fix-content-type.sh +0 -100
- package/.agent/scripts/fix-error-messages.sh +0 -130
- package/.agent/scripts/fix-misplaced-returns.sh +0 -74
- package/.agent/scripts/fix-remaining-literals.sh +0 -152
- package/.agent/scripts/fix-return-statements.sh +0 -41
- package/.agent/scripts/fix-s131-default-cases.sh +0 -249
- package/.agent/scripts/fix-sc2155-simple.sh +0 -102
- package/.agent/scripts/fix-shellcheck-critical.sh +0 -187
- package/.agent/scripts/fix-string-literals.sh +0 -273
- package/.agent/scripts/full-loop-helper.sh +0 -773
- package/.agent/scripts/generate-opencode-agents.sh +0 -497
- package/.agent/scripts/generate-opencode-commands.sh +0 -1629
- package/.agent/scripts/generate-skills.sh +0 -366
- package/.agent/scripts/git-platforms-helper.sh +0 -640
- package/.agent/scripts/gitea-cli-helper.sh +0 -743
- package/.agent/scripts/github-cli-helper.sh +0 -702
- package/.agent/scripts/gitlab-cli-helper.sh +0 -682
- package/.agent/scripts/gsc-add-user-helper.sh +0 -325
- package/.agent/scripts/gsc-sitemap-helper.sh +0 -678
- package/.agent/scripts/hetzner-helper.sh +0 -485
- package/.agent/scripts/hostinger-helper.sh +0 -229
- package/.agent/scripts/keyword-research-helper.sh +0 -1815
- package/.agent/scripts/langflow-helper.sh +0 -544
- package/.agent/scripts/linkedin-automation.py +0 -241
- package/.agent/scripts/linter-manager.sh +0 -599
- package/.agent/scripts/linters-local.sh +0 -434
- package/.agent/scripts/list-keys-helper.sh +0 -488
- package/.agent/scripts/local-browser-automation.py +0 -339
- package/.agent/scripts/localhost-helper.sh +0 -744
- package/.agent/scripts/loop-common.sh +0 -806
- package/.agent/scripts/mainwp-helper.sh +0 -728
- package/.agent/scripts/markdown-formatter.sh +0 -338
- package/.agent/scripts/markdown-lint-fix.sh +0 -311
- package/.agent/scripts/mass-fix-returns.sh +0 -58
- package/.agent/scripts/mcp-diagnose.sh +0 -167
- package/.agent/scripts/mcp-inspector-helper.sh +0 -449
- package/.agent/scripts/memory-helper.sh +0 -650
- package/.agent/scripts/monitor-code-review.sh +0 -255
- package/.agent/scripts/onboarding-helper.sh +0 -706
- package/.agent/scripts/opencode-github-setup-helper.sh +0 -797
- package/.agent/scripts/opencode-test-helper.sh +0 -213
- package/.agent/scripts/pagespeed-helper.sh +0 -464
- package/.agent/scripts/pandoc-helper.sh +0 -362
- package/.agent/scripts/postflight-check.sh +0 -555
- package/.agent/scripts/pre-commit-hook.sh +0 -259
- package/.agent/scripts/pre-edit-check.sh +0 -169
- package/.agent/scripts/qlty-cli.sh +0 -356
- package/.agent/scripts/quality-cli-manager.sh +0 -525
- package/.agent/scripts/quality-feedback-helper.sh +0 -462
- package/.agent/scripts/quality-fix.sh +0 -263
- package/.agent/scripts/quality-loop-helper.sh +0 -1108
- package/.agent/scripts/ralph-loop-helper.sh +0 -836
- package/.agent/scripts/ralph-upstream-check.sh +0 -341
- package/.agent/scripts/secretlint-helper.sh +0 -847
- package/.agent/scripts/servers-helper.sh +0 -241
- package/.agent/scripts/ses-helper.sh +0 -619
- package/.agent/scripts/session-review-helper.sh +0 -404
- package/.agent/scripts/setup-linters-wizard.sh +0 -379
- package/.agent/scripts/setup-local-api-keys.sh +0 -330
- package/.agent/scripts/setup-mcp-integrations.sh +0 -472
- package/.agent/scripts/shared-constants.sh +0 -246
- package/.agent/scripts/site-crawler-helper.sh +0 -1487
- package/.agent/scripts/snyk-helper.sh +0 -940
- package/.agent/scripts/sonarcloud-autofix.sh +0 -193
- package/.agent/scripts/sonarcloud-cli.sh +0 -191
- package/.agent/scripts/sonarscanner-cli.sh +0 -455
- package/.agent/scripts/spaceship-helper.sh +0 -747
- package/.agent/scripts/stagehand-helper.sh +0 -321
- package/.agent/scripts/stagehand-python-helper.sh +0 -321
- package/.agent/scripts/stagehand-python-setup.sh +0 -441
- package/.agent/scripts/stagehand-setup.sh +0 -439
- package/.agent/scripts/system-cleanup.sh +0 -340
- package/.agent/scripts/terminal-title-helper.sh +0 -388
- package/.agent/scripts/terminal-title-setup.sh +0 -549
- package/.agent/scripts/test-stagehand-both-integration.sh +0 -317
- package/.agent/scripts/test-stagehand-integration.sh +0 -309
- package/.agent/scripts/test-stagehand-python-integration.sh +0 -341
- package/.agent/scripts/todo-ready.sh +0 -263
- package/.agent/scripts/tool-version-check.sh +0 -362
- package/.agent/scripts/toon-helper.sh +0 -469
- package/.agent/scripts/twilio-helper.sh +0 -917
- package/.agent/scripts/updown-helper.sh +0 -279
- package/.agent/scripts/validate-mcp-integrations.sh +0 -250
- package/.agent/scripts/validate-version-consistency.sh +0 -131
- package/.agent/scripts/vaultwarden-helper.sh +0 -597
- package/.agent/scripts/vercel-cli-helper.sh +0 -816
- package/.agent/scripts/verify-mirrors.sh +0 -169
- package/.agent/scripts/version-manager.sh +0 -831
- package/.agent/scripts/webhosting-helper.sh +0 -471
- package/.agent/scripts/webhosting-verify.sh +0 -238
- package/.agent/scripts/wordpress-mcp-helper.sh +0 -508
- package/.agent/scripts/worktree-helper.sh +0 -595
- package/.agent/scripts/worktree-sessions.sh +0 -577
- package/.agent/seo/dataforseo.md +0 -215
- package/.agent/seo/domain-research.md +0 -532
- package/.agent/seo/eeat-score.md +0 -659
- package/.agent/seo/google-search-console.md +0 -366
- package/.agent/seo/gsc-sitemaps.md +0 -282
- package/.agent/seo/keyword-research.md +0 -521
- package/.agent/seo/serper.md +0 -278
- package/.agent/seo/site-crawler.md +0 -387
- package/.agent/seo.md +0 -236
- package/.agent/services/accounting/quickfile.md +0 -159
- package/.agent/services/communications/telfon.md +0 -470
- package/.agent/services/communications/twilio.md +0 -569
- package/.agent/services/crm/fluentcrm.md +0 -449
- package/.agent/services/email/ses.md +0 -399
- package/.agent/services/hosting/101domains.md +0 -378
- package/.agent/services/hosting/closte.md +0 -177
- package/.agent/services/hosting/cloudflare.md +0 -251
- package/.agent/services/hosting/cloudron.md +0 -478
- package/.agent/services/hosting/dns-providers.md +0 -335
- package/.agent/services/hosting/domain-purchasing.md +0 -344
- package/.agent/services/hosting/hetzner.md +0 -327
- package/.agent/services/hosting/hostinger.md +0 -287
- package/.agent/services/hosting/localhost.md +0 -419
- package/.agent/services/hosting/spaceship.md +0 -353
- package/.agent/services/hosting/webhosting.md +0 -330
- package/.agent/social-media.md +0 -69
- package/.agent/templates/plans-template.md +0 -114
- package/.agent/templates/prd-template.md +0 -129
- package/.agent/templates/tasks-template.md +0 -108
- package/.agent/templates/todo-template.md +0 -89
- package/.agent/tools/ai-assistants/agno.md +0 -471
- package/.agent/tools/ai-assistants/capsolver.md +0 -326
- package/.agent/tools/ai-assistants/configuration.md +0 -221
- package/.agent/tools/ai-assistants/overview.md +0 -209
- package/.agent/tools/ai-assistants/status.md +0 -171
- package/.agent/tools/ai-assistants/windsurf.md +0 -193
- package/.agent/tools/ai-orchestration/autogen.md +0 -406
- package/.agent/tools/ai-orchestration/crewai.md +0 -445
- package/.agent/tools/ai-orchestration/langflow.md +0 -405
- package/.agent/tools/ai-orchestration/openprose.md +0 -487
- package/.agent/tools/ai-orchestration/overview.md +0 -362
- package/.agent/tools/ai-orchestration/packaging.md +0 -647
- package/.agent/tools/browser/agent-browser.md +0 -464
- package/.agent/tools/browser/browser-automation.md +0 -400
- package/.agent/tools/browser/chrome-devtools.md +0 -282
- package/.agent/tools/browser/crawl4ai-integration.md +0 -422
- package/.agent/tools/browser/crawl4ai-resources.md +0 -277
- package/.agent/tools/browser/crawl4ai-usage.md +0 -416
- package/.agent/tools/browser/crawl4ai.md +0 -585
- package/.agent/tools/browser/dev-browser.md +0 -341
- package/.agent/tools/browser/pagespeed.md +0 -260
- package/.agent/tools/browser/playwright.md +0 -266
- package/.agent/tools/browser/playwriter.md +0 -310
- package/.agent/tools/browser/stagehand-examples.md +0 -456
- package/.agent/tools/browser/stagehand-python.md +0 -483
- package/.agent/tools/browser/stagehand.md +0 -421
- package/.agent/tools/build-agent/agent-review.md +0 -224
- package/.agent/tools/build-agent/build-agent.md +0 -784
- package/.agent/tools/build-mcp/aidevops-plugin.md +0 -476
- package/.agent/tools/build-mcp/api-wrapper.md +0 -445
- package/.agent/tools/build-mcp/build-mcp.md +0 -240
- package/.agent/tools/build-mcp/deployment.md +0 -401
- package/.agent/tools/build-mcp/server-patterns.md +0 -632
- package/.agent/tools/build-mcp/transports.md +0 -366
- package/.agent/tools/code-review/auditing.md +0 -383
- package/.agent/tools/code-review/automation.md +0 -219
- package/.agent/tools/code-review/best-practices.md +0 -203
- package/.agent/tools/code-review/codacy.md +0 -151
- package/.agent/tools/code-review/code-simplifier.md +0 -174
- package/.agent/tools/code-review/code-standards.md +0 -309
- package/.agent/tools/code-review/coderabbit.md +0 -101
- package/.agent/tools/code-review/management.md +0 -155
- package/.agent/tools/code-review/qlty.md +0 -248
- package/.agent/tools/code-review/secretlint.md +0 -565
- package/.agent/tools/code-review/setup.md +0 -250
- package/.agent/tools/code-review/snyk.md +0 -563
- package/.agent/tools/code-review/tools.md +0 -230
- package/.agent/tools/content/summarize.md +0 -353
- package/.agent/tools/context/augment-context-engine.md +0 -468
- package/.agent/tools/context/context-builder-agent.md +0 -76
- package/.agent/tools/context/context-builder.md +0 -375
- package/.agent/tools/context/context7.md +0 -371
- package/.agent/tools/context/dspy.md +0 -302
- package/.agent/tools/context/dspyground.md +0 -374
- package/.agent/tools/context/llm-tldr.md +0 -219
- package/.agent/tools/context/osgrep.md +0 -488
- package/.agent/tools/context/prompt-optimization.md +0 -338
- package/.agent/tools/context/toon.md +0 -292
- package/.agent/tools/conversion/pandoc.md +0 -304
- package/.agent/tools/credentials/api-key-management.md +0 -154
- package/.agent/tools/credentials/api-key-setup.md +0 -224
- package/.agent/tools/credentials/environment-variables.md +0 -180
- package/.agent/tools/credentials/vaultwarden.md +0 -382
- package/.agent/tools/data-extraction/outscraper.md +0 -974
- package/.agent/tools/deployment/coolify-cli.md +0 -388
- package/.agent/tools/deployment/coolify-setup.md +0 -353
- package/.agent/tools/deployment/coolify.md +0 -345
- package/.agent/tools/deployment/vercel.md +0 -390
- package/.agent/tools/git/authentication.md +0 -132
- package/.agent/tools/git/gitea-cli.md +0 -193
- package/.agent/tools/git/github-actions.md +0 -207
- package/.agent/tools/git/github-cli.md +0 -223
- package/.agent/tools/git/gitlab-cli.md +0 -190
- package/.agent/tools/git/opencode-github-security.md +0 -350
- package/.agent/tools/git/opencode-github.md +0 -328
- package/.agent/tools/git/opencode-gitlab.md +0 -252
- package/.agent/tools/git/security.md +0 -196
- package/.agent/tools/git.md +0 -207
- package/.agent/tools/opencode/oh-my-opencode.md +0 -375
- package/.agent/tools/opencode/opencode-anthropic-auth.md +0 -446
- package/.agent/tools/opencode/opencode.md +0 -651
- package/.agent/tools/social-media/bird.md +0 -437
- package/.agent/tools/task-management/beads.md +0 -336
- package/.agent/tools/terminal/terminal-title.md +0 -251
- package/.agent/tools/ui/shadcn.md +0 -196
- package/.agent/tools/ui/ui-skills.md +0 -115
- package/.agent/tools/wordpress/localwp.md +0 -311
- package/.agent/tools/wordpress/mainwp.md +0 -391
- package/.agent/tools/wordpress/scf.md +0 -527
- package/.agent/tools/wordpress/wp-admin.md +0 -729
- package/.agent/tools/wordpress/wp-dev.md +0 -940
- package/.agent/tools/wordpress/wp-preferred.md +0 -398
- package/.agent/tools/wordpress.md +0 -95
- package/.agent/workflows/branch/bugfix.md +0 -63
- package/.agent/workflows/branch/chore.md +0 -95
- package/.agent/workflows/branch/experiment.md +0 -115
- package/.agent/workflows/branch/feature.md +0 -59
- package/.agent/workflows/branch/hotfix.md +0 -98
- package/.agent/workflows/branch/refactor.md +0 -92
- package/.agent/workflows/branch/release.md +0 -96
- package/.agent/workflows/branch.md +0 -347
- package/.agent/workflows/bug-fixing.md +0 -267
- package/.agent/workflows/changelog.md +0 -129
- package/.agent/workflows/code-audit-remote.md +0 -279
- package/.agent/workflows/conversation-starter.md +0 -69
- package/.agent/workflows/error-feedback.md +0 -578
- package/.agent/workflows/feature-development.md +0 -355
- package/.agent/workflows/git-workflow.md +0 -702
- package/.agent/workflows/multi-repo-workspace.md +0 -268
- package/.agent/workflows/plans.md +0 -709
- package/.agent/workflows/postflight.md +0 -604
- package/.agent/workflows/pr.md +0 -571
- package/.agent/workflows/preflight.md +0 -278
- package/.agent/workflows/ralph-loop.md +0 -773
- package/.agent/workflows/release.md +0 -498
- package/.agent/workflows/session-manager.md +0 -254
- package/.agent/workflows/session-review.md +0 -311
- package/.agent/workflows/sql-migrations.md +0 -631
- package/.agent/workflows/version-bump.md +0 -283
- package/.agent/workflows/wiki-update.md +0 -333
- package/.agent/workflows/worktree.md +0 -477
|
@@ -1,471 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# shellcheck disable=SC2034,SC2155,SC2317,SC2329,SC2016,SC2181,SC1091,SC2154,SC2015,SC2086,SC2129,SC2030,SC2031,SC2119,SC2120,SC2001,SC2162,SC2088,SC2089,SC2090,SC2029,SC2006,SC2153
|
|
3
|
-
|
|
4
|
-
# Web Hosting Helper Script
|
|
5
|
-
# Manages .local domains for web applications in ~/Git
|
|
6
|
-
# Compatible with LocalWP and standalone nginx setups
|
|
7
|
-
|
|
8
|
-
# Source shared constants if available
|
|
9
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit
|
|
10
|
-
source "$SCRIPT_DIR/shared-constants.sh" 2>/dev/null || true
|
|
11
|
-
|
|
12
|
-
# Colors for output
|
|
13
|
-
GREEN='\033[0;32m'
|
|
14
|
-
BLUE='\033[0;34m'
|
|
15
|
-
YELLOW='\033[1;33m'
|
|
16
|
-
RED='\033[0;31m'
|
|
17
|
-
PURPLE='\033[0;35m'
|
|
18
|
-
NC='\033[0m' # No Color
|
|
19
|
-
|
|
20
|
-
# Configuration
|
|
21
|
-
CERT_DIR="$HOME/.localhost-setup/certs"
|
|
22
|
-
NGINX_CONF_DIR="/Users/$(whoami)/Library/Application Support/Local/run/router/nginx/conf"
|
|
23
|
-
GIT_DIR="$HOME/Git"
|
|
24
|
-
# CONFIG_FILE="../configs/webhosting-config.json" # Reserved for future use
|
|
25
|
-
|
|
26
|
-
print_header() {
|
|
27
|
-
local message="$1"
|
|
28
|
-
echo -e "${PURPLE}================================${NC}"
|
|
29
|
-
echo -e "${PURPLE}$message${NC}"
|
|
30
|
-
echo -e "${PURPLE}================================${NC}"
|
|
31
|
-
return 0
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
print_info() {
|
|
35
|
-
local message="$1"
|
|
36
|
-
echo -e "${BLUE}[INFO]${NC} $message"
|
|
37
|
-
return 0
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
print_success() {
|
|
41
|
-
local message="$1"
|
|
42
|
-
echo -e "${GREEN}[SUCCESS]${NC} $message"
|
|
43
|
-
return 0
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
print_warning() {
|
|
47
|
-
local message="$1"
|
|
48
|
-
echo -e "${YELLOW}[WARNING]${NC} $message"
|
|
49
|
-
return 0
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
print_error() {
|
|
53
|
-
local message="$1"
|
|
54
|
-
echo -e "${RED}[ERROR]${NC} $message" >&2
|
|
55
|
-
return 0
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
# Check if LocalWP is available
|
|
59
|
-
check_localwp() {
|
|
60
|
-
if [[ -d "/Applications/Local.app" ]] || [[ -d "$HOME/Applications/Local.app" ]]; then
|
|
61
|
-
if [[ -d "$NGINX_CONF_DIR" ]]; then
|
|
62
|
-
print_success "LocalWP nginx router detected - using existing setup"
|
|
63
|
-
return 0
|
|
64
|
-
else
|
|
65
|
-
print_warning "LocalWP found but nginx router not running"
|
|
66
|
-
return 1
|
|
67
|
-
fi
|
|
68
|
-
else
|
|
69
|
-
print_info "LocalWP not found - standalone mode"
|
|
70
|
-
return 1
|
|
71
|
-
fi
|
|
72
|
-
return 0
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
# Detect web application type and default port
|
|
76
|
-
detect_webapp_type() {
|
|
77
|
-
local project_dir="$1"
|
|
78
|
-
|
|
79
|
-
if [[ -f "$project_dir/package.json" ]]; then
|
|
80
|
-
if grep -q "next" "$project_dir/package.json"; then
|
|
81
|
-
echo "nextjs:3000"
|
|
82
|
-
elif grep -q "react" "$project_dir/package.json"; then
|
|
83
|
-
echo "react:3000"
|
|
84
|
-
elif grep -q "vue" "$project_dir/package.json"; then
|
|
85
|
-
echo "vue:3000"
|
|
86
|
-
elif grep -q "nuxt" "$project_dir/package.json"; then
|
|
87
|
-
echo "nuxt:3000"
|
|
88
|
-
elif grep -q "svelte" "$project_dir/package.json"; then
|
|
89
|
-
echo "svelte:5173"
|
|
90
|
-
elif grep -q "vite" "$project_dir/package.json"; then
|
|
91
|
-
echo "vite:5173"
|
|
92
|
-
else
|
|
93
|
-
echo "node:3000"
|
|
94
|
-
fi
|
|
95
|
-
elif [[ -f "$project_dir/Gemfile" ]]; then
|
|
96
|
-
echo "rails:3000"
|
|
97
|
-
elif [[ -f "$project_dir/requirements.txt" ]] || [[ -f "$project_dir/pyproject.toml" ]]; then
|
|
98
|
-
echo "python:8000"
|
|
99
|
-
elif [[ -f "$project_dir/Cargo.toml" ]]; then
|
|
100
|
-
echo "rust:8000"
|
|
101
|
-
elif [[ -f "$project_dir/go.mod" ]]; then
|
|
102
|
-
echo "go:8080"
|
|
103
|
-
elif [[ -f "$project_dir/composer.json" ]]; then
|
|
104
|
-
echo "php:8000"
|
|
105
|
-
else
|
|
106
|
-
echo "unknown:3000"
|
|
107
|
-
fi
|
|
108
|
-
return 0
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
# Generate SSL certificate
|
|
112
|
-
generate_ssl_cert() {
|
|
113
|
-
local domain="$1"
|
|
114
|
-
|
|
115
|
-
print_info "Generating SSL certificate for $domain..."
|
|
116
|
-
mkdir -p "$CERT_DIR"
|
|
117
|
-
|
|
118
|
-
if [[ -f "$CERT_DIR/$domain.crt" ]]; then
|
|
119
|
-
print_warning "SSL certificate already exists for $domain"
|
|
120
|
-
return 0
|
|
121
|
-
fi
|
|
122
|
-
|
|
123
|
-
openssl req -x509 -newkey rsa:2048 \
|
|
124
|
-
-keyout "$CERT_DIR/$domain.key" \
|
|
125
|
-
-out "$CERT_DIR/$domain.crt" \
|
|
126
|
-
-days 365 -nodes \
|
|
127
|
-
-subj "/C=US/ST=Local/L=Local/O=Local Development/CN=$domain" \
|
|
128
|
-
2>/dev/null
|
|
129
|
-
|
|
130
|
-
print_success "SSL certificate generated for $domain"
|
|
131
|
-
return 0
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
# Create nginx configuration for LocalWP router
|
|
135
|
-
create_localwp_nginx_config() {
|
|
136
|
-
local domain="$1"
|
|
137
|
-
local port="$2"
|
|
138
|
-
local webapp_type="$3"
|
|
139
|
-
|
|
140
|
-
print_info "Creating LocalWP nginx configuration for $domain..."
|
|
141
|
-
|
|
142
|
-
local nginx_conf="$NGINX_CONF_DIR/route.$domain.conf"
|
|
143
|
-
|
|
144
|
-
if [[ -f "$nginx_conf" ]]; then
|
|
145
|
-
print_warning "Nginx configuration exists, backing up..."
|
|
146
|
-
cp "$nginx_conf" "$nginx_conf.backup.$(date +%s)"
|
|
147
|
-
fi
|
|
148
|
-
|
|
149
|
-
# Create nginx configuration based on webapp type
|
|
150
|
-
# NOSONAR - HTTP used for localhost proxy_pass is safe (internal traffic only)
|
|
151
|
-
cat > "$nginx_conf" << EOF
|
|
152
|
-
# Local Development Site: $domain ($webapp_type)
|
|
153
|
-
server {
|
|
154
|
-
listen 80;
|
|
155
|
-
server_name $domain;
|
|
156
|
-
|
|
157
|
-
# Redirect HTTP to HTTPS
|
|
158
|
-
return 301 https://\$server_name\$request_uri;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
server {
|
|
162
|
-
listen 443 ssl;
|
|
163
|
-
http2 on;
|
|
164
|
-
server_name $domain;
|
|
165
|
-
|
|
166
|
-
# SSL Configuration
|
|
167
|
-
ssl_certificate "$CERT_DIR/$domain.crt";
|
|
168
|
-
ssl_certificate_key "$CERT_DIR/$domain.key";
|
|
169
|
-
ssl_protocols TLSv1.2 TLSv1.3;
|
|
170
|
-
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384;
|
|
171
|
-
ssl_prefer_server_ciphers off;
|
|
172
|
-
|
|
173
|
-
# Proxy to local development server
|
|
174
|
-
location / {
|
|
175
|
-
proxy_pass http://127.0.0.1:$port;
|
|
176
|
-
proxy_http_version 1.1;
|
|
177
|
-
proxy_set_header Upgrade \$http_upgrade;
|
|
178
|
-
proxy_set_header Connection 'upgrade';
|
|
179
|
-
proxy_set_header Host \$host;
|
|
180
|
-
proxy_set_header X-Real-IP \$remote_addr;
|
|
181
|
-
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
|
182
|
-
proxy_set_header X-Forwarded-Proto \$scheme;
|
|
183
|
-
proxy_cache_bypass \$http_upgrade;
|
|
184
|
-
proxy_read_timeout 86400;
|
|
185
|
-
}
|
|
186
|
-
EOF
|
|
187
|
-
|
|
188
|
-
# Add framework-specific configurations
|
|
189
|
-
case "$webapp_type" in
|
|
190
|
-
"nextjs"|"react"|"vue"|"nuxt")
|
|
191
|
-
cat >> "$nginx_conf" << EOF
|
|
192
|
-
|
|
193
|
-
# Handle WebSocket connections for hot reload
|
|
194
|
-
location /_next/webpack-hmr {
|
|
195
|
-
proxy_pass http://127.0.0.1:$port;
|
|
196
|
-
proxy_http_version 1.1;
|
|
197
|
-
proxy_set_header Upgrade \$http_upgrade;
|
|
198
|
-
proxy_set_header Connection "upgrade";
|
|
199
|
-
proxy_set_header Host \$host;
|
|
200
|
-
proxy_set_header X-Real-IP \$remote_addr;
|
|
201
|
-
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
|
|
202
|
-
proxy_set_header X-Forwarded-Proto \$scheme;
|
|
203
|
-
}
|
|
204
|
-
EOF
|
|
205
|
-
;;
|
|
206
|
-
"vite"|"svelte")
|
|
207
|
-
cat >> "$nginx_conf" << EOF
|
|
208
|
-
|
|
209
|
-
# Handle Vite HMR WebSocket
|
|
210
|
-
location /vite-dev-server {
|
|
211
|
-
proxy_pass http://127.0.0.1:$port;
|
|
212
|
-
proxy_http_version 1.1;
|
|
213
|
-
proxy_set_header Upgrade \$http_upgrade;
|
|
214
|
-
proxy_set_header Connection "upgrade";
|
|
215
|
-
proxy_set_header Host \$host;
|
|
216
|
-
}
|
|
217
|
-
EOF
|
|
218
|
-
;;
|
|
219
|
-
*)
|
|
220
|
-
# No additional configuration needed for other webapp types
|
|
221
|
-
;;
|
|
222
|
-
esac
|
|
223
|
-
|
|
224
|
-
echo "}" >> "$nginx_conf"
|
|
225
|
-
|
|
226
|
-
print_success "LocalWP nginx configuration created for $domain"
|
|
227
|
-
return 0
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
# Add domain to hosts file
|
|
231
|
-
add_to_hosts() {
|
|
232
|
-
local domain="$1"
|
|
233
|
-
|
|
234
|
-
if grep -q "$domain" /etc/hosts; then
|
|
235
|
-
print_warning "Domain $domain already exists in hosts file"
|
|
236
|
-
return 0
|
|
237
|
-
fi
|
|
238
|
-
|
|
239
|
-
print_info "Adding $domain to /etc/hosts (requires sudo)..."
|
|
240
|
-
echo "127.0.0.1 $domain" | sudo tee -a /etc/hosts > /dev/null
|
|
241
|
-
print_success "Domain added to hosts file"
|
|
242
|
-
return 0
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
# Reload nginx
|
|
246
|
-
reload_nginx() {
|
|
247
|
-
print_info "Reloading nginx configuration..."
|
|
248
|
-
|
|
249
|
-
local nginx_pid
|
|
250
|
-
nginx_pid=$(pgrep -f "nginx.*router" | head -1)
|
|
251
|
-
if [[ -n "$nginx_pid" ]]; then
|
|
252
|
-
kill -HUP "$nginx_pid"
|
|
253
|
-
print_success "Nginx configuration reloaded"
|
|
254
|
-
else
|
|
255
|
-
print_warning "Nginx router not running - configuration will be loaded when it starts"
|
|
256
|
-
fi
|
|
257
|
-
return 0
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
# Setup a new local domain
|
|
261
|
-
setup_domain() {
|
|
262
|
-
local project_name="$1"
|
|
263
|
-
local port="$2"
|
|
264
|
-
|
|
265
|
-
if [[ -z "$project_name" ]]; then
|
|
266
|
-
print_error "Project name is required"
|
|
267
|
-
exit 1
|
|
268
|
-
fi
|
|
269
|
-
|
|
270
|
-
local project_dir="$GIT_DIR/$project_name"
|
|
271
|
-
local domain="$project_name.local"
|
|
272
|
-
|
|
273
|
-
if [[ ! -d "$project_dir" ]]; then
|
|
274
|
-
print_error "Project directory does not exist: $project_dir"
|
|
275
|
-
exit 1
|
|
276
|
-
fi
|
|
277
|
-
|
|
278
|
-
print_header "Setting up $domain"
|
|
279
|
-
|
|
280
|
-
# Detect webapp type and default port if not specified
|
|
281
|
-
local webapp_info
|
|
282
|
-
webapp_info=$(detect_webapp_type "$project_dir")
|
|
283
|
-
local webapp_type="${webapp_info%:*}"
|
|
284
|
-
local default_port="${webapp_info#*:}"
|
|
285
|
-
|
|
286
|
-
# Use provided port or default
|
|
287
|
-
port="${port:-$default_port}"
|
|
288
|
-
|
|
289
|
-
print_info "Detected: $webapp_type application"
|
|
290
|
-
print_info "Using port: $port"
|
|
291
|
-
|
|
292
|
-
# Generate SSL certificate
|
|
293
|
-
generate_ssl_cert "$domain"
|
|
294
|
-
|
|
295
|
-
# Check if LocalWP is available and create appropriate config
|
|
296
|
-
if check_localwp; then
|
|
297
|
-
create_localwp_nginx_config "$domain" "$port" "$webapp_type"
|
|
298
|
-
reload_nginx
|
|
299
|
-
else
|
|
300
|
-
print_warning "LocalWP not available - manual nginx setup required"
|
|
301
|
-
print_info "See documentation for standalone nginx setup"
|
|
302
|
-
fi
|
|
303
|
-
|
|
304
|
-
# Add to hosts file
|
|
305
|
-
add_to_hosts "$domain"
|
|
306
|
-
|
|
307
|
-
print_success "Local domain setup complete!"
|
|
308
|
-
echo ""
|
|
309
|
-
echo -e "${GREEN}✅ Domain configured: https://$domain${NC}"
|
|
310
|
-
echo ""
|
|
311
|
-
echo -e "${YELLOW}⚠️ CRITICAL STEP REQUIRED:${NC}"
|
|
312
|
-
echo -e "${RED}The domain is NOT yet accessible because it's missing from /etc/hosts${NC}"
|
|
313
|
-
echo ""
|
|
314
|
-
echo -e "${BLUE}📝 Complete these steps to finish setup:${NC}"
|
|
315
|
-
echo ""
|
|
316
|
-
echo -e "${YELLOW}1. Add domain to hosts file (REQUIRED):${NC}"
|
|
317
|
-
echo " echo \"127.0.0.1 $domain\" | sudo tee -a /etc/hosts"
|
|
318
|
-
echo ""
|
|
319
|
-
echo -e "${YELLOW}2. Start your development server on port $port:${NC}"
|
|
320
|
-
echo " cd ~/Git/$project_name" || exit
|
|
321
|
-
echo " PORT=$port npm run dev # or pnpm dev, yarn dev"
|
|
322
|
-
echo ""
|
|
323
|
-
echo -e "${YELLOW}3. Visit https://$domain in your browser${NC}"
|
|
324
|
-
echo ""
|
|
325
|
-
echo -e "${YELLOW}4. Handle SSL certificate warning:${NC}"
|
|
326
|
-
echo " Browser will show: \"Your connection is not private\""
|
|
327
|
-
echo " Click: \"Proceed to $domain (unsafe)\""
|
|
328
|
-
echo ""
|
|
329
|
-
echo -e "${GREEN}5. Verify success:${NC}"
|
|
330
|
-
echo " - HTTP redirect: http://$domain → https://$domain"
|
|
331
|
-
echo " - HTTPS access: https://$domain shows your app"
|
|
332
|
-
echo ""
|
|
333
|
-
return 0
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
# List configured domains
|
|
337
|
-
list_domains() {
|
|
338
|
-
print_header "Configured Local Domains"
|
|
339
|
-
|
|
340
|
-
if check_localwp; then
|
|
341
|
-
local found_domains=false
|
|
342
|
-
|
|
343
|
-
for conf_file in "$NGINX_CONF_DIR"/route.*.local.conf; do
|
|
344
|
-
if [[ -f "$conf_file" ]]; then
|
|
345
|
-
local domain
|
|
346
|
-
domain=$(basename "$conf_file" | sed 's/route\.\(.*\)\.conf/\1/')
|
|
347
|
-
local port
|
|
348
|
-
port=$(grep "proxy_pass" "$conf_file" | head -1 | sed 's/.*127\.0\.0\.1:\([0-9]*\).*/\1/')
|
|
349
|
-
local status="❌ Not running"
|
|
350
|
-
|
|
351
|
-
# Check if port is in use
|
|
352
|
-
if lsof -i ":$port" >/dev/null 2>&1; then
|
|
353
|
-
status="✅ Running"
|
|
354
|
-
fi
|
|
355
|
-
|
|
356
|
-
echo -e "${BLUE}🌐 https://$domain${NC} → Port $port $status"
|
|
357
|
-
found_domains=true
|
|
358
|
-
fi
|
|
359
|
-
done
|
|
360
|
-
|
|
361
|
-
if [[ "$found_domains" == false ]]; then
|
|
362
|
-
print_warning "No local domains configured"
|
|
363
|
-
fi
|
|
364
|
-
else
|
|
365
|
-
print_warning "LocalWP not available - cannot list domains"
|
|
366
|
-
fi
|
|
367
|
-
return 0
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
# Remove a domain
|
|
371
|
-
remove_domain() {
|
|
372
|
-
local project_name="$1"
|
|
373
|
-
|
|
374
|
-
if [[ -z "$project_name" ]]; then
|
|
375
|
-
print_error "Project name is required"
|
|
376
|
-
exit 1
|
|
377
|
-
fi
|
|
378
|
-
|
|
379
|
-
local domain="$project_name.local"
|
|
380
|
-
|
|
381
|
-
print_header "Removing $domain"
|
|
382
|
-
|
|
383
|
-
if check_localwp; then
|
|
384
|
-
local nginx_conf="$NGINX_CONF_DIR/route.$domain.conf"
|
|
385
|
-
|
|
386
|
-
# Remove nginx configuration
|
|
387
|
-
if [[ -f "$nginx_conf" ]]; then
|
|
388
|
-
rm "$nginx_conf"
|
|
389
|
-
print_success "Nginx configuration removed"
|
|
390
|
-
reload_nginx
|
|
391
|
-
else
|
|
392
|
-
print_warning "Nginx configuration not found"
|
|
393
|
-
fi
|
|
394
|
-
fi
|
|
395
|
-
|
|
396
|
-
# Remove SSL certificates
|
|
397
|
-
if [[ -f "$CERT_DIR/$domain.crt" ]]; then
|
|
398
|
-
rm "$CERT_DIR/$domain.crt" "$CERT_DIR/$domain.key"
|
|
399
|
-
print_success "SSL certificates removed"
|
|
400
|
-
else
|
|
401
|
-
print_warning "SSL certificates not found"
|
|
402
|
-
fi
|
|
403
|
-
|
|
404
|
-
# Remove from hosts file (requires manual intervention due to sudo)
|
|
405
|
-
if grep -q "$domain" /etc/hosts; then
|
|
406
|
-
print_warning "Please manually remove '$domain' from /etc/hosts"
|
|
407
|
-
print_info "Run: sudo sed -i '' '/$domain/d' /etc/hosts"
|
|
408
|
-
fi
|
|
409
|
-
|
|
410
|
-
print_success "Domain removal complete!"
|
|
411
|
-
return 0
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
# Show help
|
|
415
|
-
show_help() {
|
|
416
|
-
echo "Web Hosting Helper - Local Domain Management"
|
|
417
|
-
echo ""
|
|
418
|
-
echo "Usage: $0 [command] [options]"
|
|
419
|
-
echo ""
|
|
420
|
-
echo "Commands:"
|
|
421
|
-
echo " setup <project-name> [port] Setup local domain for project"
|
|
422
|
-
echo " list List all configured domains"
|
|
423
|
-
echo " remove <project-name> Remove local domain configuration"
|
|
424
|
-
echo " help Show this help message"
|
|
425
|
-
echo ""
|
|
426
|
-
echo "Examples:"
|
|
427
|
-
echo " $0 setup myapp 3000"
|
|
428
|
-
echo " $0 setup webapp-source 3001"
|
|
429
|
-
echo " $0 list"
|
|
430
|
-
echo " $0 remove myapp"
|
|
431
|
-
echo ""
|
|
432
|
-
echo "Supported frameworks:"
|
|
433
|
-
echo " - Next.js, React, Vue, Nuxt (port 3000)"
|
|
434
|
-
echo " - Vite, Svelte (port 5173)"
|
|
435
|
-
echo " - Rails (port 3000)"
|
|
436
|
-
echo " - Python/Django (port 8000)"
|
|
437
|
-
echo " - Go (port 8080)"
|
|
438
|
-
echo " - PHP (port 8000)"
|
|
439
|
-
echo ""
|
|
440
|
-
echo "Requirements:"
|
|
441
|
-
echo " - LocalWP (recommended) or standalone nginx"
|
|
442
|
-
echo " - OpenSSL for certificate generation"
|
|
443
|
-
echo " - sudo access for hosts file modification"
|
|
444
|
-
echo ""
|
|
445
|
-
return 0
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
# Main script logic
|
|
449
|
-
main() {
|
|
450
|
-
local command="${1:-help}"
|
|
451
|
-
local project_name="$2"
|
|
452
|
-
local port="$3"
|
|
453
|
-
|
|
454
|
-
case "$command" in
|
|
455
|
-
"setup")
|
|
456
|
-
setup_domain "$project_name" "$port"
|
|
457
|
-
;;
|
|
458
|
-
"list")
|
|
459
|
-
list_domains
|
|
460
|
-
;;
|
|
461
|
-
"remove")
|
|
462
|
-
remove_domain "$project_name"
|
|
463
|
-
;;
|
|
464
|
-
"help"|*)
|
|
465
|
-
show_help
|
|
466
|
-
;;
|
|
467
|
-
esac
|
|
468
|
-
return 0
|
|
469
|
-
}
|
|
470
|
-
|
|
471
|
-
main "$@"
|
|
@@ -1,238 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
# shellcheck disable=SC2034,SC2155,SC2317,SC2329,SC2016,SC2181,SC1091,SC2154,SC2015,SC2086,SC2129,SC2030,SC2031,SC2119,SC2120,SC2001,SC2162,SC2088,SC2089,SC2090,SC2029,SC2006,SC2153
|
|
3
|
-
|
|
4
|
-
# Web Hosting Verification Script
|
|
5
|
-
# Verifies local domain setup and provides detailed troubleshooting
|
|
6
|
-
|
|
7
|
-
# Source shared constants if available
|
|
8
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit
|
|
9
|
-
source "$SCRIPT_DIR/shared-constants.sh" 2>/dev/null || true
|
|
10
|
-
|
|
11
|
-
# Colors for output
|
|
12
|
-
GREEN='\033[0;32m'
|
|
13
|
-
BLUE='\033[0;34m'
|
|
14
|
-
YELLOW='\033[1;33m'
|
|
15
|
-
RED='\033[0;31m'
|
|
16
|
-
PURPLE='\033[0;35m'
|
|
17
|
-
NC='\033[0m' # No Color
|
|
18
|
-
|
|
19
|
-
# Configuration
|
|
20
|
-
CERT_DIR="$HOME/.localhost-setup/certs"
|
|
21
|
-
NGINX_CONF_DIR="/Users/$(whoami)/Library/Application Support/Local/run/router/nginx/conf"
|
|
22
|
-
GIT_DIR="$HOME/Git"
|
|
23
|
-
|
|
24
|
-
print_header() {
|
|
25
|
-
local message="$1"
|
|
26
|
-
echo -e "${PURPLE}================================${NC}"
|
|
27
|
-
echo -e "${PURPLE}$message${NC}"
|
|
28
|
-
echo -e "${PURPLE}================================${NC}"
|
|
29
|
-
return 0
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
print_info() {
|
|
33
|
-
local message="$1"
|
|
34
|
-
echo -e "${BLUE}[INFO]${NC} $message"
|
|
35
|
-
return 0
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
print_success() {
|
|
39
|
-
local message="$1"
|
|
40
|
-
echo -e "${GREEN}[SUCCESS]${NC} $message"
|
|
41
|
-
return 0
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
print_warning() {
|
|
45
|
-
local message="$1"
|
|
46
|
-
echo -e "${YELLOW}[WARNING]${NC} $message"
|
|
47
|
-
return 0
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
print_error() {
|
|
51
|
-
local message="$1"
|
|
52
|
-
echo -e "${RED}[ERROR]${NC} $message" >&2
|
|
53
|
-
return 0
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
# Verify domain setup
|
|
57
|
-
verify_domain() {
|
|
58
|
-
local project_name="$1"
|
|
59
|
-
|
|
60
|
-
if [[ -z "$project_name" ]]; then
|
|
61
|
-
print_error "Project name is required"
|
|
62
|
-
exit 1
|
|
63
|
-
fi
|
|
64
|
-
|
|
65
|
-
local domain="$project_name.local"
|
|
66
|
-
local project_dir="$GIT_DIR/$project_name"
|
|
67
|
-
|
|
68
|
-
print_header "Verifying $domain Setup"
|
|
69
|
-
|
|
70
|
-
local all_checks_passed=true
|
|
71
|
-
|
|
72
|
-
# Check 1: Project directory exists
|
|
73
|
-
echo -e "${BLUE}1. Checking project directory...${NC}"
|
|
74
|
-
if [[ -d "$project_dir" ]]; then
|
|
75
|
-
print_success "Project directory exists: $project_dir"
|
|
76
|
-
else
|
|
77
|
-
print_error "Project directory not found: $project_dir"
|
|
78
|
-
all_checks_passed=false
|
|
79
|
-
fi
|
|
80
|
-
|
|
81
|
-
# Check 2: Hosts file entry
|
|
82
|
-
echo -e "${BLUE}2. Checking hosts file...${NC}"
|
|
83
|
-
if grep -q "$domain" /etc/hosts; then
|
|
84
|
-
print_success "Domain found in /etc/hosts"
|
|
85
|
-
else
|
|
86
|
-
print_error "Domain NOT found in /etc/hosts"
|
|
87
|
-
print_warning "Fix: echo \"127.0.0.1 $domain\" | sudo tee -a /etc/hosts"
|
|
88
|
-
all_checks_passed=false
|
|
89
|
-
fi
|
|
90
|
-
|
|
91
|
-
# Check 3: Nginx configuration
|
|
92
|
-
echo -e "${BLUE}3. Checking nginx configuration...${NC}"
|
|
93
|
-
local nginx_conf="$NGINX_CONF_DIR/route.$domain.conf"
|
|
94
|
-
if [[ -f "$nginx_conf" ]]; then
|
|
95
|
-
print_success "Nginx configuration exists"
|
|
96
|
-
|
|
97
|
-
# Check port configuration
|
|
98
|
-
local port
|
|
99
|
-
port=$(grep "proxy_pass" "$nginx_conf" | head -1 | sed 's/.*127\.0\.0\.1:\([0-9]*\).*/\1/')
|
|
100
|
-
if [[ -n "$port" ]]; then
|
|
101
|
-
print_info "Configured port: $port"
|
|
102
|
-
else
|
|
103
|
-
print_warning "Could not determine configured port"
|
|
104
|
-
fi
|
|
105
|
-
else
|
|
106
|
-
print_error "Nginx configuration missing: $nginx_conf"
|
|
107
|
-
all_checks_passed=false
|
|
108
|
-
fi
|
|
109
|
-
|
|
110
|
-
# Check 4: SSL certificates
|
|
111
|
-
echo -e "${BLUE}4. Checking SSL certificates...${NC}"
|
|
112
|
-
if [[ -f "$CERT_DIR/$domain.crt" && -f "$CERT_DIR/$domain.key" ]]; then
|
|
113
|
-
print_success "SSL certificates exist"
|
|
114
|
-
|
|
115
|
-
# Check certificate validity
|
|
116
|
-
local cert_info
|
|
117
|
-
if cert_info=$(openssl x509 -in "$CERT_DIR/$domain.crt" -noout -dates 2>/dev/null); then
|
|
118
|
-
print_info "Certificate info: $cert_info"
|
|
119
|
-
fi
|
|
120
|
-
else
|
|
121
|
-
print_error "SSL certificates missing"
|
|
122
|
-
all_checks_passed=false
|
|
123
|
-
fi
|
|
124
|
-
|
|
125
|
-
# Check 5: LocalWP nginx router
|
|
126
|
-
echo -e "${BLUE}5. Checking nginx router...${NC}"
|
|
127
|
-
if pgrep -f "nginx.*router" >/dev/null; then
|
|
128
|
-
print_success "Nginx router is running"
|
|
129
|
-
else
|
|
130
|
-
print_error "Nginx router not running"
|
|
131
|
-
print_warning "Start LocalWP application or check nginx status"
|
|
132
|
-
all_checks_passed=false
|
|
133
|
-
fi
|
|
134
|
-
|
|
135
|
-
# Check 6: Development server (if hosts file is correct)
|
|
136
|
-
if grep -q "$domain" /etc/hosts && [[ -n "$port" ]]; then
|
|
137
|
-
echo -e "${BLUE}6. Checking development server...${NC}"
|
|
138
|
-
if lsof -i ":$port" >/dev/null 2>&1; then
|
|
139
|
-
print_success "Development server running on port $port"
|
|
140
|
-
else
|
|
141
|
-
print_warning "No service running on port $port"
|
|
142
|
-
print_info "Start with: cd $project_dir && PORT=$port npm run dev" || exit
|
|
143
|
-
fi
|
|
144
|
-
|
|
145
|
-
# Check 7: DNS resolution
|
|
146
|
-
echo -e "${BLUE}7. Testing DNS resolution...${NC}"
|
|
147
|
-
if ping -c 1 "$domain" >/dev/null 2>&1; then
|
|
148
|
-
print_success "Domain resolves to localhost"
|
|
149
|
-
else
|
|
150
|
-
print_error "Domain resolution failed"
|
|
151
|
-
all_checks_passed=false
|
|
152
|
-
fi
|
|
153
|
-
|
|
154
|
-
# Check 8: HTTP redirect
|
|
155
|
-
echo -e "${BLUE}8. Testing HTTP redirect...${NC}"
|
|
156
|
-
local http_response
|
|
157
|
-
# NOSONAR - Testing HTTP to HTTPS redirect behavior requires HTTP request
|
|
158
|
-
http_response=$(curl -s -o /dev/null -w "%{http_code}" "http://$domain" 2>/dev/null || echo "000")
|
|
159
|
-
if [[ "$http_response" == "301" ]]; then
|
|
160
|
-
print_success "HTTP redirects to HTTPS (301)"
|
|
161
|
-
else
|
|
162
|
-
print_warning "HTTP redirect test failed (got $http_response)"
|
|
163
|
-
if [[ "$http_response" == "000" ]]; then
|
|
164
|
-
print_info "This may be normal if development server is not running"
|
|
165
|
-
fi
|
|
166
|
-
fi
|
|
167
|
-
|
|
168
|
-
# Check 9: HTTPS connection (with SSL verification)
|
|
169
|
-
echo -e "${BLUE}9. Testing HTTPS connection...${NC}"
|
|
170
|
-
local https_response
|
|
171
|
-
# First try with SSL verification enabled (secure)
|
|
172
|
-
https_response=$(curl -s -o /dev/null -w "%{http_code}" --connect-timeout 10 "https://$domain" 2>/dev/null || echo "000")
|
|
173
|
-
if [[ "$https_response" == "200" ]]; then
|
|
174
|
-
print_success "HTTPS connection successful with valid SSL (200)"
|
|
175
|
-
elif [[ "$https_response" == "000" ]]; then
|
|
176
|
-
# SSL verification may have failed - this could indicate self-signed cert
|
|
177
|
-
print_warning "HTTPS connection failed - SSL certificate may be invalid or self-signed"
|
|
178
|
-
print_info "This may be normal for local development environments"
|
|
179
|
-
else
|
|
180
|
-
print_warning "HTTPS connection test failed (got $https_response)"
|
|
181
|
-
fi
|
|
182
|
-
fi
|
|
183
|
-
|
|
184
|
-
echo ""
|
|
185
|
-
if [[ "$all_checks_passed" == true ]]; then
|
|
186
|
-
print_success "All critical checks passed!"
|
|
187
|
-
echo ""
|
|
188
|
-
echo -e "${GREEN}✅ Domain is ready: https://$domain${NC}"
|
|
189
|
-
echo ""
|
|
190
|
-
echo -e "${BLUE}Next steps:${NC}"
|
|
191
|
-
echo "1. Start development server: cd $project_dir && PORT=$port npm run dev" || exit
|
|
192
|
-
echo "2. Visit: https://$domain"
|
|
193
|
-
echo "3. Accept SSL certificate warning in browser"
|
|
194
|
-
else
|
|
195
|
-
print_error "Some checks failed - see messages above for fixes"
|
|
196
|
-
echo ""
|
|
197
|
-
echo -e "${YELLOW}Common fixes:${NC}"
|
|
198
|
-
echo "• Add to hosts: echo \"127.0.0.1 $domain\" | sudo tee -a /etc/hosts"
|
|
199
|
-
echo "• Setup domain: ./webhosting-helper.sh setup $project_name"
|
|
200
|
-
echo "• Start LocalWP application"
|
|
201
|
-
fi
|
|
202
|
-
return 0
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
# Show help
|
|
206
|
-
show_help() {
|
|
207
|
-
echo "Web Hosting Verification Script"
|
|
208
|
-
echo ""
|
|
209
|
-
echo "Usage: $0 [command] [options]"
|
|
210
|
-
echo ""
|
|
211
|
-
echo "Commands:"
|
|
212
|
-
echo " verify <project-name> Verify local domain setup"
|
|
213
|
-
echo " help Show this help message"
|
|
214
|
-
echo ""
|
|
215
|
-
echo "Examples:"
|
|
216
|
-
echo " $0 verify myapp"
|
|
217
|
-
echo " $0 verify turbostarter-source"
|
|
218
|
-
echo ""
|
|
219
|
-
return 0
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
# Main script logic
|
|
223
|
-
main() {
|
|
224
|
-
local command="${1:-help}"
|
|
225
|
-
local project_name="$2"
|
|
226
|
-
|
|
227
|
-
case "$command" in
|
|
228
|
-
"verify")
|
|
229
|
-
verify_domain "$project_name"
|
|
230
|
-
;;
|
|
231
|
-
"help"|*)
|
|
232
|
-
show_help
|
|
233
|
-
;;
|
|
234
|
-
esac
|
|
235
|
-
return 0
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
main "$@"
|