Nitric logo

Guides

Deploying with Nitric Deploy

What we'll be doing

In this guide, we'll walk through the steps of getting started with Nitric Deploy. You'll deploy a new project in just a few minutes.

  1. Sign in to Nitric Deploy
  2. Create an organization
  3. Set up a connection to AWS
  4. Create or import a project
  5. Create an environment
  6. Configure environment variables
  7. Deploy your project
  8. View the logs

Sign in to Nitric Deploy

Nitric Deploy can be accessed by navigating to deploy.nitric.io - you'll be greeted by our sign-in screens. Follow the prompts to sign in with GitHub.

Nitric Deploy sign-in screen

Create an organization

Organizations allow you to group your projects. For example, I have an organization that contains all of my demo projects.

Let's create a new organization and give it a name.

Creating an organization in Nitric Deploy

Set up AWS connection

The next step is to set up a connection to your AWS account from your new organization. Navigate to Settings > Connections and click Create connection. You can follow the instructions provided in the Create Connection dialog for steps to create the appropriate role in AWS and link it with your Nitric Deploy organization.

Adding AWS credentials in Nitric Deploy

It can be useful to give the Nitric Connection and AWS Role the same name, so you can remember their association later.

Create or import a project

Projects can be imported from existing Git repositories or you can scaffold a new project from one of the templates. Start by clicking New Project then choosing one of the two options below.

Import a Git repo or clone a template in Nitric Deploy

Existing projects

To import an existing project it must contain a nitric.yaml file. This is automatically created and configured correctly using a template with the Nitric CLI or Nitric Deploy.

Configure a Nitric project from a GitHub repo

In this scenarios, you need to choose a production branch. This is the branch Nitric Deploy watches for any push events and triggers a deployment. You also need to specify which directory the Nitric source code is in - by default this would be the root directory ./ but could be a few levels deeper if you are working in an existing monorepo.

New project from a template

Our template projects will give you a starting point with, typically with a basic REST API.

Your new project will be scaffolded in the repository you select.

Creating a new Nitric project

Create a Stack

Stacks represent deployed instances of your application using a specific cloud connection and region. You can have one or more stacks based on the development workflow you follow (e.g. dev, staging, prod), or if you need stacks in other regions or using different cloud connections.

Once you've created a stack, Nitric Deploy will automatically initiate your first cloud deployment.

A project in Nitric Deploy with no environments created

Create a stack environment for your project

Configure environment variables

If your project requires variables, they can be added in project settings.

Changes to variables will require a redeploy, which can be triggered from the project's home.

Add environment variables for production and staging

Deploy your project

Your project will automatically deploy when you create a stack and the right cloud infrastructure will be automatically provisioned. It will also deploy each time you push to the linked branch selected when creating your environment.

Once you see the deployment tick over to success with a 'tick' you'll also notice that your preview/production URL is displayed. You can use this to access your deployed API.

If you scaffolded a template project then you can test the API out with the following command.

curl https://{url}/hello/user

A stack deployed with Nitric Deploy infrastructure automation

View the logs

By clicking on 'view latest build' we can see the details and retrieve the deployment log information.

Cloud deployment logs in Nitric Deploy

That's it! With just a few clicks, you've deployed a project to your cloud and don't have to manage environments or infrastructure state.

What's next?

Try one of the following activities to keep going with Nitric:

  • Update your code and push it to the configured branch
  • Get started on one of our guides to build a new project with the Nitric CLI
  • Join our Discord to ask questions or get help with your next project
Previous
REST API