Seamless Deployment of Decentralized Applications: A Close Look at Nosana CI/CD

Β·

8 min read

Seamless Deployment of Decentralized Applications: A Close Look at Nosana CI/CD

Introduction πŸš€

Tired of traditional CI/CD tools that keep you in the dark and limit your development potential? Say hello to Nosana CI/CD, a revolutionary platform that's about to transform the way you build and deliver software.

Gone are the days of feeling trapped in a centralized black box. Nosana CI/CD breaks down those barriers, empowering you to unlock your true potential as a developer. Harnessing the power of the Solana blockchain, Nosana introduces a new era of software development that's distributed, reliable, and accessible to all.

Picture this: your code changes are seamlessly integrated, tests automatically executed, and deployments effortlessly orchestratedβ€”all within an ecosystem designed to ensure your success. With Nosana CI/CD, your code journeys through a transparent and efficient pipeline, enabling you to deliver high-quality software with speed and precision.

But what truly sets Nosana apart? It's the magic of containers and jobs, carefully orchestrated through a .nosana-ci.yml file. These elements create a world of possibilities, offering isolated environments for building, testing, and deploying your code. When you make that commit, Nosana springs into action, unleashing the power of its CI/CD pipeline and bringing your ideas to life.

Here's where the magic gets even better: Nosana records every step of your pipeline on the blockchain and IPFS. That means every action, every result is forever etched in an immutable ledger, accessible to anyone who needs to validate your achievements. Transparency has never been this tangible.

Let's dive deeper into it.

Features Nosana provides you ✨

Before we dive into details on using Nosana, to make you compel you more on using it, have a look at some of the key features of Nosana CI/CD:

  • Decentralized network: Nosana operates on a peer-to-peer network of worker nodes, ensuring continuous operation even if some nodes fail. 🌐

  • Transparency: Pipeline runs are recorded on the blockchain and IPFS, allowing anyone to verify the accuracy of results. πŸ”

  • Security: Nosana's secret manager and blockchain-based storage enhance the security of secrets and configuration data. πŸ”’

  • Control: Users have the option to self-host Nosana nodes, giving them full control over their data. πŸŽ›οΈ

  • Sustainability: Nosana utilizes spare compute resources, promoting a more eco-friendly approach compared to large data centers. 🌱

  • Pipelines: CI/CD pipelines are configured using a .nosana-ci.yml file, specifying build images, jobs, and commands. πŸš€

  • Isolated containers: Jobs within Nosana run in isolated containers for secure and reliable building, testing, and deployment of code. πŸ“¦

Terminologies you need to be aware of πŸ“š

