Deploy your Application
This tutorial guides you through the process of building your first Internal Developer Platform (IDP).
Log in
To begin, navigate to the Humanitec login page and choose your preferred Single-Sign-On option. Humanitec currently supports Single-Sign-On with:
- GitHub
Upon your first login, the Application home page welcomes you. This page showcases all the Applications you can access within your organization.
Let’s dive in and create your first Application.
Create your Application
- From the Applications overview, select Create new application.
- Enter a name for your Application (
demo-app
) and select Create new application to continue.
Following this, you’ll land on your Application’s overview page. Here, you can find Application level settings, like Shared Values & Secrets or access management, and a list of environments. The development
Environment is created by default and must be deployed before you can create any additional environments.
To add Workloads or Shared Resources to your Application, click on the name of the development
Environment and continue to the next parts.
Create a new workload
- Click on the Make changes button in the top right corner. This will create a new draft deployment where you can make changes.
- To add your first workload, select + Create new workload.
- Provide a name for your workload (
sample-service
), then select Create workload.- You have the option to choose from predefined workload profiles such as:
default-cronjob
,default-job
.
- You have the option to choose from predefined workload profiles such as:
default-module
workload profile.On the Workload details page, you have the ability to:
- Add a container image
- Add resource dependencies
- Add DNS resources
- Specify a service account
- Add ports, and more
Next, add a container image to your Workload.
Add container image to workload
- Select the workload that you have just created by clicking on its name.
- Click on + Add container.
- From the available container images, filter and select the
sample-service
image. - Click on Create to add the container to your Workload.
At this point, you need to define a resource dependency for this workload. Keep in mind that Secrets are generated automatically.
Add resource dependencies
- Locate the Resource dependencies section and select Add resource depenency.
- Select Postrgres.
- Provide a Resource ID (
postgres
).
Add environment variables to workloads
- Select + Add Variables to introduce a new variable. The Sample-Service image requires an environment variable called
CONNECTION_STRING
. Add it with the following details:- Key:
CONNECTION_STRING
- Value:
postgresql://${externals.postgres.username}:${externals.postgres.password}@${externals.postgres.host}:${externals.postgres.port}/${externals.postgres.name}
- Key:
- Click on Add at the end of the editable field to save.
${<source>.<object_id>.<variable>}
structure, where <source>
is externals
and <object_id>
is postgres
(the name assigned to the Postgres resource). These placeholders stand in for the credentials that will replace them at launch time.Configure environment variables
- Choose
< Back
, to go to the Application details page. - Select Create new workload.
- Provide a name for the workload, for example,
sample-app
. - Choose Create workload to proceed to the Workload Details Screen.
- Provide a name for the workload, for example,
- Select + Create new container and pick the
sample-app
image from the dropdown menu. - Select Create to add the container image to the workload. In the Variables section, add a new environment variable with:
- Key:
PUBLIC_SERVER_URL
- Value:
http://${modules.sample-service.service.name}:8080
- Key:
Add ingress solution
To direct traffic to the Sample-App and Sample-Service workloads, set up an Ingress solution. Please follow the steps below to configure the necessary settings:
- Select a DNS Resource from the Resource dependencies dropdown and provide a name for the DNS service.
- In the Ingress card’s dropdown, pick the DNS Resource you just created.
- Choose
Default
for the Path type and input8080
in the Port field.
Deploy the Application
Ready to deploy your Application? Follow these steps:
- Click Review & Deploy.
- Type a comment in the Comment field, then click Deploy again.
Once the deployment is successful, the Development environment will indicate Successful
, and the Active deployment will display as Running
.
To access the frontend of your newly created app in a browser, do the following:
- Select the Active deployment by clicking on the comment you provided.
- Click on the workload name to open the Workload Details Screen.
- In the Ingress section, copy the generated DNS URL.
- Paste the copied URL into a new browser tab to load the Application.
Congratulations! You have successfully deployed your first Application in Humanitec. The Application runs on the demo infrastructure provided by Humanitec, as indicated by the *.newapp.io
subdomain.