Central repository for shared deployment scripts and workflows across all Adaptive Edge projects.
This repository contains reusable scripts and documentation that ensure consistent deployment practices across all projects running on the Adaptive Edge droplet.
Key principle: Production is always the source of truth.
Generic instructions that Claude Code (or any AI assistant) should follow when working on projects deployed to the droplet.
Covers:
- Production-first workflow
- Pre-deployment checks
- Apache configuration management
- Emergency recovery procedures
- Git workflow for hotfixes
Reusable script that checks production server for uncommitted changes before deployment.
Features:
- Works with any project (configurable via environment variables)
- Blocks deployment if production has uncommitted changes
- Provides clear instructions for resolving conflicts
- Can be integrated into GitHub Actions or run manually
Add this to any project to get the production safeguards:
cd your-project
# Add as a git submodule
git submodule add https://github.com/natcrypto/droplet-tools.git .droplet-tools
# Symlink the instructions to your project root
ln -s .droplet-tools/CLAUDE_CODE_INSTRUCTIONS.md CLAUDE_CODE_INSTRUCTIONS.md
# Symlink scripts
mkdir -p scripts
ln -s ../.droplet-tools/scripts/check-production-before-deploy.sh scripts/check-production-before-deploy.sh
# Commit the submodule
git add .gitmodules .droplet-tools CLAUDE_CODE_INSTRUCTIONS.md scripts/
git commit -m "Add droplet-tools for production safeguards"
git pushIf you prefer not to use submodules:
cd your-project
# Download the files
curl -o CLAUDE_CODE_INSTRUCTIONS.md https://raw.githubusercontent.com/natcrypto/droplet-tools/main/CLAUDE_CODE_INSTRUCTIONS.md
mkdir -p scripts
curl -o scripts/check-production-before-deploy.sh https://raw.githubusercontent.com/natcrypto/droplet-tools/main/scripts/check-production-before-deploy.sh
chmod +x scripts/check-production-before-deploy.sh
git add CLAUDE_CODE_INSTRUCTIONS.md scripts/
git commit -m "Add production safeguards from droplet-tools"
git pushAdd this step BEFORE your build in .github/workflows/deploy.yml:
- name: Checkout submodules
run: git submodule update --init --recursive
- name: Check production sync
env:
PROJECT_NAME: your-project-name # e.g., "powercanvas", "loci", etc.
SSH_DEPLOY_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
run: |
mkdir -p ~/.ssh
echo "$SSH_DEPLOY_KEY" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan -H adaptiveedge.uk >> ~/.ssh/known_hosts
echo "🔍 Checking production for uncommitted changes..."
./scripts/check-production-before-deploy.sh# Set your project name
export PROJECT_NAME=your-project-name
# Run the check
./scripts/check-production-before-deploy.shEnvironment variables:
PROJECT_NAME(required): Name of your projectSSH_KEY(optional): Path to SSH key (default:~/.ssh/nathan_droplet_key)SSH_HOST(optional): Server hostname (default:adaptiveedge.uk)SSH_USER(optional): SSH user (default:root)DEPLOY_PATH(optional): Deployment path (default:/var/www/$PROJECT_NAME)
When working on any project that uses these tools:
- Always read
CLAUDE_CODE_INSTRUCTIONS.mdfirst - Never deploy without checking production
- If production has changes, commit them to git FIRST
- Then proceed with your work
The instructions file contains detailed workflows for:
- Safe deployments
- Production hotfixes
- Apache configuration changes
- Emergency recovery
When you improve the workflow:
-
Update this repo (make changes and push)
-
All projects using submodules get updates automatically:
cd your-project git submodule update --remote .droplet-tools git commit -am "Update droplet-tools" git push
-
Projects using direct downloads need manual update:
cd your-project curl -o CLAUDE_CODE_INSTRUCTIONS.md https://raw.githubusercontent.com/natcrypto/droplet-tools/main/CLAUDE_CODE_INSTRUCTIONS.md curl -o scripts/check-production-before-deploy.sh https://raw.githubusercontent.com/natcrypto/droplet-tools/main/scripts/check-production-before-deploy.sh git commit -am "Update production safeguards" git push
While the scripts and workflows are centralized here, each project should still have its own PRODUCTION_WORKFLOW.md documenting:
- Project-specific paths
- PM2 process names
- Apache configuration details
- Custom validation scripts
- Port numbers
- Special deployment steps
The central tools provide the HOW (workflow and scripts), while project-specific docs provide the WHAT (paths, names, configurations).
Adaptive Edge Droplet:
- Host:
adaptiveedge.uk(178.62.68.64) - SSH Key:
~/.ssh/nathan_droplet_key - Projects Path:
/var/www/PROJECT_NAME/ - Process Manager: PM2
- Web Server: Apache2
The Problem This Solves:
- ✅ You fix a bug on production
- ❌ You forget to commit it
- ❌ You deploy new code from git
- ❌ Deployment overwrites your fix
- ❌ Bug reappears
The Solution:
These tools prevent deployments when production has uncommitted changes, ensuring you never lose work.
Purpose: Check if production server has uncommitted changes before deployment
Usage:
export PROJECT_NAME=my-project
./scripts/check-production-before-deploy.shExit Codes:
0- Production is clean (safe to deploy)1- Production has uncommitted changes (STOP deployment)
Checks:
- ✅ Can connect to production server
- ✅ Project directory exists
- ✅ Git repository is clean
- ✅ No uncommitted changes
Output:
- Clear success/failure messages
- List of uncommitted files (if any)
- Instructions for resolving conflicts
If you improve the workflow or add new scripts:
- Make changes in this repo
- Test with at least one project
- Commit and push
- Update all your projects to get the latest version
If you encounter issues:
- Check that environment variables are set correctly
- Verify SSH key permissions:
chmod 600 ~/.ssh/nathan_droplet_key - Test SSH connection:
ssh -i ~/.ssh/nathan_droplet_key root@adaptiveedge.uk - Check the project's
PRODUCTION_WORKFLOW.mdfor project-specific details
MIT - Feel free to use these tools in your own projects.
- Created central repository for shared tools
- Added production sync check script
- Added Claude Code instructions
- Documented setup and usage