Git Integration
Slipway integrates with Git for source code management and automatic deployments.
How It Works
Slipway supports two deployment methods:
- CLI Deploy - Push code directly from your machine
- Webhook Deploy - Automatic deploys when you push to GitHub/GitLab/Bitbucket
Both methods use Git to track versions and enable rollbacks.
CLI-Based Deployment
How It Works
When you run slipway slide:
- Slipway creates an archive using
git archive - Only tracked files are included
- Untracked files and
.gitignoreentries are excluded - The archive is uploaded to Slipway server
Requirements
- Git repository initialized (
git init) - At least one commit
- Clean working directory (recommended)
Example
cd my-sails-app
git add .
git commit -m "New feature"
slipway slideGitHub Integration
Setting Up Webhooks
Enable auto-deploy in Slipway:
bashslipway project:update myapp --auto-deploy=true --auto-deploy-branch=mainGet webhook URL:
bashslipway project:info myapp # Webhook URL: https://slipway.example.com/api/v1/webhook/github/abc123 # Webhook Secret: whsec_xyz789Configure GitHub:
- Go to repository → Settings → Webhooks → Add webhook
- Payload URL: Your webhook URL
- Content type:
application/json - Secret: Your webhook secret
- Events: Just the push event
- Click "Add webhook"
Verifying the Webhook
GitHub sends a ping event. Check it was received:
slipway webhook:logs myappPush to Deploy
Now when you push:
git push origin mainSlipway automatically:
- Receives the webhook
- Pulls the code
- Builds and deploys
GitLab Integration
Setting Up Webhooks
Enable auto-deploy:
bashslipway project:update myapp --auto-deploy=trueGet webhook URL:
bashslipway project:info myappConfigure GitLab:
- Go to repository → Settings → Webhooks
- URL: Your webhook URL
- Secret token: Your webhook secret
- Trigger: Push events
- Click "Add webhook"
Bitbucket Integration
Setting Up Webhooks
Enable auto-deploy:
bashslipway project:update myapp --auto-deploy=trueConfigure Bitbucket:
- Go to repository → Settings → Webhooks → Add webhook
- Title: Slipway Deploy
- URL: Your webhook URL
- Triggers: Repository push
- Click "Save"
Bitbucket Limitation
Bitbucket webhooks don't support secrets. Slipway validates based on IP address.
Branch Configuration
Single Branch Deployment
Deploy only from a specific branch:
slipway project:update myapp --auto-deploy-branch=mainPushes to other branches are ignored.
Multiple Branches
Configure different branches for different environments:
# main → production
slipway project:update myapp --auto-deploy-branch=main --env=production
# develop → staging
slipway env:create myapp staging
slipway project:update myapp --auto-deploy-branch=develop --env=stagingPattern Matching
Deploy from branches matching a pattern:
# Deploy from any release/* branch
slipway project:update myapp --auto-deploy-branch="release/*"Commit Information
Slipway tracks Git commit information:
slipway deployments myappOutput:
ID STATUS COMMIT BRANCH MESSAGE DEPLOYED
abc123 running a1b2c3d main Fix payment bug 5 min ago
def456 stopped e4f5g6h main Add feature 2 hours agoViewing Commit Details
slipway deployment:info myapp abc123Output:
Deployment: abc123
Status: running
Started: 2024-01-20 14:30:00
Finished: 2024-01-20 14:31:42
Duration: 1m 42s
Git:
Commit: a1b2c3d4e5f6g7h8i9j0
Branch: main
Message: Fix payment bug
Author: [email protected]
Committed: 2024-01-20 14:25:00Skipping Deployments
Skip via Commit Message
Add [skip deploy] or [no deploy] to your commit message:
git commit -m "Update README [skip deploy]"
git push origin main
# No deployment triggeredSkip via Files Changed
Configure Slipway to skip deployments when only certain files change:
slipway project:update myapp --skip-paths="*.md,docs/*,.github/*"Git Requirements
.gitignore
Ensure these are in your .gitignore:
# Dependencies
node_modules/
# Build output
.tmp/
# Environment files
.env
.env.local
.env.*.local
# Slipway credentials (if using hook)
.slipway-credentials
# Logs
*.log
# OS files
.DS_Store
Thumbs.dbTracked Files
These should be tracked:
package.json
package-lock.json
Dockerfile
app.js
api/
config/
views/
assets/ (source files)Troubleshooting
"Not a Git Repository"
slipway slide
# Error: Not a git repositorySolution:
git init
git add .
git commit -m "Initial commit""No Commits"
slipway slide
# Error: No commits foundSolution:
git add .
git commit -m "Initial commit""Dirty Working Directory"
Warning when you have uncommitted changes:
slipway slide
# Warning: You have uncommitted changes. Deploy anyway? [y/N]Recommendation: Commit your changes first:
git add .
git commit -m "Your changes"
slipway slide"Webhook Not Triggering"
Check webhook is configured:
- Verify URL in GitHub/GitLab/Bitbucket settings
Check webhook logs:
bashslipway webhook:logs myappVerify branch matches:
bashslipway project:info myapp # Check auto-deploy-branch settingCheck GitHub webhook deliveries:
- Go to repo → Settings → Webhooks → Recent Deliveries
"Signature Verification Failed"
slipway webhook:logs myapp
# Error: Signature verification failedSolution: Ensure the webhook secret matches:
Get the secret from Slipway:
bashslipway project:info myappUpdate in GitHub/GitLab settings
Best Practices
1. Use a CI/CD Branch Strategy
feature/* → develop (staging) → main (production)2. Protect Your Main Branch
In GitHub:
- Require pull request reviews
- Require status checks to pass
- Prevent force pushes
3. Use Meaningful Commit Messages
# Good
git commit -m "Fix payment processing for international cards"
# Bad
git commit -m "fix"4. Test Before Merging to Main
# .github/workflows/test.yml
on:
pull_request:
branches: [main]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- run: npm testWhat's Next?
- Learn How Deployments Work
- Set up Auto-Deploy for full CI/CD
- Configure Rollbacks for quick recovery