My name is Run, Nhost Run
1 August 2023Today we are very excited to release, in private beta, a feature that sets the stage for Nhost's next product phase. We are making Nhost the first truly extensible Backend-as-a-Service platform by bringing custom and third-party OSS services to run alongside your Nhost stack. With Nhost Run, you can bring your own services written in your favorite languages and create a truly customized backend infrastructure.
If you want to give Nhost Run a try, please reach out to us on Discord or send an email to support@nhost.io.
Background and Motivation
Our users love the default Nhost stack: PostgreSQL, Hasura, Auth, and Storage. But some of those users have specialized services running elsewhere (usually a PaaS provider like Render or Heroku) that they need to interact with.
As applications grow in complexity, it's very important that your backend infrastructure is able to evolve and adapt to your application requirements. Nhost Run makes it easy to extend and customize the Nhost Stack according to users' particular needs. It unlocks the power and flexibility to run any custom and third-party OSS solutions, all in the same place.
Nhost Run
To ilustrate what Nhost Run is and how we can use it to extend the Nhost Stack, we will be running a small Python program that exposes an HTTP endpoint to retrieve pictures of...you guessed it... cats. For the sake of brevity, the docker image was already created by the Nhost team and pushed to our Docker Hub. You can find the Python program and Dockerfile in the following repository.
Run Services can be configured either by using the Nhost Dashboard or using a configuration file similar to Nhost Config.
Dashboard
In the Nhost Dashboard, you will find a new Run
option on the main sidebar. Clicking on Add Service
opens a dialog where we can define the configuration for the new service:
New Run Service
And that is it! after clicking on Create
and waiting for a couple of minutes, we have a Python+Flask HTTP API that retrieves cat pictures and runs alongside the rest of the Nhost stack. How awesome is that?
You can see the cute cat pictures here. Refreshing the page will return a different cat picture each time.
Configuration File
We can also use a configuration file to define Run Services as we already to configure the main Nhost Stack using nhost.toml
. Because we used the dashboard to create the service, we will now use the Nhost CLI to pull its configuration and deploy a small change to it.
_10$ nhost run config-pull \_10--service-id 8fa4048e-782f-445c-9a56-d583ecef1c76 \_10--config nhost-service.toml
The service ID can be found in the dashboard and the name of the config file is up to you (we use nhost-service.toml
).
The contents of nhost-service.toml
should look like the following:
_16name = 'cat-generator'_16_16[image]_16image = 'nhost/cat-generator:0.0.1'_16_16[[ports]]_16port = 5000_16type = 'http'_16publish = true_16_16[resources]_16replicas = 1_16_16[resources.compute]_16cpu = 62_16memory = 128
We can now change the name of the service to something else:
_10name = 'meow-generator'
and push the change with:
_10$ nhost run config-deploy \_10--service-id 8fa4048e-782f-445c-9a56-d583ecef1c76 \_10--config nhost-service.toml_10_10Getting secrets..._10Config is valid!_10Service configuration replaced
As with nhost.toml
, we can check if a service configuration is valid with nhost run config-validate
.
_10$ nhost run config-validate \_10--service-id 8fa4048e-782f-445c-9a56-d583ecef1c76 \_10--config nhost-service.toml_10_10Getting secrets..._10Config is valid!
You can refer to the full documentation here.
Benefits of Run
- Flexibility and Customizability: Backend services can be extended beyond our standard stack of Postgres, Hasura, Auth, and Storage.
- Minimal Latency: All services run in close proximity.
- No Egress: No additional egress costs for transfering data between services.
- Reliability: Services can communicate without requiring internet connection.
- Integrated Operations: All workloads in the same place.
Pricing
Nhost Run is available starting on the Pro plan and it is charged for the dedicated resources configured for the service.
Limitations and Future Work
- Ports of type
tcp
andudp
cannot be exposed to the internet duo to a limitation in our infrastructure. We plan to address this soon. - Nhost Run supports running but not building images. We will release support for building JS/TS, Golang, and Python images soon. And more afterwards.
- Support for Run Services on the CLI is lacking, and it is also coming soon.
- GitHub Integration support to be added.
- We plan to release custom domains by the end of August.
Conclusion
Nhost Run is the missing puzzle piece that bridges the gap between the convenience of turnkey solutions like Nhost with the extensibility and flexibility of platforms like Render and Heroku. As your apps grow and evolve, Run ensures that Nhost can scale along with you and your users' needs.
Next
Give Nhost Run a try and let us know what you think! To learn more, please refer to the product and documentation pages.