Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT: Add new instructions API #98

Draft
wants to merge 24 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
6a29464
update takserver to 5.3-24
rambo Jan 25, 2025
3f4df43
increase timeout
rambo Jan 25, 2025
2e343da
update rmapi pointer
rambo Jan 26, 2025
d049371
update takrmapi pointer
rambo Jan 26, 2025
c46d662
battlelog miniwerk configs
rambo Jan 26, 2025
f816bff
Update compositions for new miniwerk config requirements
rambo Jan 26, 2025
eb98445
updated api dockerfile
rambo Jan 26, 2025
6c2f262
disable battlelog from manifest in production until we finish integra…
rambo Jan 26, 2025
23e0217
log the random callsign we try to get things for to refer to logs
rambo Jan 26, 2025
610e65e
try to set log rmapi/takrmapi levels via env
rambo Jan 26, 2025
5fa47ca
retry the user files
rambo Jan 26, 2025
d403b22
takintegration race conditions and temp directory handling
rambo Jan 26, 2025
bc81b13
update takrmapi pointer, use prefixed log_level
rambo Jan 26, 2025
e223a9f
fix production log level ENV
rambo Jan 26, 2025
b7eb883
takrmapi mitigations for https://github.com/pvarki/python-tak-rmapi/i…
rambo Jan 26, 2025
d10ac40
Add release tag to ENV/ARG for rmapi and rmui
rambo Jan 26, 2025
d8a5b7c
update api pointer for deployment tag
rambo Jan 26, 2025
97f5d93
Add mTLS verify failure reason to the redirects
rambo Jan 26, 2025
95f698f
treat 495 as 302 redirect to the error page
rambo Jan 26, 2025
9a60ce8
update api pointer to include the new by role and only deleted list e…
rambo Jan 27, 2025
20aff82
Initial new branches for submodules
rambo Jul 6, 2024
01bb771
taknginx static www
rem-ari-karhunen Dec 15, 2024
a356913
tak_www_static volume
rem-ari-karhunen Jan 27, 2025
9c25380
pointers
karppo Jan 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 1.6.0
current_version = 1.7.0
commit = False
tag = False

Expand Down
1 change: 1 addition & 0 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ services:
SERVER_DOMAIN: ${SERVER_DOMAIN:-localmaeher.dev.pvarki.fi}
API_PORT: ${NGINX_HTTPS_PORT:-4439}
VITE_ASSET_SET: ${VITE_ASSET_SET:-neutral}
RELEASE_TAG: "localdev"
networks:
- intranet
ports: # REMINDER Do not expose these in production
Expand Down
23 changes: 18 additions & 5 deletions docker-compose-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ x-keycloakinit_users_env: &keycloakinit_users_env
KEYCLOAK_PASSWORD: *kcadminpass # pragma: allowlist secret

x-takbuilds: &takbuildinfo
image: &takimage "pvarki/takserver:${TAK_RELEASE:-5.2-RELEASE-30}${DOCKER_TAG_EXTRA:-}"
image: &takimage "pvarki/takserver:${TAK_RELEASE:-5.3-RELEASE-24}${DOCKER_TAG_EXTRA:-}"
build:
context: ./takserver
dockerfile: Dockerfile
args:
TAK_RELEASE: ${TAK_RELEASE:-5.2-RELEASE-30}
TAK_RELEASE: ${TAK_RELEASE:-5.3-RELEASE-24}

x-nginxbuilds: &nginxbuildinfo
image: pvarki/nginx:1.25${DOCKER_TAG_EXTRA:-}
Expand Down Expand Up @@ -120,10 +120,13 @@ services:
target: production
environment:
MW_DOMAIN: *serverdomain
MW_PRODUCTS: "tak,kc,fake"
MW_PRODUCTS: "tak,kc,fake,bl"
MW_RASENMAEHER__API_PORT: *apiport
MW_RASENMAEHER__USER_PORT: *apiport
MW_FAKE__API_PORT: *productport
MW_FAKE__USER_PORT: *productport
MW_TAK__API_PORT: *takapiport
MW_TAK__USER_PORT: 8443
CAROOT: "/data/persistent/mkcert"
MW_LE_EMAIL: "notusedwithmkcert@example.com"
MW_LE_TEST: "true"
Expand Down Expand Up @@ -399,6 +402,10 @@ services:
RM_KC_USERNAME: *kcadminuser
RM_KC_PASSWORD: *kcadminpass # pragma: allowlist secret
RM_KC_REALM: *kc_realm
UVICORN_LOG_LEVEL: "debug"
RM_LOG_LEVEL: "DEBUG"
RM_LOG_LEVEL_INT: "10"
RELEASE_TAG: "local"
networks:
- apinet
- kcnet
Expand Down Expand Up @@ -441,6 +448,7 @@ services:
target: production
args:
VITE_ASSET_SET: ${VITE_ASSET_SET:-neutral}
RELEASE_TAG: "local"
volumes:
- rmui_files:/deliver

