Skip to main content

Description

This package is part of a toolbox that aims to make it easier to send configurations to services. Even the smallest microservice needs a few information to run, such as an endpoint to query. This service aims to make it easier to send and update configurations for microservices. At startup, each service announces itself by producing a specific message to a Kafka topic. The message will be consumed by a Services Configuration Repository component that will consume the message and send the configuration as a message to the Kafka topic where services are listening to for receiving their configuration. Similarly, suppose we need to update one service's configuration. In that case, we can do it on the fly by sending a message to the topic where services are listening to for receiving their configuration. This solution allows us to apply changes more straightforward and faster without restarting pods. Each service announces itself using its service's name. By default, the topic used to retrieve services' configuration is named tc-get-service-configuration, and it has the following schemas:

value:

{"name":"service_name","type":"string"},
{"name":"application","type":"string"},
{"name":"timestamp","type":"string"}

key:

"name":"service_name","type":"string"}

The topic where services listen to for receiving their configuration is named tc-set-service-configuration, and it has the following schemas:

value:

{"name":"service_name","type":"string"},{"name":"timestamp","type":"string"},{"name":"start_environment","type":"string"},{"name":"datacentre","type":"string"},{"name":"external_rest_services","type":"string"},{"name":"persistence_conf","type":"string"},{"name":"credentials","type":"string"}

key:

"name":"service_name","type":"string"}

The service logs each operation to the topic services-configuration-monitoring that has the following schemas:

value

{\"name\":\"service_name\",\"type\":\"string\"},{\"name\":\"application\",\"type\":\"string\"},{\"name\":\"timestamp\",\"type\":\"string\"},{\"name\":\"configuration_requested\",\"type\":\"int\"},{\"name\":\"configuration_retrieved\",\"type\":\"int\"}

key:

"name":"service_name","type":"string"}

The default configuration received aims to provide the service with a generic range of information services might react.

start_environment

external_rest_service= a dictionary of external services to contact. Examples

{
 "deployment_proxy_url": "http://localhost:5500/api/deploy",
 "oauth_token": "http://localhost:3001/api/token"
}

or if you want to provide your code with more information

MY_SERVICE": {
  "url": "https://api.myservice.com/me",
  "method": "GET",
  "headers": {
    "Content-Type": "application/json"
  },
  "body": {}
}

datacentre: more than often, services need to access data from a given data centre. Here you can insert a dictionary or a list.

persistence_conf: information about where to store data. credentials: credentials to use in your code

Infrastructure pre-requisites:

  • K8s cluster (preferred)
  • Apache Kafka Brokers ( with optional Schema Registry )

How to use it:

If you want to use the default settings, you have to use a Confluent Apache Kafka Brokers with Schema Registry. Under the hood, this package has a dependency with the confluent-kafka-producers-wrapper, so the minimum information to provide is

service_name = the name of your service, as registered in the Services Configuration Repository tool.
brokers  = your Confluent Apache Brokers here
schema_registry = your Schema Registry here 

Referer to this page for more information about how to set the environment variables If you want to use different topics, you have to specify them using these environment variables:


topic_for_getting_conf = the topic where services will send message to request their configuration
topic_for_setting_conf  = the topic the services will listen to retrieve their configuration

topic_for_setting_conf_no_avro = 1 if the topic makes no use of the Schema Registry. 
topic_for_getting_conf_no_avro = 1 if the topic makes no use of the Schema Registry

from service_configuration_controller.request_service_configuration import wait_to_retrieve_service_configuration

if __name__ == '__main__':
    if wait_to_retrieve_service_configuration():
        print("conf received")

    import time

    while True:
        time.sleep(2)
        print("do my job")

Metadata

Release files for service-configuration-layer 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for service-configuration-layer 0.0.7
File Size Uploaded Provenance Actions
service_configuration_layer-0.0.7.tar.gz 10.0 kB Without provenance Details for service_configuration_layer-0.0.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for service-configuration-layer 0.0.7
File Interpreter ABI Platform Actions
service_configuration_layer-0.0.7-py3-none-any.whl Python 3 none any Details for service_configuration_layer-0.0.7-py3-none-any.whl

Total release size: 22.4 kB

Release files / service_configuration_layer-0.0.7.tar.gz

Download URL service_configuration_layer-0.0.7.tar.gz
Size 10.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cc7b18c88c153589b385558fb049358dcef60545e41cb1132c4ff96f2f55c4c2
BLAKE2b-256 checksum
How to use checksums
ac4bae2b42149b25fc736462191dcc833537c498bc8fdcf3373746fc3877d6ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.2

Release files / service_configuration_layer-0.0.7-py3-none-any.whl

Download URL service_configuration_layer-0.0.7-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e18fd43b1f49bb92145f0ab0ced428d7b87aad8fe19d29869f4c0c10acd2b269
BLAKE2b-256 checksum
How to use checksums
d18fe79e1befe31a4db793431ee8a685deea9e318c7fa2877a808409c3b9d936
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.2

Security for service-configuration-layer 0.0.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page