You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This folder contains an example for Carbon Aware SDK and Swagger UI for the SDK. The user can demonstrate Carbon Aware SDK via Swagger UI with just one command.
4
+
5
+
This demonstration uses `podman play kube` to deploy apps like a Kubernetes application. Deployment is defined in [demo.yaml](demo.yaml).
6
+
7
+
## Requirements
8
+
9
+
- Podman
10
+
11
+
## Ports to open
12
+
13
+
Podman creates virtual network, then all of containers in the deployment would be located flatten. So Each containers can access each other as a `localhost`. We need to consider TCP port:
14
+
15
+
* 8080: Carbon Aware SDK
16
+
* 8081: Swagger UI
17
+
* 8082: NGINX (for reverse proxy)
18
+
19
+
NGINX is a reverse proxy to both Carbon Aware SDK and Swagger UI. To avoid CORS error, you can access Swagger UI via NGINX ( http://localhost:8082/swagger-ui/ ).
20
+
21
+
## Reverse proxy rule
22
+
23
+
See [nginx-rp.conf](nginx-rp.conf)
24
+
25
+
/ -> Carbon Aware SDK
26
+
/swagger.yaml -> OpenAPI document provided by Carbon Aware SDK
27
+
/swagger-ui/ -> Swagger UI for Carbon Aware SDK
28
+
29
+
## How to run
30
+
31
+
1. Set environment variables prefixed with `CASDK_`: e.g. `CASDK_DataSources__EmissionsDataSource`
32
+
33
+
2. Start demonstration
34
+
35
+
```
36
+
./demo.sh start
37
+
```
38
+
39
+
:::warning
40
+
41
+
*[demo.sh](demo.sh) would create `/tmp/casdk-config.yaml` which may contain credentials (e.g. API token of backend service). This file would be removed by `./demo.sh stop`.
42
+
*[demo.sh](demo.sh) would change security context of [nginx-rp.conf](nginx-rp.conf) to `container_file_t` if SELinux is enabled. It would not recover in `./demo.sh stop`, so you need to recover manually via `restorecon` if need.
0 commit comments