Expand Down Expand Up @@ -748,7 +756,7 @@ services:
restart: unless-stopped

takrmapi:
image: pvarki/takrmapi:local${DOCKER_TAG_EXTRA:-}-tak${TAK_RELEASE:-5.2-RELEASE-30}
image: pvarki/takrmapi:local${DOCKER_TAG_EXTRA:-}-tak${TAK_RELEASE:-5.3-RELEASE-24}
build:
context: ./takintegration
dockerfile: Dockerfile
Expand All @@ -758,12 +766,15 @@ services:
network_mode: "service:takconfig"
environment:
LOG_CONSOLE_FORMATTER: "local"
UVICORN_LOG_LEVEL: "debug"
TI_LOG_LEVEL: "10"
volumes:
- ca_public:/ca_public
- le_certs:/le_certs
- kraftwerk_shared_tak:/pvarki
- takrmapi_data:/data/persistent
- tak_data:/opt/tak/data
- tak_www_static:/www_static
depends_on:
rmnginx:
condition: service_healthy
Expand All @@ -785,6 +796,7 @@ services:
- nginx_templates:/nginx_templates
- ca_public:/ca_public
- le_certs:/le_certs
- tak_www_static:/www_static
environment:
NGINX_HOST: *takdomain
NGINX_HTTPS_PORT: *takapiport
Expand All @@ -794,7 +806,7 @@ services:
CFSSL_OCSP_BIND_PORT: *oscpport
NGINX_OCSP_UPSTREAM: *ocsphost
DNS_RESOLVER_IP: *dnsresolver
NGINX_TEMPLATE_DIR: "templates_productapi"
NGINX_TEMPLATE_DIR: "templates_rasenmaeher_takapi"
networks:
- taknet
- intranet
Expand Down Expand Up @@ -851,3 +863,4 @@ volumes:
takrmapi_data:
rmui_files:
nginx_templates:
tak_www_static:
41 changes: 27 additions & 14 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ x-keycloakinit_users_env: &keycloakinit_users_env
KEYCLOAK_PASSWORD: *kcadminpass # pragma: allowlist secret

x-takbuilds: &takbuildinfo
image: &takimage "pvarki/takserver:${TAK_RELEASE:-5.2-RELEASE-30}-d${RELEASE_TAG:-1.6.0}${DOCKER_TAG_EXTRA:-}"
image: &takimage "pvarki/takserver:${TAK_RELEASE:-5.3-RELEASE-24}-d${RELEASE_TAG:-1.7.0}${DOCKER_TAG_EXTRA:-}"
build:
context: ./takserver
dockerfile: Dockerfile
args:
TAK_RELEASE: ${TAK_RELEASE:-5.2-RELEASE-30}
TAK_RELEASE: ${TAK_RELEASE:-5.3-RELEASE-24}

x-nginxbuilds: &nginxbuildinfo
image: pvarki/nginx:1.25-d${RELEASE_TAG:-1.6.0}${DOCKER_TAG_EXTRA:-}
image: pvarki/nginx:1.25-d${RELEASE_TAG:-1.7.0}${DOCKER_TAG_EXTRA:-}
build:
context: ./nginx
dockerfile: Dockerfile
Expand Down Expand Up @@ -115,20 +115,24 @@ x-takserver_env: &takserver_env

