Deploy with Pulumi
This section guides you through deploying infrastructure using Pulumi with AWS as the cloud provider. Pulumi allows provisioning infrastructure using code, making it easier to create, manage, and update cloud resources.
Prerequisites
- Ensure you have both the Pulumi CLI and AWS CLI installed on your machine.
- Confirm that you are signed into both the Pulumi and AWS.
- Ensure you have jq installed
Steps for Deployment
Navigate to the Infrastructure Directory: Change your current directory to the
infrastructure
folder by executingcd infrastructure
in your terminal.Initialize the Stack:
- If you haven't already created a Pulumi stack, you can do so by running
pulumi stack init <stack_name>
. Replace<stack_name>
with a name of your choice for the stack. - Ensure that AWS SSM parameters are correctly set up. For more information on the required environment variables, refer to the
/infrastructure/src/env.ts
file.
- If you haven't already created a Pulumi stack, you can do so by running
Configure the
TAILOR_DOCKER_IMAGE
Environment Variable: For example, use the commandexport TAILOR_DOCKER_IMAGE=ghcr.io/tailor-cms/author:sha-4fa2c1b
to define the Docker image to be used. A GitHub workflow is configured to automatically build and publish Docker images upon any merge into themain
branch. This ensures that the latest version of the code is always available as a Docker image for deployment.Deploy with Pulumi: Execute
pulumi up
to start the deployment process. This command provisions your infrastructure on AWS according to the definitions in your Pulumi scripts. You will be shown a preview of the changes that Pulumi plans to make, and you can confirm to proceed with the deployment.Connect to cluster
shaws ecs execute-command \ --cluster your-cluster \ --task $(aws ecs list-tasks --your-cluster | jq -r '.taskArns[0] | split("/")[2]') \ --command "/bin/sh" \ --interactive
Migrate the database
shpnpm db:migrate
Invite admin
shcd /tailor/apps/backend pnpm invite:admin admin@example.com
Note 👆
Remember to review the configurations and parameters within the /infrastructure/src/env.ts
file carefully before proceeding with the deployment to ensure that your infrastructure is set up correctly.