Skip to content

Commit

Permalink
WP: traefik doesnt want to handle request body
Browse files Browse the repository at this point in the history
  • Loading branch information
victorjourne committed Jan 11, 2024
1 parent dbeee32 commit c326a6b
Show file tree
Hide file tree
Showing 3 changed files with 162 additions and 66 deletions.
10 changes: 4 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -186,16 +186,14 @@ deploy-k8s-configmap: create-namespace

deploy-k8s-volume: create-namespace
@cat ${KUBE_DIR}/volume.yaml | envsubst | kubectl apply -f -

deploy-traefik:
helm upgrade --install --values ${KUBE_DIR}/traefik/values.yaml traefik traefik/traefik --namespace traefik
@cat ${KUBE_DIR}/ingress.yaml | envsubst | kubectl apply -f -
{KUBE_DIR}/ingress.yaml | envsubst | kubectl apply -f -

deploy-k8s-ekl: create-namespace
@echo $@
@cat ${KUBE_DIR}/ekl/elasticsearch.yaml | envsubst | helm upgrade --install elasticsearch elastic/elasticsearch -n ridoc -f -
@cat ${KUBE_DIR}/ekl/kibana.yaml | envsubst | helm upgrade --install kibana elastic/kibana -n ridoc -f -
#@cat ${KUBE_DIR}/ekl/elasticsearch.yaml | envsubst | helm upgrade --install elasticsearch elastic/elasticsearch -n ridoc -f -
#@cat ${KUBE_DIR}/ekl/kibana.yaml | envsubst | helm upgrade --install kibana elastic/kibana -n ridoc -f -
#@cat ${KUBE_DIR}/ekl/logstash.yaml | envsubst | helm upgrade --install logstash elastic/logstash -n ridoc -f -
@cat ${KUBE_DIR}/ekl/filebeat.yaml | envsubst | helm upgrade --install filebeat elastic/filebeat -n ridoc -f -

deploy-k8s-frontend: deploy-k8s-configmap
@echo $@
Expand Down
54 changes: 49 additions & 5 deletions deployments/traefik/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,26 @@ deployment:
volumeMounts:
- mountPath: /data
name: traefik-internal
# additionalContainers:
# - name: stream-accesslog
# args:
# - /bin/sh
# - -c
# - tail -n+1 -F /tmp/traefik/access.log
# image: busybox
# imagePullPolicy: Always
# resources: {}
# terminationMessagePath: /dev/termination-log
# terminationMessagePolicy: File
# volumeMounts:
# - mountPath: /tmp/traefik
# name: traefik-logs
# readOnly: true

additionalVolumes:
- name: traefik-logs
hostPath:
path: /tmp


updateStrategy:
Expand All @@ -64,20 +84,33 @@ updateStrategy:
maxUnavailable: 1
maxSurge: 0

additionalVolumeMounts:
- name: traefik-logs
mountPath: /tmp/traefik

logs:
general:
# Alternative logging levels are DEBUG, PANIC, FATAL, ERROR, WARN, and INFO.
level: INFO
# format: json
access:
# To enable access logs
enabled: true
# format: json
## By default, logs are written using the Common Log Format (CLF) on stdout.
## To write logs in JSON, use json in the format option.
## If the given format is unsupported, the default (CLF) is used instead.
# format: json
filePath: "/tmp/logs/access.log"


filePath: "/tmp/traefik/access.log"
# filters:
# minDuration: "1ms"
# statuscodes: "200_209"
# headers:
# defaultmode: drop
# names:
# ## Examples:
# # User-Agent: redact
# # Authorization: drop
# # Content-Type: keep
ingressRoute:
dashboard:
enabled: true
Expand Down Expand Up @@ -107,4 +140,15 @@ extraObjects:
namespace: traefik
spec:
basicAuth:
secret: traefik-dashboard-auth-secret
secret: traefik-dashboard-auth-secret

# - apiVersion: v1
# kind: PersistentVolumeClaim
# metadata:
# name: traefik-access-log
# spec:
# accessModes:
# - ReadWriteOnce
# resources:
# requests:
# storage: 10Mi
164 changes: 109 additions & 55 deletions frontend/src/routes/ResultPage.svelte
Original file line number Diff line number Diff line change
@@ -1,78 +1,132 @@
<svelte:head>
<title>{filename}</title>
</svelte:head>

