
Developing and deploying applications in Kubernetes has become an industry standard, but it's not without its challenges. For developers, these challenges can range from managing intricate configurations to optimizing resource allocation and navigating complex networking setups. Enter Acorn, it offers an all-in-one solution to build, package and deploy your applications on the Acorn cloud platform, or on any Kubernetes cluster. With Acorn, there is no infrastructure or container orchestration required when building or depliying an application. You use familiar development and deployment workflow similar to Docker Compose without having to deal with provisioning or configuring cloud resources.
Acorn is a lightweight deployment framework that makes developers productive and efficient by encapsulating both the application and its associated dependencies, including cloud services, within a singular Acornfile. In this tutorial, we will deploy a sample .NET application from the official Microsoft Tutorial Documentation on the Acorn cloud platform. This sample app uses a search form to browse GitHub repositories by name.
If you want to skip to the end, just click Run in Acorn to launch the app immediately in a free sandbox environment. All you need to join is a GitHub ID to create an account.
Login to the Acorn platform using the GitHub sign-In option with your GitHub user credentials.
After the installation of Acorn CLI for your OS, you can also login using CLI to the Acorn Cloud Platform.
The sample application we’re going to see here is a GitHub repository browser. It lets you search Microsoft, Azure and Acorn organizations’ GitHub accounts to list their public repositories.
In the Acorn platform, there are two ways you can try this sample application.
The First way is the easiest one where, in just a few clicks you can deploy the sample application to the platform and start using it. However, if you want to customize the application or want to understand how you can run your own .Net applications using Acorn, use the second option.
We can run our application from an existing image from the Acorn Cloud Platform UI by clicking on the ”Create Acorns” button.
Choose the source for deploying your Acorns.
On the “Create Acorns” page, provide a name such as
Dot Net Sample Acorn
ghcr.io/infracloudio/dotnet-core-acorn:v#.#.#-#
Now the sample App is provisioned on Acorn Platform and is available for 2hrs. Upgrade to Pro account to keep it running longer.
Once the Acorn is running, you can access it by clicking the Endpoint or the redirect link.
Running the application using CLI
As mentioned previously, running the acorn application using CLI lets you understand the Acornfile. With the CLI option, you can customize the sample app to your requirement or use your Acorn knowledge to run your own .Net application.
Clone the GitHub directory to download the codebase.
$ git clone https://github.com/infracloudio/dotnet-core-acorn.git
Here’s an overview of the application folder structure.
The Acornfile describes the containers, arguments, secrets and volumes to deploy the application. During the Acorn build all of the Docker containers will be built or pulled from a registry and packaged into the Acorn image.
Here’s a concise description of the above Acornfile. For complete description of each component pls visit the Acorn documentation.
containers
web
build
env
ports
We will now deploy our application to the Acorn Platform. The following command will build and run in a single step. Since we’ve already logged in to the platform in the previous step, this command will talk to the platform to build and deploy your application. For production deployments you will want to build the image and push it to a registry.
From the same folder as your Acornfile, run:
$ acorn run -n search-app
Once the application is running successfully, it will output a URL for the application endpoint.
Once you follow one of the above methods you’ll get a link in the Acorn dashboard to open your application. Open the application endpoint URL to access the same.
Now you can search the repos by entering the name of any organization
The Acorn Dashboard is integrated with multiple features such as Events, Logs, Details and accessing the Shell of the Application. Details include the CPU, Memory, Network, Latency, Requests and Errors for the Application.
Explore various available options by clicking the Menu option on your Acorn App. Access the Acorn Dashboard here - https://acorn.io
You can find more information on using this dashboard in Acorn docs here.
In development mode, Acorn will watch the local directory for changes and synchronize them to the running Acorn app. In general, changes to the Acornfile are directly synchronized, e.g. adding environment variables, etc. Depending on the change, the deployed containers will be recreated. You can also install the VSCode plugin to work directly from your IDE.
$ acorn dev -n sample-app
We can now package the application and push it to a registry.
The application is working as expected and is ready to be built and packaged to a registry. We will use GitHub Container Registry in this example. Once published, you can use the acorn image to deploy it directly in the Acorn platform using the dashboard, as described previously.
Log in to the registry with the command below and follow the prompts.
$ acorn login ghcr.io
Build and push the image with the below command.
$ acorn build -t ghcr.io/infracloudio/dotnetcore-acorn:v0.0.1 --push
In this tutorial, we have deployed a .NET application on Acorn Platform using Acornfiles. It provides a holistic solution for developers to seamlessly manage and deploy applications. Then we explored the Acorn Platform Dashboard to gain useful insights of your application.
Learn more about the Acorn Platform with the Acorn Documentation, or join an upcoming training to get a hands-on introduction to developing apps in Acorn.