services:
miniwerk:
image: pvarki/miniwerk:1.1.0-d${RELEASE_TAG:-1.6.0}${DOCKER_TAG_EXTRA:-}
image: pvarki/miniwerk:1.3.0-d${RELEASE_TAG:-1.7.0}${DOCKER_TAG_EXTRA:-}
build:
context: ./miniwerk
dockerfile: Dockerfile
target: production
environment:
MW_DOMAIN: *serverdomain
MW_RASENMAEHER__API_PORT: *apiport
MW_RASENMAEHER__USER_PORT: *apiport
MW_FAKE__API_PORT: *productport
MW_FAKE__USER_PORT: *productport
MW_TAK__API_PORT: *takapiport
MW_TAK__USER_PORT: 8443
MW_LE_EMAIL: ${MW_LE_EMAIL?LE contact email must be defined}
MW_LE_TEST: ${MW_LE_TEST:-true} # see example_env.sh
MW_MKCERT: ${MW_MKCERT:-false} # When LetEncrypt cannot be used set to "true"
MW_KEYTYPE: "rsa"
#MW_PRODUCTS: "tak,kc,bl"
MW_PRODUCTS: "tak,kc"
volumes:
- kraftwerk_shared_fake:/pvarkishares/fake
Expand All @@ -141,7 +145,7 @@ services:
- "80:80"

cfssl:
image: pvarki/cfssl:api-1.2.0-d${RELEASE_TAG:-1.6.0}${DOCKER_TAG_EXTRA:-}
image: pvarki/cfssl:api-1.2.0-d${RELEASE_TAG:-1.7.0}${DOCKER_TAG_EXTRA:-}
build:
context: ./cfssl
dockerfile: Dockerfile
Expand All @@ -164,7 +168,7 @@ services:
restart: unless-stopped

ocsp:
image: pvarki/cfssl:ocsp-1.2.0-d${RELEASE_TAG:-1.6.0}${DOCKER_TAG_EXTRA:-}
image: pvarki/cfssl:ocsp-1.2.0-d${RELEASE_TAG:-1.7.0}${DOCKER_TAG_EXTRA:-}
build:
context: ./cfssl
dockerfile: Dockerfile
Expand All @@ -190,7 +194,7 @@ services:
restart: unless-stopped

ocsprest:
image: pvarki/cfssl:ocsprest-1.0.4-d${RELEASE_TAG:-1.6.0}${DOCKER_TAG_EXTRA:-}
image: pvarki/cfssl:ocsprest-1.0.4-d${RELEASE_TAG:-1.7.0}${DOCKER_TAG_EXTRA:-}
build:
context: ./cfssl
dockerfile: Dockerfile
Expand Down Expand Up @@ -250,7 +254,7 @@ services:
condition: service_completed_successfully

openldap:
image: pvarki/openldap:1.0.0-d${RELEASE_TAG:-1.6.0}${DOCKER_TAG_EXTRA:-}
image: pvarki/openldap:1.0.0-d${RELEASE_TAG:-1.7.0}${DOCKER_TAG_EXTRA:-}
build:
context: ./keycloak/openldap
dockerfile: Dockerfile
Expand Down Expand Up @@ -360,7 +364,7 @@ services:
condition: service_healthy

rmapi:
image: pvarki/rmapi:1.5.0-d${RELEASE_TAG:-1.6.0}${DOCKER_TAG_EXTRA:-}
image: pvarki/rmapi:1.6.0-d${RELEASE_TAG:-1.7.0}${DOCKER_TAG_EXTRA:-}
build:
context: ./api
dockerfile: Dockerfile
Expand All @@ -381,6 +385,8 @@ services:
RM_KC_USERNAME: *kcadminuser
RM_KC_PASSWORD: *kcadminpass # pragma: allowlist secret
RM_KC_REALM: *kc_realm
RM_LOG_LEVEL: "INFO"
RELEASE_TAG: ${RELEASE_TAG:-1.7.0}
networks:
- apinet
- kcnet
Expand Down Expand Up @@ -414,18 +420,19 @@ services:
restart: unless-stopped

rmui:
image: pvarki/rmui:1.3.0-${VITE_ASSET_SET:-neutral}-d${RELEASE_TAG:-1.6.0}${DOCKER_TAG_EXTRA:-}
image: pvarki/rmui:1.3.0-${VITE_ASSET_SET:-neutral}-d${RELEASE_TAG:-1.7.0}${DOCKER_TAG_EXTRA:-}
build:
context: ./ui
dockerfile: Dockerfile
target: production
args:
VITE_ASSET_SET: ${VITE_ASSET_SET:-neutral}
RELEASE_TAG: ${RELEASE_TAG:-1.7.0}
volumes:
- rmui_files:/deliver

nginx_templates:
image: pvarki/nginx:templates-d${RELEASE_TAG:-1.6.0}${DOCKER_TAG_EXTRA:-}
image: pvarki/nginx:templates-d${RELEASE_TAG:-1.7.0}${DOCKER_TAG_EXTRA:-}
build:
context: ./nginx
dockerfile: Dockerfile
Expand Down Expand Up @@ -484,7 +491,7 @@ services:
restart: unless-stopped

