From a0e8701de087263055fe06cec2e842cf6c4ec036 Mon Sep 17 00:00:00 2001 From: Swordsteel Date: Thu, 21 Nov 2024 05:03:47 +0100 Subject: [PATCH] add DeviceApi --- CERTIFICATE.md | 11 +++++++++++ README.md | 22 +++++++++++++++++++++- compose.yml | 15 +++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 CERTIFICATE.md diff --git a/CERTIFICATE.md b/CERTIFICATE.md new file mode 100644 index 0000000..87d834a --- /dev/null +++ b/CERTIFICATE.md @@ -0,0 +1,11 @@ +# Generate Keystore + +### Generate Keystores +```shell +keytool -genkeypair -alias -keyalg RSA -keysize 2048 -validity 3650 -dname "CN=" -keypass -keystore ./keys/.p12 -storetype PKCS12 -storepass +``` + +### Export the public certificate +```shell +keytool -export -alias -keystore ./keys/.p12 -storepass -file ./keys/.cer -rfc +``` diff --git a/README.md b/README.md index adce94a..c50463d 100644 --- a/README.md +++ b/README.md @@ -50,13 +50,33 @@ JWT_PRIVATE_KEY: keys/private_key.pem #### Volume -This will allow you to mount a local private key `identity_private_key.pem` into the container. read `IDENTITY.md` for how to generate. +This will allow you to mount a local private key `identity_private_key.pem` into the container. Read `IDENTITY.md` for how to generate. ```text volumes: - ./keys/identity_private_key.pem:/app/resources/keys/private_key.pem ``` +### Device API + +Api for electronic devices. GitHub [Hlæja Device Data](https://github.com/swordsteel/hlaeja-device-api) + +#### Environment + +```text +SPRING_PROFILES_ACTIVE: docker +``` + +#### Volume + +This will allow you to mount a local keystore `device_api_keystore.p12`, and local public key `identity_public_key.pem` into the container. Read `CERTIFICATE.md`, and `IDENTITY.md` for how to generate. + +```text +volumes: + - ./keys/identity_public_key.pem:/app/resources/cert/public_key.pem + - ./keys/device_api_keystore.p12:/app/resources/cert/keystore.p12 +``` + ## Databases ### InfluxDB diff --git a/compose.yml b/compose.yml index 2a72596..e6ebf63 100644 --- a/compose.yml +++ b/compose.yml @@ -37,6 +37,21 @@ services: # volumes: # - ./keys/identity_private_key.pem:/app/resources/keys/private_key.pem + device-api: + image: hlaeja-device-api:0.1.0-SNAPSHOT + container_name: DeviceApi + restart: unless-stopped + environment: + SPRING_PROFILES_ACTIVE: docker + networks: + - develop + ports: + - "9000:8443" +# # mount a local `identity_public_key.pem` into the container. +# volumes: +# - ./keys/identity_public_key.pem:/app/resources/cert/public_key.pem +# - ./keys/device_api_keystore.p12:/app/resources/cert/keystore.p12 + influxdb: image: influxdb:2.7.10-alpine container_name: InfluxDB