deploy¶
Usage: deploy [-h] [--completion COMPLETION]
Deploy the project by building, transferring files, installing, and configuring services
Help
[-h, --help] Show this message and exit.
[--completion COMPLETION] Use --completion generate to print shell-specific completion source. Valid options: generate, complete.
How it works¶
Here’s a high-level overview of what happens when you run the deploy command:
Resolve secrets: If you have defined a
secretsconfiguration, it will be used to retrieve pull thesecretsdefined in yourenvfile.Build the Application: Your application is built using the
build_commandspecified in your configuration.Transfer Files: The environment variables file (
.env) and the distribution file are transferred to the remote server. Optionally transfersrequirementsfile (if specified).Install the Project: Depending on the installation mode (Python package or binary), the project is installed on the remote server. For a Python package, a virtual environment is set up, dependencies are installed, and the distribution file (the wheel file) is then installed. For a binary, the binary file for the latest version is linked to the root of the application directory.
Application Release: If a
release_commandis specified in the configuration, it is executed at this stage.Configure and Start Services: Configuration files for both
systemdand theproxy(e.g., Caddy, by default) are generated or copied if previously exported. These configuration files are moved to their appropriate directories. A configuration reload is performed, and all relevant services are restarted.Update Version History: The deployed version is recorded in the
.versionsfile on the remote server.Prune Old Assets: Old versions of the application are removed based on the
versions_to_keepconfiguration.Completion: A success message is displayed, and the URL to access the deployed project is provided.
Below is an example of the layout and structure of a deployed application:
app_directory/
├── .env # Environment variables file
├── .appenv # Application-specific environment setup
├── .versions # Version tracking file
├── .venv/ # Virtual environment
├── v1.2.3/ # Versioned asset directory
│ ├── app-1.2.3-py3-none-any.whl # Distribution file
│ └── requirements.txt # Optional requirements file
├── v1.2.2/
│ └── ...
└── v1.2.1/
└── ...
app_directory/
├── .env # Environment variables file
├── .appenv # Application-specific environment setup
├── .versions # Version tracking file
├── app_binary -> v1.2.3/app_binary # Symbolic link to current version
├── v1.2.3/ # Versioned asset directory
│ └── app_binary # Distribution file
├── v1.2.2/
│ └── ...
└── v1.2.1/
└── ...