Service Configuration in Kuberns
Configuring services within Kuberns is designed to be flexible and user-friendly, allowing you to manage and deploy your applications efficiently. Whether you are defining your services manually using a Procfile
or relying on Kuberns’ Auto Detect Configuration feature, understanding these processes ensures that your applications run smoothly and are scalable.
This section will guide you through both methods, providing a comprehensive overview of how to declare services, manage resources, and leverage automatic configurations for popular frameworks like Django and NodeJS. By following these guidelines, you can streamline your deployment process, reduce setup errors, and focus more on developing your applications.
Using Procfile for Service Declaration
The Procfile
is an essential configuration file used to declare your service names and corresponding service commands for a particular environment. It provides a structured way to manage multiple services within your project.
How to Declare a Procfile
To declare a Procfile
, the user needs to place it in the root directory of the project. Kuberns will automatically detect the Procfile
and identify the services mentioned within it.
Structure of a Procfile
The Procfile
follows a simple format where each line defines a service name followed by the command to run that service. Here’s an example of how a Procfile
looks:
web: python manage.py runserver
celeryapp: celery -A kuberns worker --loglevel=info
In this example:
web
is the name of the service that will run the Django development server.
celeryapp
is the name of the service that will run the Celery worker.
Automatic Detection and Resource Management
Once the Procfile
is detected, Kuberns will:
-
Detect and Register Services: Automatically detect the services listed in the
Procfile
and add them as resources within your project. -
Default Resource Allocation: By default, each service is added in a terminated state with a default resource allocation of 512 MB of RAM.
-
Service Activation: Users can start any service from the resources page if they wish to run that particular server. This allows for flexible service management based on your current needs.
-
Vertical Scaling:* Users have the option to vertically scale resources by increasing the allocated memory or other resources as required, ensuring your services have the necessary capacity to handle their workloads.
Example of Using a Procfile
To use the Procfile
, follow these steps:
-
Create a Procfile: In the root directory of your project, create a file named
Procfile
. -
Declare Services: List each service and its command on a new line in the
Procfile
. -
Deploy: Deploy your project on Kuberns. The platform will automatically detect the
Procfile
, add the declared services, and allow you to manage them through the Kuberns dashboard.
By utilizing a Procfile
, you can efficiently manage and scale multiple services within your project, ensuring a streamlined and organized deployment process.
Auto Detect Configuration
Kuberns offers an Auto Detect Configuration feature that simplifies the setup process by automatically detecting the necessary configuration for running web commands if no Procfile
is declared. This feature supports popular frameworks such as Django and NodeJS, ensuring a smooth and efficient deployment process.
Django Configuration
For Django projects, Kuberns requires the following files to be present: manage.py
, requirements.txt
, and wsgi.py
. If any of these files are missing, the build process will throw an error in the build logs. The system automatically detects the necessary commands to run your Django application and dynamically assigns the required port, eliminating the need to manually add port configurations in your commands. By default, Kuberns creates a web service with the auto-detected command for your Django application.
NodeJS Configuration
For NodeJS projects, Kuberns requires the package.json
file. The system detects the necessary commands to run your NodeJS application and dynamically assigns the required port, so you do not need to include port configurations in your commands. Kuberns automatically creates a web service with the detected command for your NodeJS application.
Benefits of Auto Detect Configuration
-
Simplifies Setup: Automatically detects and configures necessary commands, reducing manual setup steps.
-
Dynamic Port Assignment: Adds dynamic port configuration to commands, ensuring seamless deployment without manual port settings.
-
Error Detection: Identifies missing required files and provides error logs to help you address issues promptly.
How It Works
-
File Detection:
- For Django: Kuberns looks for
manage.py
,requirements.txt
, andwsgi.py
. - For NodeJS: Kuberns checks for the
package.json
file.
- For Django: Kuberns looks for
-
Command Generation:
- Kuberns auto-detects the appropriate command to run the application.
- Adds dynamic port configuration to the command.
-
Service Creation:
- A default web service is created with the auto-detected command, ensuring your application is ready to deploy.
By leveraging the Auto Detect Configuration feature, you can streamline the deployment process, minimize errors, and focus on developing your application without worrying about intricate configuration details.