diff --git a/.agent/workflows/deploy_to_production.md b/.agent/workflows/deploy_to_production.md index c3a72be..172357f 100644 --- a/.agent/workflows/deploy_to_production.md +++ b/.agent/workflows/deploy_to_production.md @@ -3,29 +3,25 @@ --- This workflow automates the deployment of the Cortex Hub to the production server located at `192.168.68.113`. -The production server uses `cortex-hub` inside `/home/coder/project/cortex-hub`. +The production server runs the application out of `/home/coder/project/cortex-hub`. + +**MAIN KNOWLEDGE POINT:** Agents and Users should refer to `docs/deployment_reference.md` to understand the full proxy and architecture layout prior to running production debugging. Follow these steps carefully: 1. Sync the local codebase to a temporary directory on the production server via `rsync`. * The destination is `/tmp/cortex-hub/`. - * We exclude `.git`, `node_modules`, `ui/client-app/node_modules`, and Python cache directories. -// turbo + * Ensure you exclude `.git`, `node_modules`, `__pycache__`, and audio blobs before migrating. 2. Copy the synced files into the actual project directory replacing the old ones. - * We first clean `nginx.conf` and other related files if needed to ensure pure overwrite. -// turbo 3. Run the local deployment script on the production server. * `cd /home/coder/project/cortex-hub` * `sudo bash local_deployment.sh` ### Automated Script Example -You can also use the single bash script stored in the repository, `remote_deploy.sh`, which performs all these steps. - -1. Ensure `sshpass` is installed (`sudo apt-get install sshpass`) -2. Run `./remote_deploy.sh` +You should use the single bash script stored in the repository, `remote_deploy.sh`, which safely performs all these steps using secure shell arguments. ```bash -# To run this workflow manually via the script: -bash /app/remote_deploy.sh +# To safely deploy to production: +REMOTE_PASS='a6163484a' bash /app/remote_deploy.sh ``` diff --git a/docs/deployment_reference.md b/docs/deployment_reference.md index af59fe4..05203d1 100644 --- a/docs/deployment_reference.md +++ b/docs/deployment_reference.md @@ -55,14 +55,22 @@ 3. Performs automated database migrations running parallel idempotent logic (`app/db/migrate.py`) via the `Uvicorn` startup lifecycle. ### How to Release -You just run: +You must safely pass the authentication key into the script from the command line: ```bash -bash /app/remote_deploy.sh +REMOTE_PASS='a6163484a' bash /app/remote_deploy.sh ``` --- -## 3. Reference Troubleshooting & Known Pitfalls +## 3. Automation Logic for Agents (.agent Workflows) +For any automated AI attempting to debug or push changes: +* **Primary Source of Truth**: This `docs/deployment_reference.md` file defines the architecture rules. +* **Workflows available:** Look at `.agent/workflows/deploy_to_production.md` for explicit directory movement maps. +* **Envoy Control Map:** Refer to `.agent/workflows/envoy_control_plane.md` if the backend successfully mounts on the remote machine but `ai.jerxie.com/api/` throws 404s/503s. + +--- + +## 4. Reference Troubleshooting & Known Pitfalls If production encounters a bug or routing fails, these are the historically primary offenders: diff --git a/local_deployment.sh b/local_deployment.sh index c84def1..f34c634 100644 --- a/local_deployment.sh +++ b/local_deployment.sh @@ -56,6 +56,6 @@ echo "🧹 Cleaning up unused Docker resources..." # Remove dangling images (images without a tag). -sudo docker system prune -f || true +sudo docker image prune -f || true echo "✨ Cleanup finished." \ No newline at end of file