Updated on 25.5.2023

How to get started with Buddy deployment pipelines

Buddy dashboard

Going through code deployments step by step can be time-consuming, especially if you need to repeat the process often for example during development sprints. This is exactly what Buddy is aiming to solve using simple delivery automation pipelines.

Automate builds and deployments with 70+ ready-to-use actions on Buddy. Pick from a large number of easy-to-use deployment integrations including support for containers on Docker and Kubernetes.

In this guide, we’ll be checking some of the neat features of Buddy and how to integrate it with your UpCloud servers. Follow along to get started with Buddy, create your first deployment pipeline and see it work in practice.

1. Signing up with UpCloud

Firstly, if you have not yet registered on UpCloud, you should begin by getting signed up. You can follow this guide perfectly while on a trial account.

The link opens in a new window – we’ll wait here for you!

2. Configuring UpCloud API access

To allow Buddy to access to your UpCloud account through our API, you first need to set up API permissions. We recommend creating a new workspace member account specifically for API usage with its own username and password for each external service you might use. This allows you to limit API access and specify permissions for increased security.

You can find detailed instructions on how to create API credentials in our beginners’ guide for UpCloud API.

Once you have a workspace member account for Buddy API access continue ahead to their platform.

3. Registering with Buddy

Next, if you haven’t yet, sign up with Buddy or log in using your GitHub, Bitbucket or Google account.

Once registered, log in and head to your dashboard.

Buddy workspace

Buddy will create you the first workspace for free.

4. Starting your first project

On Buddy, each web site and application is contained within a project. You can have a number of projects at any one time, but for now, you only need one.

To get started, click the button to Create new project.

Buddy can integrate with the most popular code repositories. For this guide, we’ll be checking out Buddy Git Hosting.

Give the new project a name and click Create a new project button to confirm.

Buddy naming a new repository

Once you’ve created the first project, your repository is ready and waiting!

Buddy repository ready and waiting first commit

With the project space created, continue on with rest of the guide.

5. Configuring your Buddy SSH key

Besides API access, Buddy also needs to be able to authenticate onto your cloud server. Before you can get deploying, you should look up your Buddy SSH key and add it to your UpCloud account.

Each project on Buddy has it’s own SSH key pair that allows password-free authentication for automation processes. Find your Buddy public SSH key in the Project Options by clicking the link at the navigation bar.

Buddy project options

In the project settings, you have a number of options like inviting others to your project team, adding and editing project variables, as well as other project-specific options such as renaming the project.

Click the link Buddy Public Key on the right side of the settings panel to show your SSH key.

Buddy project options

Copy the key part coloured green without the single quotation marks onto your clipboard or download the public key.

The key part will look like the example below.

ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCX2UnF6Ae/rzT7hxNYNQgXJX4GGaXxVx2N6PB5zlPk+9syroF2Io61gOsEGj6L/PmEdNdL/3mlapWbOjGm2fnzq/Np15vJahoSs8YmptcNM8vRhDluAKLV/OoOu+n5annjgMoGxXGfGfIWZfDxBCWn+Fdl9hEwm3fFZnr/Ja7ZcPbIvpJzvWNdDqyYo3NXG207efS5wWRDJgPP4AGbS656DjVgr94lQcDLnuYSZzBvkyEMHjK87ncfrF720C6aKpycC1a9cyRVax0CemHgFpISluTssNyf+EAlwe99zmLGMaBRYskPQlagoEjXY5c9Yw/OhLoAE+kHpW0uxh8qvHLf the-great-cloud Key
Buddy project public key

Once you’ve found your Buddy SSH key, head over to your UpCloud control panel and SSH keys under account settings. Click the Add new button.

Upcloud SSH keys

Then paste your Buddy public key into the SSH key field, rename the key as you like, then click the button to Save the SSH key.

Upcloud add SSH key

After saving the Buddy public key, continue on with deploying a new cloud server.

6. Deploying a cloud server

Next, you’ll need somewhere for your future projects to live on. Cloud servers are perfect for experimenting with new app ideas due to how quick and easy it is to create a pristine host on a moments notice.

Deploy a new cloud server to host your project. Firstly, make the following configurations.

  • Select the location you wish to deploy to, the one geographically closest to you often provides the best experience
  • Choose one of the simple plans or configure freely using the flexible plan
  • Pick the operating system you want to use, we’ll go with Ubuntu in this example

With the server configured, include the Buddy SSH key you saved earlier by clicking the key name to select it. Each public SSH key saved on your account can be added onto a server at deployment and will allow easy and secure authentication to the host.

The Buddy SSH keys are project specific and only used by actions within that one project. For any other projects, make sure to add the corresponding public key to your cloud servers.

Then before deploying the new server, include the following initialization script in the text field.

apt-get update && apt-get upgrade -y
apt-get install nginx -y
Buddy deploy new server with nginx

The initialization scrips are programmable command sets that allow you to automate many of the initial configuration tasks required on newly deployed servers. The script in this example will update your server to the latest software patches and installs a web hosting service which we’ll need later.

