A Laravel deployment tool with zero downtime deployment and rollback capabilities, similar to deployer.org.
- Zero Downtime Deployment: Deploy your Laravel application without any downtime
- Atomic Deployments: All deployments are atomic, meaning they either complete successfully or not at all
- Release Management: Keep a configurable number of releases for easy rollbacks
- Shared Resources: Share files and directories between releases
- Rollback Capability: Easily rollback to previous releases if needed
# Install the deployer
$ cargo install deployer
# Create a new template configuration file
$ deployer init [config_file]
# Deploy your application
$ deployer [config_file]
# or
$ deployer deploy [config_file]
# List available releases
$ deployer list-releases [config_file]
# Rollback to the previous release
$ deployer rollback [config_file]
# Rollback to a specific release
$ deployer rollback [config_file] [release]
If config_file
is not specified, deployer.yml
will be used by default.
Add the following dependency to the Cargo.toml file:
[dependencies]
deployer = "0.0.2"
chrono = "0.4"
And then get started in your main.rs
:
use deployer::Deployer;
fn main() {
// Initialize deployer with configuration
let config = "deployer.yml";
let mut deployer = Deployer::new();
deployer.configure(config);
// Deploy the application
deployer.deploy();
// Or list available releases
// deployer.list_releases();
// Or rollback to the previous release
// deployer.rollback(None);
// Or rollback to a specific release
// deployer.rollback(Some("20230101120000".to_string()));
}
# Run in development mode
$ cargo run -- deployer.yml
# Build for production
$ cargo build --release
$ target/release/deployer deployer.yml
# Run tests
$ cargo test
The deployer creates a directory structure on your server:
/path/to/deploy
βββ current -> /path/to/deploy/releases/20230101120000
βββ releases
β βββ 20230101120000
β βββ 20230101110000
β βββ 20230101100000
βββ shared
βββ .env
βββ storage
- Each deployment creates a new timestamped release directory
- Shared files and directories are symlinked from the shared directory
- Once the deployment is complete, the "current" symlink is updated to point to the new release
- Old releases are cleaned up based on the
keep_releases
configuration
Configuration file deployer.yml
---
repository: git@github.com:samirdjelal/deployer.git
hostname: 127.0.0.1:22
username: root
password: password
deploy_path: /opt/deployer
keep_releases: 5
http_user: daemon
php_path:
shared_files:
- .env
shared_dirs:
- storage
writable_use_sudo: false
writable_recursive: true
writable_chmod_mode: 0777
writable_dirs:
- bootstrap/cache
- storage
- storage/app
- storage/app/public
- storage/framework
- storage/framework/cache
- storage/framework/sessions
- storage/framework/views
- storage/logs
pre_deploy_commands:
- ls -lah /opt/lampp/xampp
- echo "Hello World" > /root/file.txt
- cat /root/file.txt
post_deploy_commands:
- echo "Good bye!"
This project is licensed under the MIT license.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in deployer
by you, shall be licensed as MIT, without any additional terms or conditions.