Efficient deployment is crucial for modern web applications. In this guide, we'll explore how to set up a Git-based deployment workflow on a Virtual Private Server (VPS), made incredibly simple with DeployHQ.
Why Git-Based Deployment?
Git-based deployment offers numerous advantages:
- Seamless code synchronization
- Version control integration
- Consistent deployment process
- Easy rollback capabilities
- Improved development workflow
Prerequisites
Before getting started, ensure you have:
- A VPS with SSH access (the one of your choice)
- Git installed on your server (not needed if the setup is using SFTP)
- Your project hosted in a Git repository
- A DeployHQ account
Preparing Your VPS for Deployment
1. Create Deployment Directory
# Navigate to your web directory
cd /var/www/
# Create project directory
mkdir myproject
cd myproject
2. Set Up SSH Access
Ensure your VPS is configured with SSH access:
- Generate SSH keys
- Add public key to server's authorized_keys
- Configure proper permissions
Integrating with DeployHQ
Instead of manually configuring complex deployment hooks, DeployHQ provides a straightforward solution:
1- Connect Your Repository
- Link your Git repository (GitHub, GitLab, Bitbucket)
- Select the branch you want to deploy
2- Configure Server Details
- Add your VPS connection information
- Specify deployment path
- Set up any necessary build or deployment commands
Sample DeployHQ Configuration
# Example deployment configuration
deployment:
server: your-vps-ip
path: /var/www/myproject
branch: main
build:
- npm install
- npm run build
after_deploy:
- sudo systemctl restart your-app
Deployment Workflow
With DeployHQ, your deployment becomes as simple as:
- Push code to your configured branch
- DeployHQ automatically handles the rest
- Receive instant deployment notifications
Best Practices
- Use environment-specific configurations
- Implement proper access controls
- Set up deployment notifications
- Utilize DeployHQ's rollback features
Advanced Deployment Strategies
While basic Git deployment works well, consider:
- Multi-environment deployments
- Automated testing
- Containerization
- Continuous Integration workflows
Why Choose DeployHQ?
Our platform offers:
- Zero-downtime deployments
- Instant rollbacks
- Comprehensive deployment logs
- Multi-server support
- Easy integration with popular repositories
Conclusion
Git-based deployment doesn't have to be complicated. With DeployHQ, you can transform your deployment process from a complex task to a seamless, automated workflow.