Once all set, click the Deploy button at the end of the configuration page to launch the server.

Lastly, you’ll need to give your Buddy API account permission to access the new server. Go to your workspace members list and open the API account settings by clicking the API account name.

Buddy API account

In the API account settings, click the button to Select servers then pick the host you just deployed. Finally, click the Save button on the pop-up window and the Save changes button near the bottom of the page.

Buddy add permissions

That’s the last of the prerequisite steps to get started with Buddy, continue below to begin developing your project.

7. Committing your first file

Buddy offers a useful online code editor that makes writing small programs and configuration files a breeze. Go to your project page again and click the New file button to start a new file in the editor.

Buddy new file

Next, we’ll create a simple HTML file to test the deployment system. Name the file index.html and include the following code snippet in the editor window.

<!DOCTYPE html>
<html>
<body style="width: 30em; margin: 0 auto;">
<h1>Hello World!</h1>
</body>
</html>
Buddy hello world

The editor includes a syntax highlight features that automatically adjust to the file type according to the file extension in the name field.

Once ready, click the Commit button at the bottom of the editor to save the file to your repository.

Buddy first commit

Now that you have the first page ready to go, you’ll need to set up a deployment process to get the file onto your cloud server. Continue with the guide below on how to configure a new pipeline.

8. Configuring the deployment pipeline

Pipelines on Buddy are extensively configurable automation processes that allow you to quickly and easily deploy changes in your code. Start the setup by going to the Pipelines tab at your project page and click the Add a new pipeline button.

Buddy create new pipeline

In the new pipeline configuration, give the deployment method a name and select the On push trigger mode. Then click the Add a new pipeline button to continue.

Buddy new pipeline

Next, you’ll need to add a new action to the pipeline. Buddy supports a whole host of different methods for deploying your project. Find the UpCloud infrastructure-as-a-service option by using the search field, then click the UpCloud integration icon.

Buddy action upcloud

Since this is likely the first time you are adding integration with UpCloud on Buddy, you’ll need to configure API access.

Give the integration a name as you like. Next, enter your UpCloud API account name and password that you set up earlier in the 2. section of this guide. Then save the credentials by clicking the button to Add integration.

Buddy UpCloud integration

Once you’ve set up the integration between Buddy and UpCloud, you’ll have the option to configure automated file transfers onto UpCloud servers along with many other actions.

In the file transfer settings, select the Buddy’s SSH key as Authentication mode and enter the following directory as the Remote path.

/var/www/html

Buddy will query your UpCloud account using the API access to find the server you deployed and granted permissions for. While you have only one cloud server accessible to Buddy it will be selected automatically. If you want to use an existing cloud server, make sure to add the Buddy SSH key to your authorized keys file and give your API account permissions to the server.

Confirm the selections by clicking the Add this action button at the bottom of the window.

Buddy transfer files to UpCloud

Creating actions in your pipeline forms a queue of operations that are executed when the pipeline is run. Once configured, actions in the pipeline can be toggled on and off as well as re-ordered just by drag and drop.

That’s it for the setup and configurations. Next up comes the amazing bit that all the work up till now has been for!

9. Testing the pipeline

Next up comes the best bit, seeing all of the steps come together with nice results! The whole point of pipelines is getting your project files deployed in an orderly fashion and Buddy accomplishes this without a fuss.

Now, test your setup by clicking the Run pipeline button.

Buddy UpCloud pipeline

In the confirmation window, add a comment about the action and then click the Run now button.

Buddy run pipeline now

A simple operation of a single file transfer is almost instant, but with longer deployment processes you can follow the progress at the pipeline view.

Once completed, open the public IP of your cloud server in a web browser to see the results. You can find the IP address at your UpCloud control panel on the servers list.

Buddy hello world live

You should see the example landing page with the traditional message as above.

But that is not all! Next, test the On push trigger of the pipeline by making a small but observable change in the index.html file.

Go back to the Code page in your project and open the file for edit by clicking the file name. Add the following short paragraph after the first message and click the Commit button.

<!DOCTYPE html>
<html>
<body style="width: 30em; margin: 0 auto;">
<h1>Hello World!</h1>
<p>Every commit automatically deployed</p>
</body>
</html>
Buddy hello world update

Once you hit commit, Buddy will automatically run the configured pipeline deploying the changes to your server. You can see the pipeline execution history on the Pipelines page under Executions.

Then refresh the web page at your server’s IP address to see the changes.

Buddy hello world live update

The update to the index file was immediately pushed to the server and visible right away!

Done!

Congratulations! You’ve now successfully configured an integration between Buddy and UpCloud along with a cloud server and the first pipeline onto it. However, this is just the start, there’s a lot more you can automate on Buddy.

Now that you know the basics, feel free to play around with the pipeline settings to get familiar with Buddy’s features and add new actions. You can learn more about pipelines and other ways to use Buddy at their documentation page.

Janne Ruostemaa

Editor-in-Chief

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top