﻿# First Deployment

👋 Welcome to Octopus Deploy!

This tutorial series will help you complete your first deployment in Octopus Deploy. We’ll walk you through the steps to deploy a sample [hello world package](https://octopus.com/images/docs/hello-world.1.0.0.zip) to one or more of your servers.

:::div{.hint}
If you're using **Octopus 2024.2** or earlier, please visit one of these legacy guides:

- **Octopus 2022.2** or earlier [read the 2022 guide](/docs/getting-started/first-deployment/legacy-guide/2022)
- **Octopus 2024.2** or earlier [read the 2024 guide](/docs/getting-started/first-deployment/legacy-guide/2024)
:::

## Before you start

To follow this tutorial, you will need an Octopus Deploy instance. If you haven’t already, set up an instance using one of these methods:

- [Octopus Cloud](https://octopus.com/free-signup) -> we host the Octopus Deploy instance for you, it connects to your servers.
- [Self-hosted on a Windows Server](https://octopus.com/free-signup) -> you host it on your infrastructure by [downloading our MSI](https://octopus.com/download) and installing it onto a Windows Server with a SQL Server backend.  Learn more about [our installation requirements](/docs/installation/requirements).
- [Self-hosted as a Docker container](https://octopus.com/blog/introducing-linux-docker-image) -> you run Octopus Deploy in a Docker container.  You will still need a [free license](https://octopus.com/free-signup).

## Log in to Octopus

1. Log in to your Octopus instance and click **New Project**.

:::figure
![Get started welcome screen](/docs/img/getting-started/first-deployment/images/get-started.png)
:::

## Add project
Projects let you manage software applications and services, each with their own deployment process.

2. Give your project a descriptive name, for example, `Hello world deployment`.

Octopus lets you store your deployment process, settings, and non-sensitive variables in either Octopus or a Git repository. 

3. For this example, keep the default **Octopus** option selected.
4. Leave the rest as is and click **Create Project**.

:::figure
![Add new project screen](/docs/img/getting-started/first-deployment/images/add-new-project.png)
:::

## Add environments
You'll need an environment to deploy to.

Environments are how you organize your infrastructure into groups representing the different stages of your deployment pipeline. For example, Development, Staging, and Production.

5. Keep the default environments and click **Create Environments**.

:::figure
![Environment selection options and deployment lifecycle visuals](/docs/img/getting-started/first-deployment/images/select-environments.png)
:::

## Create deployment process

The next step is creating your deployment process. This is where you define the steps that Octopus uses to deploy your software. 

For this deployment, we will configure one step to print _Hello World_.

1. In the "Welcome to your Project" dialog, click **Thanks, got it**.

Octopus lands you in the process step template library.

2. In the **Featured** category, locate the Run a Script card and click **Add Step**.

:::figure
![Add Run a Script step to deployment process](/docs/img/getting-started/first-deployment/images/run-script-step.png)
:::

### Step Name
You can leave this as the default _Run a Script_.

### Script Source

You can source script files via 3 methods:

- Inline script (default)
- Git repository
- Package

3. Select **Inline script** as your script source. 

:::figure
![Script source expander where users can select where to source scripts from](/docs/img/getting-started/first-deployment/images/script-source.png)
:::

### Inline Source Code

4. Select an appropriate script language.
5. **Copy** the script below and **paste** it into the source code editor.

```
Write-Host "Hello, World!"
```

:::figure
![Inline source code expander where users can type a script](/docs/img/getting-started/first-deployment/images/inline-source-code.png)
:::

### Execution Location

6. If you’re using Octopus Cloud, select **Run once on a worker**. 
7. If you’re using a self-hosted Octopus instance, select **Run once on the Octopus Server**.

:::figure
![Execution location expander where users can select where this step will run](/docs/img/getting-started/first-deployment/images/execution-location.png)
:::

### Worker Pool

8. If you’re using Octopus Cloud, keep the default **Runs on a worker from a specific worker pool** option selected.

:::div{.hint}
If you’re using Octopus Cloud and a Bash script language, select the Hosted Ubuntu option from the dropdown. The Default Worker Pool is running Windows and doesn’t have Bash installed.
:::

:::figure
![Execution location expander where users can select a worker pool](/docs/img/getting-started/first-deployment/images/worker-pool.png)
:::

You can skip the other sections of this page for this tutorial.

**Save** your step and you can move on to create and deploy a release.

## Release and deploy

### Create release

A release is a snapshot of the deployment process and the associated assets (packages, scripts, variables) as they exist when the release is created.

1. Click the **Create Release** button.
2. Click **Save**.

### Execute deployment

Deployments typically occur in a defined environment order (for example, Development ➜ Staging ➜ Production), starting with the first one. Later you can configure Lifecycles with complex promotion rules to accurately reflect how you want to release software.

1. Click the **Deploy to Development…** button to deploy to the development environment.
2. Review the preview summary and when you’re ready, click **Deploy**.

The **Task Log** will show you in real-time the tasks Octopus is taking to run your Hello World script.

:::figure
![Successful first deployment message](/docs/img/getting-started/first-deployment/images/successful-deployment.png)
:::

You successfully completed your first deployment! 🎉 

Up next, we’ll introduce you to the [power of variables](/docs/getting-started/first-deployment/define-and-use-variables).

:::div{.hint}
**⭐ Favoriting projects**

To easily navigate back to a project, you can mark it as a favorite by clicking the star icon next to the project name. Favorited projects will appear in the Deploy menu.

:::figure
![How to favorite a project](/docs/img/getting-started/first-deployment/images/add-favourite-project.png)
:::

### All guides in this tutorial series

1. First deployment (this page)
2. [Define and use variables](/docs/getting-started/first-deployment/define-and-use-variables)
3. [Approvals with manual interventions](/docs/getting-started/first-deployment/approvals-with-manual-interventions)
4. [Add deployment targets](/docs/getting-started/first-deployment/add-deployment-targets)
5. [Deploy a sample package](/docs/getting-started/first-deployment/deploy-a-package)

### Further Reading

- [Deployment Examples](/docs/deployments)
