Deployment Environments
Graft allows you to manage multiple isolated deployment environments for a single project. This is ideal for testing features in a dev or staging environment before pushing to production.
Creating a New Environment
Section titled “Creating a New Environment”To create a new deployment environment, use the env command with the --new flag:
graft env --new <name># orgraft -p env --new <name>Interactive Setup: When you create a new environment, Graft will guide you through an interactive setup process:
- Host Configuration: Specify the remote server IP and SSH details for this environment.
- Host Setup: Graft performs necessary server-side preparations (Docker installation, folder structure).
- Webhook Integration: Prepare a unique
graft-hookfor this environment. - Git Branch Connection: Connect the environment to a specific Git branch (e.g.,
devbranch for thedevenvironment).
Running Commands in an Environment
Section titled “Running Commands in an Environment”Once an environment is set up, you can run any Graft command against it by prefixing the command with env <name>.
graft env <name> <command># orgraft -p env <name> <command>Examples
Section titled “Examples”Synchronize a specific environment:
graft env dev syncView logs for the webhook in an environment:
graft env staging hook logs graft-hookRun any graft command:
graft env dev lsgraft env staging ps[!TIP] Graft also supports passing through commands to the remote server, including
docker composecommands viagraft env <name> compose ....
Environment Separation
Section titled “Environment Separation”Each environment is completely isolated:
- Different remote servers (optional).
- Different webhooks.
- Different Git branches.
- Different environment variables (see Environment Variables).