refactor: move deploy scripts into .claude/skills/deploy/

- Added deploy skill (SKILL.md) with dev/prod instructions
- Moved deploy_prod.sh, deploy_dev.sh, dev_deploy.sh, speed_take.sh
- Updated settings.local.json: new script paths, git merge/push permissions, auto-deploy hook on merge to master
- Removed dev_deploy.sh and speed_take.sh from .gitignore

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-27 10:04:41 +08:00
parent fa1fbfc0f5
commit f6ccadbcd3
6 changed files with 50 additions and 2 deletions

View File

@@ -0,0 +1,40 @@
---
name: deploy
description: Use when deploying this project to dev or prod environments, or when asked to run, ship, release, or push to a server.
---
# Deploy
## Environments
### Dev (`/deploy dev`)
```bash
bash .claude/skills/deploy/deploy_dev.sh
```
Builds and restarts the service on the dev server (ubuntu).
### Prod (`/deploy prod`)
Prod deploy requires being on `master`. Steps:
1. Ensure all changes are committed and pushed to `master`
2. Run:
```bash
bash .claude/skills/deploy/deploy_prod.sh
```
`deploy_prod.sh` will:
- Pull latest code on ubuntu build host
- Build `linux/amd64` Docker image and push to registry
- SSH into ECS: stop old container, start new one with `-env=prod`
## Quick Reference
| Target | Command | Branch required |
|--------|---------|-----------------|
| Dev | `bash .claude/skills/deploy/deploy_dev.sh` | any |
| Prod | `bash .claude/skills/deploy/deploy_prod.sh` | `master` or `main` |
## Common Mistakes
- Running `deploy_prod.sh` on a feature branch → script guards against this (exits with error)
- Forgetting to merge/push before deploy → ubuntu build host pulls from remote, so local-only commits won't be included
- Prod logs go to `/app/logs/app.log` inside the container, not stdout — use `docker exec doc_ai tail -f /app/logs/app.log` on ECS to tail them

View File

@@ -0,0 +1,3 @@
docker-compose down
docker image rm doc_ai_backed-doc_ai
docker-compose up -d

View File

@@ -0,0 +1,7 @@
#!/bin/bash
echo "=== Testing 401 Request Speed ==="
curl -X POST "https://api.mathpix.com/v3/text" \
-H "Content-Type: application/json" \
--data '{}' \
-w "\n\n=== Timing ===\nHTTP Status: %{http_code}\nTotal: %{time_total}s\nConnect: %{time_connect}s\nDNS: %{time_namelookup}s\nTTFB: %{time_starttransfer}s\n"

2
.gitignore vendored
View File

@@ -9,5 +9,3 @@ texpixel
doc_ai
document_ai
dev_deploy.sh
speed_take.sh