Before, we try on a simple example to get started, to avoid ambiguity, you need to be aware of the following terms first: (don't worry, we will keep it crisp and easy hereπŸ˜‰)

  • Account: πŸ“ Your wallet address on the Nosana Network.

  • Burner Phone NFT: πŸ”₯ NFTs granting access to operate a node, special community channels, and more.

  • Continuous Delivery: πŸ”„ Automates the release of new code to speed up software development.

  • Continuous Integration: πŸ”„ Regularly produces, tests, and merges code changes into a shared repository.

  • Container Image: πŸ–ΌοΈ Static file containing executable code to run isolated processes.

  • Claim Rewards: πŸ’° Receive and add staking program fees to your account.

  • Claim Transfer: 🀝 Claim emissions from a Nosana Pool and transfer them to a user.

  • Dashboard: πŸ“Š User interface for account management, running pipelines, staking, and more.

  • Docker: 🐳 Platform to build, deploy, and manage containers.

  • Extend Stake: ⏳ Extends the duration of a stake.

  • Jobs: πŸ’Ό Earn tokens by completing pipeline jobs in the Nosana Network.

  • Leaderboard: πŸ† Displays wallets' staking scores and rankings.

  • NFT: 🎨 Unique crypto asset stored on a blockchain.

  • Node: πŸ–₯️ Machine participating in the Nosana Network to execute pipelines or jobs.

  • Pipeline: πŸš€ Automated software delivery process from version control to users.

  • Pools: 🏊 Token pools with predefined emission rates.

  • Rewards: 🎁 Program allowing stakers to earn rewards.

  • Solana: β˜€οΈ Blockchain platform for decentralized applications.

  • Stake: πŸ”’ Locking crypto assets to support a blockchain or project and earn more cryptocurrency.

  • Unstake: πŸ”“ Removing tokens from a locked state.

  • NOS: πŸ’Ž Native token of the Nosana Network.

  • xNOS: πŸ“Š Determines position on the leaderboard, raffle ticket allocation, and rewards distribution.

Let's give it a try - An Example 🎯

Let us try setting up a React Application, since most of the readers(I guess), will be familiar with the same, we will divide the whole process into three parts. Also I am sharing the repository - https://github.com/anshuman-dev/Nosana-React where this tutorial is done. Let's begin:

  1. Setting up Nosana Dashboard

    1. Open the Nosana Dashboard - https://nosana.io/

    2. Connect your GitHub Account. After connecting, you would see :

    3. Choose a GitHub Repository for this tutorial and create a new pipeline.

    4. Connect the pipeline to your GitHub repository. After you connect the screen will look something like :

  1. Setting up a React-App

1. Using the create-react-app command. Open your terminal and run the following command:

create-react-app Nosana-React

This will set up a new React project called "Nosana-React" in a directory with the same name.

2. Configure the Nosana Pipeline

Next, navigate to the root directory of your React application using the terminal:

cd Nosana-React

In the root directory, create a new file called .nosana-ci.yml. This file will contain the configuration for the Nosana CI/CD pipeline.

Open the .nosana-ci.yml file in a text editor and add the following configuration:

global:
  image: registry.hub.docker.com/library/node:16

  trigger:
      push:
        branches:
          - main

jobs:
  - name: install
    commands:
      - npm ci

This configuration specifies the following:

  • The global section specifies the Docker image to be used, in this case, node:16.

  • The trigger section specifies that the pipeline should be triggered on a push to the main branch.

  • The jobs section only job for now: install

  • The install job runs the npm ci command to install project dependencies.

3: Push Changes to GitHub

Initialize a Git repository in your project directory:

I am clubbing all the actions here -

  • Initialization

  • Adding to the stage

  • Commit

  • Adding the remote branch to local repository

  • Push the React application

git init
git add .
git commit -m "Initial"
git remote add origin https://github.com/anshuman-dev/Nosana-React/
git push -u origin main
  1. Run the job on Nosana

    1. Head over to https://app.nosana.io/. Your dashboard would have been updated to the following:

2. After a few minutes wait, you will see whether the job has succeeded or not. On a success, you will have something like: (The update job, in my case, failed earlier because of the wrong Syntax in YAML file, so I made the changes and you can see the Completed Status below)

3. You can see the details of the jobs as well. Just click on the Completed or Failed status to see more details:

AND THAT's ITπŸŽ‰πŸŽŠ

Congratulations! You have successfully set up a Nosana CI/CD pipeline for your React application. Whenever you push changes to the main branch of your GitHub repository, Nosana will automatically run the pipeline, installing dependencies and building your application.πŸ₯³

You can visit my GitHub - https://github.com/anshuman-dev/Nosana-React as well to see more about setting up.

Secrets in Nosana πŸ€”

Before we end this post, there is one last thing which is Nosana Secret Manager. This is something that you should check out.

In the land of Nosana, secrets are precious treasures that projects want to share with the nodes running their jobs. But fear not, for Nosana has a Secret Manager to keep those secrets safe. 🀫

To start your journey, you must prove your ownership of a Solana public key. By signing a custom message with the timestamp (remember, not older than 60 seconds), you'll obtain a JWT token to access the Secret Manager. With this token, you can securely store secrets, those valuable key/value pairs, under your Solana public key. πŸ—οΈ

Now, picture this: you have secrets stored, and you want your jobs to have access to them. In your .nosana-ci.yml file, you can specify which secrets the node running your job can retrieve. It's as simple as adding the secrets' names to the secrets section of your job. Voila! The secrets are now at your job's disposal. 🀐

But wait, there's more! Nosana offers not only simple secrets but also global secrets. These global secrets can be shared across different repositories without any prefix. Just add them to the global.secrets section in your .nosana-ci.yml file, and they're ready to be utilized. Secrets everywhere!

Feeling adventurous? Let's explore the advanced secrets. If you want more flexibility, you can specify a different secret manager URL or use secrets in places other than environment variables. With the advanced syntax, you can define secrets as environment variables under the environment section, specifying the type, endpoint, and value. Secrets, with a touch of complexity!

But hold on, the adventure doesn't end there. Once a job is completed, you can also access the secrets of the node that finished the job. The Job Results IPFS JSON holds the secrets that you can read. It's like a secret exchange program! πŸ”„

If you're feeling ambitious, you can even host your own Secret Manager. Nosana provides the source code for the manager, supporting various storage backends. Choose your favorite and set it up to guard your secrets in your own kingdom. 🏰

And guess what? You can even run the Nosana Secret Manager in a Docker container! With a simple command, you'll have your own secret-keeping companion up and running. Now that's magic! ✨

So, whether you're venturing into the realm of simple secrets, exploring the possibilities of global secrets, or delving into advanced secrets, Nosana has got you covered. Your secrets will be protected, and your CI/CD pipeline will be enchanted with the power of secrecy. Embrace the Nosana secrets and unlock the true potential of your projects! πŸ”’

Conclusion 🌟

In the vast sea of CI/CD platforms, Nosana emerges as a beacon of innovation, empowering developers to ride the waves of the Web3 revolution. With its seamless integration of decentralized technologies, Nosana not only streamlines the development process but also opens the floodgates to the limitless potential of blockchain and smart contracts.

Whether you're building decentralized applications or exploring the exciting realm of Web3, Nosana serves as your trusted compass, guiding you through the uncharted waters of distributed systems. So, don your virtual snorkel, dive into the deep end of Web3 development, and let Nosana be your companion in riding the swells of this transformative technology. πŸ’»

Thank you for reading!

Β