Skip to content

Commit

Permalink
uploader fix
Browse files Browse the repository at this point in the history
  • Loading branch information
darthvader2 committed Apr 5, 2024
1 parent 7777d8a commit 628975f
Show file tree
Hide file tree
Showing 10 changed files with 114 additions and 33 deletions.
63 changes: 63 additions & 0 deletions charts/landing-pages-chart/templates/lp_cj.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: lp-generator-cronjob
namespace: {{ .Values.namespace }}
spec:
schedule: {{ .Values.backupconfig.schedule }}
concurrencyPolicy: Forbid
startingDeadlineSeconds: 3600
jobTemplate:
spec:
backoffLimit: 2
ttlSecondsAfterFinished: 120
template:
spec:
securityContext:
runAsUser: 1000
runAsGroup: 1000
fsGroup: 1000
volumes:
- name: "tmp"
emptyDir:
sizeLimit: "1Gi"
- name: "cronjob"
projected:
defaultMode: 0400
sources:
- secret:
name: "lp-generator-secret"
containers:
- name: gc-backup-container
image: {{ .Values.images.lp_image }}
imagePullPolicy: Always
env:
- name: CONFIGFILE
value: "/.secrets/config.yaml"
volumeMounts:
- name: "tmp"
mountPath: "/tmp"
- name: "cronjob"
mountPath: "/.secrets/config.yaml"
subPath: "config.yaml"
- name: "cronjob"
mountPath: "/.secrets/keys/key.pub.pem"
subPath: "key.pub.pem"
- name: "cronjob"
mountPath: "/.secrets/keys/key.sec.pem"
subPath: "key.sec.pem"
resources:
requests:
cpu: "100m"
memory: "128M"
limits:
cpu: "100m"
memory: "128M"
securityContext:
seccompProfile:
type: RuntimeDefault
capabilities:
drop: ["ALL"]
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
restartPolicy: OnFailure
19 changes: 19 additions & 0 deletions charts/landing-pages-chart/templates/lp_secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v1
kind: Secret
metadata:
name: lp-generator-secret
type: Opaque
stringData:
config.yaml: |
S3MetadataBucket:
url: {{ .Values.s3MetadataBucket.url }}
accesskey: {{ .Values.s3MetadataBucket.accesskey }}
secretkey: {{ .Values.s3MetadataBucket.secretkey }}
bucket: {{ .Values.s3MetadataBucket.bucket }}
region: {{ .Values.s3MetadataBucket.region }}
S3DeploymentBucket:
url: {{ .Values.S3DeploymentBucket.url }}
accesskey: {{ .Values.S3DeploymentBucket.accesskey }}
secretkey: {{ .Values.S3DeploymentBucket.secretkey }}
bucket: {{ .Values.S3DeploymentBucket.bucket }}
region: {{ .Values.S3DeploymentBucket.region }}
19 changes: 18 additions & 1 deletion charts/landing-pages-chart/values.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@

images:
lp_image:
namespace:
s3Host:
bucketUrl:

tls: false
domainName:
secretName:
clusterIssuer:
clusterIssuer:

S3MetadataBucket:
url: "asdfe"
accesskey: sdef
secretkey: sage
bucket: sage
region: asegt

S3DeploymentBucket:
url: asegt
accesskey: aasegf
secretkey: asef
bucket: asegt
region: asegtf

8 changes: 6 additions & 2 deletions static_files_uploader.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"bytes"
"context"
"net/http"
"os"
Expand Down Expand Up @@ -39,7 +40,10 @@ func test(DeploymenClient *DeploymentBackend) {
log.Println("Failed opening file", path, err)
continue
}
buf := make([]byte, 512)
fileInfo, _ := file.Stat()
var fileSize int64 = fileInfo.Size()

buf := make([]byte, fileSize)
_, err = file.Read(buf)
contentType := http.DetectContentType(buf)
ext := filepath.Ext(path)
Expand All @@ -56,7 +60,7 @@ func test(DeploymenClient *DeploymentBackend) {
result, err := uploader.Upload(context.TODO(), &s3.PutObjectInput{
Bucket: &bucket,
Key: aws.String(rel),
Body: file,
Body: bytes.NewReader(buf),
ContentType: aws.String(contentType),
})
println(contentType)
Expand Down
2 changes: 1 addition & 1 deletion web/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ uglyURLs = true
[params]
header_image = "img/bigpicture-banner.jpg"
SEOTitle = "Bigpicture datasets"
slogan = "Demo site for Bigpicture landing pages using HUGO"
slogan = "Production site for Bigpicture landing pages"

image_404 = "img/404-bg.jpg"

Expand Down
2 changes: 0 additions & 2 deletions web/content/datasets/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,3 @@ title: "Test"
date: 2024-03-20T10:31:33+01:00
layout: test
---

helloowsdfsdf
4 changes: 2 additions & 2 deletions web/layouts/_default/baseof.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
<!-- Page Header -->
{{ block "header" .}}

<header class="page-header" style="background-image: url('{{ .Site.Params.header_image | relURL }}')",role="banner" >
<header class="page-header" ,role="banner" >
<h1 class="project-name" >{{ .Site.Title}} </h1>
<h2 class="project-tagline">{{ .Site.Params.slogan }}</h2>
</header>
{{ end }}

<body>
<main id="content" class="main-content" role="main">
{{ block "main" . }}

Expand Down
18 changes: 5 additions & 13 deletions web/layouts/datasets/list.html
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
{{ define "main" }}


<ul>
<!-- Ranges through content/posts/*.md -->
{{ range .Pages }}
<li>
<a href="{{ .RelPermalink }}"> {{ .Page }}</a>


</li>
{{ end }}
{{ range .Pages }}
<li>
<a href="{{ .RelPermalink }}"> {{ .Page }}</a>
</li>
{{ end }}
</ul>

{{ .Params.datasets.name }}

{{ .Content }}

{{ end }}
10 changes: 0 additions & 10 deletions web/layouts/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<div data-pagefind-ignore="all" class="container">
<main id="content" class="main-content" role="main" >
<h2>NOTICE (Please read the following notice carefully)</h2>
This is a prototype website for Dataset description pages / DOI landing pages for Bigpicture.
<br/>
This website is openly accessible to Everyone on the Internet, because the purpose of Dataset description pages / DOI landing pages is to be accessible to anyone on the Internet.
<br/>
Expand All @@ -11,16 +10,7 @@ <h2>NOTICE (Please read the following notice carefully)</h2>
2) how it can be used, <br/>
3) why they should bother applying for access, and how to apply for access.
<br/>
This website was set up on instruction from wp3 (data contributor) leadership, with a starting point in the AIDA Data Hub Dataset register format, in order to iterate toward a suitable format for Dataset description pages / DOI landing pages in Bigpicture, in dialogue with the reference group consisting of data contributor representatives, which is authorized by the managing board<br/>
to make decisions for this prototype. This will happen in two-week feedback iterations. When the reference group is happy with the format, it will be submitted to the managing board for approval for

integration nto the Bigpicture metadata standard.

{{ with .Site.Params.sidebar_avatar }}
<a href="{{ "/about" | relLangURL }}">
<img class="home-image", src="{{ . | relURL }}" alt="avatar" style="cursor: pointer" />
</a>
{{ end }}

</main>

Expand Down
2 changes: 0 additions & 2 deletions web/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ body {

.page-header{
background-color: #146eb8;
background-image: url(/assets/images/bigpicture-banner.jpg);
color: #1C007B;
background-size: 50%;
background-position-y: center;
}
.page-header a {
Expand Down

0 comments on commit 628975f

Please sign in to comment.