Skip to content

Commit

Permalink
Merge pull request #12 from NBISweden/tls-config
Browse files Browse the repository at this point in the history
cronjob and secret added
  • Loading branch information
darthvader2 authored Apr 5, 2024
2 parents d206da7 + 11a73a3 commit 34c075b
Show file tree
Hide file tree
Showing 11 changed files with 109 additions and 34 deletions.
2 changes: 1 addition & 1 deletion charts/landing-pages-chart/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.2
version: 0.1.3

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
56 changes: 56 additions & 0 deletions charts/landing-pages-chart/templates/lp_cj.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: lp-generator-cronjob
spec:
schedule: {{ .Values.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: lp-generator-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"
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 }}
20 changes: 19 additions & 1 deletion charts/landing-pages-chart/values.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@

images:
lp_image:
namespace:
s3Host:
bucketUrl:

tls: false
domainName:
secretName:
clusterIssuer:
clusterIssuer:

s3MetadataBucket:
url:
accesskey:
secretkey:
bucket:
region:

s3DeploymentBucket:
url:
accesskey:
secretkey:
bucket:
region:

schedule: "0 0 1 * *"
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 34c075b

Please sign in to comment.