<script>
import { onMount } from 'svelte';
import { httpClient, index, upload, createMeta, isEmpty } from '../components/utils.js';
import {envJson,itemJson} from '../components/user-data.store'
import Ratesearch from '../components/ratesearch.svelte'
import { onMount } from "svelte";
import {
httpClient,
index,
upload,
createMeta,
isEmpty,
} from "../components/utils.js";
import { envJson, itemJson } from "../components/user-data.store";
import Ratesearch from "../components/ratesearch.svelte";
import Entry from "../components/Entry.svelte";
import { headers } from "../components/stores.js";
let titre = true;
let readonly = true;
let required = false;
let inputs = [];
let _source_includes = "";
let filename;
let link;
import Entry from '../components/Entry.svelte';
let titre=true;
let meta=undefined;
let display;
let readonly=true;
let required=false;
let inputs=[];
let _source_includes='';
let filename
let link
onMount(() => {
let iframe;
function getMeta(){
let promiseIndex = new Promise(() => {});
onMount(async () => {
async function getMeta() {
// Filter entries in $itemJson with isDetailed at false
inputs = $itemJson.inputs.filter(entry => ((entry.isDetailed !== undefined) && entry.isDetailed) || (entry.isDetailed == undefined))
_source_includes = inputs.map(x=>x.key).join()
httpClient().fetch('./backend/user/'+$envJson['index_name']+'/_doc/'+filename+"?_source_includes="+_source_includes)
.then(response => response.json())
.then(data => {
[meta, display] = createMeta(inputs, data, {})
});
}
function waitindex(){ //eviter les problèmes de undefined
if($envJson['index_name']!=undefined){
inputs = $itemJson.inputs.filter(
(entry) =>
(entry.isDetailed !== undefined && entry.isDetailed) ||
entry.isDetailed == undefined,
);
_source_includes = inputs.map((x) => x.key).join();
const response = await httpClient().fetch(
"./backend/user/" +
$envJson["index_name"] +
"/_doc/" +
filename +
"?_source_includes=" +
_source_includes,
);
//const { page } = stores(); // sveltekit
const urlParams = new URLSearchParams(window.location.search);
filename = urlParams.get('filename');
link = `/ViewerJS/?zoom=page-width#../backend/user/files/${$envJson.dstDir}/${filename}`
getMeta()
const data = await response.json();
return createMeta(inputs, data, {});
}
else{
setTimeout(waitindex,100)
async function waitindex() {
//eviter les problèmes de undefined
if ($envJson["index_name"] != undefined) {
//const { page } = stores(); // sveltekit
const urlParams = new URLSearchParams(window.location.search);
filename = urlParams.get("filename");
link = `/ViewerJS/?zoom=page-width#../backend/user/files/${$envJson.dstDir}/${filename}`;
const res = await fetch(link, {
method: "GET",
headers: $headers
});
const blob = await res.blob();
const urlObject = URL.createObjectURL(blob);
iframe.setAttribute("src", urlObject);
const [meta, display] = await getMeta();
console.log(meta);
return meta;
} else {
console.log("wait 100ms")
await new Promise((resolve) => setTimeout(resolve, 100));
return await waitindex();
}
}
waitindex()
promiseIndex = await waitindex();
});
</script>

{#if meta !=undefined && $itemJson!=undefined && filename !=undefined}

<div class= "grid grid-cols justify-center">
<div class="card bg-white place-self-center p-10 grid grid-cols justify-center rounded shadow w-auto">
<svelte:head>
<title>{filename}</title>
</svelte:head>

<div class="mb-6">
<Ratesearch class="" {filename}/>
<div class="grid grid-cols justify-center">
<div
class="card bg-white place-self-center p-10 grid grid-cols justify-center rounded shadow w-auto"
>
<div class="mb-6">
<Ratesearch class="" {filename} />

{#each meta as { value, key, type, placeholder, innerHtml, highlight, metadata, rows, color} (key)}
{#if !isEmpty(value) || (!readonly && metadata) }
<Entry {readonly} {required} bind:value {key} {type} {placeholder} {innerHtml} {highlight} {metadata} {rows} {color} />
{/if}
{/each}
{#await promiseIndex}
Attente des meta données
{:then meta}
{#each meta as { value, key, type, placeholder, innerHtml, highlight, metadata, rows, color } (key)}
{#if !isEmpty(value) || (!readonly && metadata)}
<Entry
{readonly}
{required}
bind:value
{key}
{type}
{placeholder}
{innerHtml}
{highlight}
{metadata}
{rows}
{color}
/>
{/if}
{/each}
{/await}
</div>

<iframe
title="iframe"
bind:this={iframe}
class="place-self-center"
width="1025"
height="578"
allowfullscreen
webkitallowfullscreen
></iframe>
</div>
<iframe class="place-self-center" src = {link} width='1025' height='578' allowfullscreen webkitallowfullscreen></iframe>
</div>
</div>
{/if}

<style>
.card{
.card {
max-width: min-content !important;
}
.tag{
.tag {
max-width: min-content !important;
background-color: #F0F0F0;
background-color: #f0f0f0;
border-radius: 40px;
}
</style>

0 comments on commit c326a6b

Please sign in to comment.