kwinit: # Mostly to make sure it's built
image: pvarki/kw_product_init:1.0.0-d${RELEASE_TAG:-1.6.0}${DOCKER_TAG_EXTRA:-}
image: pvarki/kw_product_init:1.0.0-d${RELEASE_TAG:-1.7.0}${DOCKER_TAG_EXTRA:-}
build:
context: ./kw_product_init
dockerfile: Dockerfile
Expand Down Expand Up @@ -648,13 +655,16 @@ services:
restart: unless-stopped

takrmapi:
image: pvarki/takrmapi:1.3.0-tak${TAK_RELEASE:-5.2-RELEASE-30}-d${RELEASE_TAG:-1.6.0}${DOCKER_TAG_EXTRA:-}
image: pvarki/takrmapi:1.4.1-tak${TAK_RELEASE:-5.3-RELEASE-24}-d${RELEASE_TAG:-1.7.0}${DOCKER_TAG_EXTRA:-}
build:
context: ./takintegration
dockerfile: Dockerfile
target: production
args:
TAKSERVER_IMAGE: *takimage
environment:
UVICORN_LOG_LEVEL: "info"
TI_LOG_LEVEL: "20"
labels:
- "autoheal=true"
network_mode: "service:takconfig"
Expand All @@ -664,6 +674,7 @@ services:
- kraftwerk_shared_tak:/pvarki
- tak_data:/opt/tak/data
- takrmapi_data:/data/persistent
- tak_www_static:/www_static
depends_on:
rmnginx:
condition: service_healthy
Expand All @@ -685,6 +696,7 @@ services:
- nginx_templates:/nginx_templates
- ca_public:/ca_public
- le_certs:/le_certs
- tak_www_static:/www_static
environment:
NGINX_HOST: *takdomain
NGINX_HTTPS_PORT: *takapiport
Expand All @@ -694,7 +706,7 @@ services:
CFSSL_OCSP_BIND_PORT: *oscpport
NGINX_OCSP_UPSTREAM: *ocsphost
DNS_RESOLVER_IP: *dnsresolver
NGINX_TEMPLATE_DIR: "templates_productapi"
NGINX_TEMPLATE_DIR: "templates_rasenmaeher_takapi"
networks:
- taknet
- intranet
Expand Down Expand Up @@ -764,3 +776,4 @@ volumes:
takrmapi_data:
rmui_files:
nginx_templates:
tak_www_static:
6 changes: 3 additions & 3 deletions nginx/templates_rasenmaeher/default.conf.template
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ server {

location /api {
if ($ssl_client_verify != SUCCESS) {
return 302 https://${NGINX_HOST}:${NGINX_HTTPS_PORT}/error?code=mtls_fail;
return 302 https://${NGINX_HOST}:${NGINX_HTTPS_PORT}/error?code=mtls_fail&exta=$ssl_client_verify;
}
proxy_pass http://${NGINX_UPSTREAM}:${NGINX_UPSTREAM_PORT}/api;
proxy_redirect off;
Expand All @@ -123,14 +123,14 @@ server {
}

# Even though users sees code 400 the code is 495 http://nginx.org/en/docs/http/ngx_http_ssl_module.html#errors
error_page 495 https://${NGINX_HOST}:${NGINX_HTTPS_PORT}/error?code=mtls_fail;
error_page 495 =302 https://${NGINX_HOST}:${NGINX_HTTPS_PORT}/error?code=mtls_fail&exta=$ssl_client_verify;

location / {
if ($redir_uri != "") {
return 301 $redir_uri$request_uri;
}
if ($ssl_client_verify != SUCCESS) {
return 302 https://${NGINX_HOST}:${NGINX_HTTPS_PORT}/error?code=mtls_fail;
return 302 https://${NGINX_HOST}:${NGINX_HTTPS_PORT}/error?code=mtls_fail&exta=$ssl_client_verify;
}
index index.html;
root /rmui_files;
Expand Down
43 changes: 43 additions & 0 deletions nginx/templates_rasenmaeher_takapi/default.conf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
ssl_certificate /le_certs/${NGINX_CERT_NAME}/fullchain.pem;
ssl_certificate_key /le_certs/${NGINX_CERT_NAME}/privkey.pem;

include /etc/nginx/includes/le_common_settings.conf;

server {
server_name ${NGINX_HOST};

# HTTPS configuration
listen ${NGINX_HTTPS_PORT} ssl;

ssl_client_certificate /ca_public/ca_chain.pem;
ssl_verify_client on;
ssl_ocsp leaf;
ssl_ocsp_responder http://${NGINX_OCSP_UPSTREAM}:${CFSSL_OCSP_BIND_PORT};
resolver ${DNS_RESOLVER_IP} ipv6=off;
#ssl_crl /ca_public/crl.pem;
ssl_verify_depth 3;


# This volume may only have content that EVERYONE with proper client certificate can view
location /content/static {
if ($ssl_client_verify != SUCCESS) {
return 401;
}
root /www_static;
}

location / {
if ($ssl_client_verify != SUCCESS) {
return 401;
}
proxy_pass http://${NGINX_UPSTREAM}:${NGINX_UPSTREAM_PORT};
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 900;
proxy_set_header X-ClientCert-DN $ssl_client_s_dn;
proxy_set_header X-ClientCert-Serial ssl_client_serial;
}
}
2 changes: 1 addition & 1 deletion takintegration
Submodule takintegration updated 39 files
+12 −3 Dockerfile
+6 −1 docker/container-init.sh
+13 −0 instructions/Makefile
+148 −0 instructions/ServiceTak.yml
+41 −0 instructions/ServiceTakQuickstart.yml
+4 −0 instructions/ServiceTakUsage.yml
+14 −0 instructions/ServiceTakUsageCard.yml
+26 −0 instructions/TakDownloadModal.yml
+76 −0 instructions/TakQuickstartAndroid1.yml
+4 −0 instructions/TakQuickstartAndroid2.yml
+4 −0 instructions/TakQuickstartAndroid3.yml
+4 −0 instructions/TakQuickstartAndroid4.yml
+4 −0 instructions/TakQuickstartAndroid5.yml
+4 −0 instructions/TakQuickstartIOS1.yml
+4 −0 instructions/TakQuickstartIOS2.yml
+4 −0 instructions/TakQuickstartIOS3.yml
+4 −0 instructions/TakQuickstartIOS4.yml
+4 −0 instructions/TakQuickstartIOS5.yml
+4 −0 instructions/TakQuickstartWin1.yml
+4 −0 instructions/TakQuickstartWin2.yml
+4 −0 instructions/TakQuickstartWin3.yml
+4 −0 instructions/TakQuickstartWin4.yml
+4 −0 instructions/TakUsageAndroid1.yml
+4 −0 instructions/TakUsageAndroid2.yml
+4 −0 instructions/TakUsageAndroid3.yml
+4 −0 instructions/TakUsageIos1.yml
+4 −0 instructions/TakUsageWin1.yml
+4 −0 instructions/TakUsageWin2.yml
+4 −0 instructions/TakUsageWin3.yml
+4 −0 instructions/TakUsageWin4.yml
+658 −0 instructions/tak.json
+13 −0 instructions/translations/ServiceTak.en.json
+6 −0 instructions/translations/ServiceTak.fi.json
+1,245 −1,039 poetry.lock
+2 −3 src/takrmapi/api/clientinfo.py
+28 −6 src/takrmapi/api/instructions.py
+20 −18 src/takrmapi/tak_helpers.py
+ tak_www_static/test_image.png
+9 −0 update_instructions.sh
2 changes: 1 addition & 1 deletion takserver
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
LOGGER = logging.getLogger(__name__)
CA_PATH = Path(__file__).parent / "testcas"
JWT_PATH = Path(__file__).parent / "testjwts"
DEFAULT_TIMEOUT = aiohttp.ClientTimeout(total=15.0)
DEFAULT_TIMEOUT = aiohttp.ClientTimeout(total=25.0)
OPENAPI_VER = "3.1.0"
API = os.environ.get("RM_API_BASE", "https://localmaeher.dev.pvarki.fi:4439/api") # pylint: disable=E1101
VER = "v1"
Expand Down
1 change: 1 addition & 0 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ pytest-asyncio>=0.23,<1.0.0
libpvarki @ git+https://github.com/pvarki/python-libpvarki.git@1.9.1
bump2version>=1.0.1,<2.0.0
pendulum>=3.0.0,<4.0.0
flaky>=3.8.1,<4.0.0
Loading
Loading