Linking Resources
In this document, we will discuss how to link resources at the environment level. The objective of linking resources is to facilitate communication between them, enabling the seamless sharing of essential data, and promoting a more efficient and coordinated operation.
For further details on wiring different resources in Facets, you can refer to the Use Dynamic Referencing to Connect Resources documentation.
Wiring PostgreSQL with a Service Resource
The first step involves wiring PostgreSQL with a Service. This is crucial as it allows the service to communicate directly with the database, thus facilitating data storage and exchange.
Let's walk through the process of wiring a Service to a Postgres database. Follow these steps:
- Create a Service and a Postgres Resource
First, ensure you have both a Service and a Postgres resource created within your Blueprint. - Edit the JSON Configuration
- Navigate to the Blueprint tab and select the Service resource you want to connect to the Postgres resource.
- Select Configure from the drop-down.
- Select Environment Variables from the left pane and click Add Environment Variables.
- In the Add Environment Variables pop-up, select Resource Reference.
- Select the Resource you want to connect with.
- Enter
POSTGRES_URL
as the Env Variable Key and selecthost
as the Value. Click Add More. - Enter
POSTGRES_USER
as the Env Variable Key and selectusername
as the Value. Click Add More. - Enter
POSTGRES_PASS
as the Env Variable Key and selectpassword
as the Value. - Click Save.
Note: The variables POSTGRES_URL
, POSTGRES_USER
, and POSTGRES_PASS
are placeholders in the configuration. While these can be named differently, it is crucial to ensure that the values are correctly mapped to the respective variables.
Wiring a Service with Ingress
The next step is to link the service with an ingress resource.
To ensure that your application is accessible, you will need to create an ingress resource and link it to your service. This makes your application accessible to the public using the ingress public URL.
Let's walk through the process of wiring a Service with an Ingress. Follow these steps:
- Create a Service and an Ingress Resource
First, ensure you have both a Service and an Ingress resource created within your Blueprint. - Edit the JSON Configuration
- Navigate to the Blueprint tab and select the Ingress resource you want to connect to the Service resource.
- Select Configure from the drop-down.
- In the Form mode, under Ingress Rules, click Add New Entry.
- Mention the Service Name, Path, and Port.
- Click Save Changes.
By following these steps, you can effectively link your resources, ensuring efficient intercommunication and public accessibility of your application.
Once you've successfully linked the resources, your next steps involve performing a release and then accessing the application.
Updated 3 months ago