Deploying Cradle with Cradle Deploy (with examples)
1: Deploy Cradle to a server
cradle deploy production
Motivation: Deploying Cradle to a server is necessary to make the application accessible to users. This command allows you to easily deploy your Cradle application with a single command.
Explanation: The deploy
command is used to manage Cradle deployments. By specifying the production
argument, you tell Cradle to deploy the application to the production server.
Example Output: The command will initiate the deployment process and start transferring the necessary files to the server. It will display the progress of the deployment and provide feedback on any errors encountered during the deployment process.
2: Deploy static assets to Amazon S3
cradle deploy s3
Motivation: Storing static assets, such as images or CSS files, on Amazon S3 provides scalability and high availability. By deploying static assets to Amazon S3, you can offload the burden of serving these assets directly from your server, resulting in better performance and reduced server load.
Explanation: The s3
argument tells Cradle to deploy the static assets to Amazon S3. This command will transfer all the necessary static asset files to the configured Amazon S3 bucket.
Example Output: The command will display the progress of the deployment and provide feedback on any errors encountered during the transfer of the static assets to Amazon S3.
3: Deploy static assets including the Yarn “components” directory
cradle deploy s3 --include-yarn
Motivation: Including the Yarn “components” directory in the deployment ensures that any frontend assets managed by Yarn, such as JavaScript libraries or CSS frameworks, are deployed along with the rest of the static assets. This ensures that the application has all the required frontend assets in place when it is deployed to the server.
Explanation: The --include-yarn
flag tells Cradle to include the Yarn “components” directory in the deployment. This will ensure that all the frontend assets managed by Yarn are transferred to Amazon S3 along with the rest of the static assets.
Example Output: The command will display the progress of the deployment and provide feedback on any errors encountered during the transfer of the static assets, including the Yarn “components” directory, to Amazon S3.
4: Deploy static assets including the “upload” directory
cradle deploy s3 --include-upload
Motivation: Including the “upload” directory in the deployment is useful when your application allows users to upload files. By including the “upload” directory in the deployment, you ensure that the uploaded files are also transferred to Amazon S3, making them accessible to the application when it is deployed.
Explanation: The --include-upload
flag tells Cradle to include the “upload” directory in the deployment. This will ensure that any uploaded files are transferred to Amazon S3 along with the rest of the static assets.
Example Output: The command will display the progress of the deployment and provide feedback on any errors encountered during the transfer of the static assets, including the “upload” directory, to Amazon S3.