Deploy your app
The following tutorial walks you through building your first Internal Developer Platform (IDP).
Login
To login, visit app.humanitec.io and select your Single-Sign-On option. Humanitec’s SSO options currently support:
- GitHub
When you first log in, you’ll be greeted by the Application home page. This lists all the applications you have access to inside your organization.
Create your first Application.
Create your Application
- From the Application page, enter the name of your Application, for example
demo-app
. - Select Create to continue.
You will be redirected to the Environment page of your Application. You can add Workloads or Shared Resources to your Application.
Let’s add our first Workload to our application.
Create a New Workload
- Select + Create new workload.
- Enter the name of your workload, and select Create workload, for example
demo-workload
.- Workloads default to the
default-module
. - You can select predefined workloads, such as:
default-cronjob
,default-job
and managed services like Reddis, RabbitMQ, MariaDB, ElasticSearch, and MongoDB.
- Workloads default to the
In your Workload details page, you can:
- add a container image
- add resource dependencies
- add DNS resources
- specify a service account
- add ports and more.
Let’s add a container image to our Workload.
Add Container Image to Workload
- Select + Create new container.
- From the list of containers, filter and select
sample-service
image. - Choose Create to add the container image to your Workload.
Now define a resource dependency for this workload. Secrets will be automatically generated.
Add resource dependencies
- From the Resource dependencies section, select Postgres.
- Enter a Resource ID, for example
my-db
.
Add Environment Variables to Workloads
- Click the + Add Variables button to create a new variable.
- The Sample-Service image requires an environment variable called CONNECTION_STRING, which should be added with the following information:
- Key:
CONNECTION_STRING
- Value:
postgresql://${externals.my-db.username}:${externals.my-db.password}@${externals.my-db.host}:${externals.my-db.port}/${externals.my-db.name}
- Key:
- The Sample-Service image requires an environment variable called CONNECTION_STRING, which should be added with the following information:
- Click the Add button next to the end of the editable field to save.
The placeholders have the structure ${<source>.<object_id>.<variable>}
, where <source>
is externals
and <object_id>
is my-db
(the name given to the Postgres resource).
Use placeholders for the credentials that will replace at launch time.
Configure Environment Variables
- Select the
< Back
to app details button in the top right to return to the App Details page. - Select Create new workload and enter a name, for example
sample-app
. - Select Create workload and enter the Workload Details Screen.
- From this screen, select + Create new container and select the
sample-app
image from the dropdown menu. - Select the Create add the container image to the workload.
- In the Variables section, add a new environment variable with the following information:
- Key:
PUBLIC_SERVER_URL
- Value:
http://${modules.sample-service.service.name}:8080
- Key:
- In the Variables section, add a new environment variable with the following information:
Note: This environment variable’s placeholder is similar to a Kubernetes service name and will be resolved at launch.
Add Ingress Solution
In order to route traffic to the Sample-App and Sample-Service workloads, we’ll need to set up an Ingress solution. Follow these steps to configure the necessary settings:
- Select a DNS Resource from the Resource dependencies dropdown and specify a name for the DNS service.
- In the Ingress card’s dropdown, select the DNS Resource you just created.
- Choose
Default
for the Path type and enter8080
in the Port field.
Deploy the Application
To deploy the application, follow these steps:
- Click Deploy.
- In the Comment field, enter a comment and then click Deploy.
Once the deployment is complete, the Development environment will be marked as Successful, and the Active deployment will be shown as Running.
To access the frontend of the newly created app in a browser, follow these steps:
- Select the Active deployment in the left-hand column.
- Click on the sample-app card to open the Workload Details Screen.
- In the Ingress section, copy the generated DNS URL.
- Paste the copied URL into a new browser tab and the app will load.
Results
Congratulations! You have successfully deployed your first app in Humanitec.
The app is running on the demo infrastructure provided by Humanitec (as indicated by the *.newapp.io
subdomain).