-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from NBISweden/push-static-files
Helm chart for landing pages
- Loading branch information
Showing
39 changed files
with
336 additions
and
665 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
web/content/datasets/* | ||
web/content/datasets/* | ||
dev_utils/* | ||
nginx_proxy/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: Publish chart | ||
on: | ||
push: | ||
branches: | ||
- main | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
continue-on-error: true | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Configure Git | ||
run: | | ||
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
- name: Install Helm | ||
uses: azure/[email protected] | ||
with: | ||
version: v3.4.0 | ||
|
||
- name: Run chart-releaser | ||
uses: helm/[email protected] | ||
env: | ||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,4 @@ | ||
web/public/ | ||
dev_utils/config.yaml | ||
web/static/img/m_p_b/ | ||
web/static/img/m_p_c/ | ||
web/static/img/m_p_p/ | ||
web/static/img/m_r_f/ | ||
web/content/datasets/* | ||
web/public/* | ||
web/content/datasets/test* | ||
web/data/* | ||
dev_utils/config.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
apiVersion: v2 | ||
name: landing-pages-chart | ||
description: A Helm chart for Kubernetes | ||
|
||
# A chart can be either an 'application' or a 'library' chart. | ||
# | ||
# Application charts are a collection of templates that can be packaged into versioned archives | ||
# to be deployed. | ||
# | ||
# Library charts provide useful utilities or functions for the chart developer. They're included as | ||
# a dependency of application charts to inject those utilities and functions into the rendering | ||
# pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
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.0 | ||
|
||
# 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 | ||
# follow Semantic Versioning. They should reflect the version the application is using. | ||
# It is recommended to use it with quotes. | ||
appVersion: "1.16.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
annotations: | ||
nginx.ingress.kubernetes.io/upstream-vhost: {{ .Values.s3Host}} | ||
nginx.ingress.kubernetes.io/secure-backends: "true" | ||
nginx.ingress.kubernetes.io/backend-protocol: "HTTPS" | ||
nginx.ingress.kubernetes.io/rewrite-log: "true" | ||
nginx.ingress.kubernetes.io/rewrite-target: {{ .Values.bucketUrl }}/$1 | ||
nginx.ingress.kubernetes.io/use-regex: "true" | ||
nginx.ingress.kubernetes.io/app-root: /index.html | ||
name: my-ingress | ||
namespace: {{ .Values.namespace }} | ||
spec: | ||
ingressClassName: nginx | ||
rules: | ||
- http: | ||
paths: | ||
- backend: | ||
service: | ||
name: landing-pages-service | ||
port: | ||
number: 443 | ||
path: /(.*) | ||
pathType: Prefix | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: landing-pages-service | ||
namespace: {{ .Values.namespace }} | ||
spec: | ||
externalName: {{ .Values.s3Host }} | ||
sessionAffinity: None | ||
type: ExternalName |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
namespace: | ||
s3Host: | ||
bucketUrl: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"path/filepath" | ||
"strings" | ||
) | ||
|
||
func markDownCreator() { | ||
// XML directory path (change this to your XML directory path) | ||
xmlDirPath := "web/data/datasets/" | ||
|
||
// Directory to save Markdown files | ||
markdownDir := "web/content/datasets/" | ||
|
||
// Create the Markdown directory if it doesn't exist | ||
if err := os.MkdirAll(markdownDir, 0755); err != nil { | ||
fmt.Println("Error creating directory:", err) | ||
os.Exit(1) | ||
} | ||
|
||
// Walk through the XML directory | ||
err := filepath.Walk(xmlDirPath, func(xmlFilePath string, info os.FileInfo, err error) error { | ||
if err != nil { | ||
fmt.Printf("Error accessing file %s: %v\n", xmlFilePath, err) | ||
return nil | ||
} | ||
// Skip directories | ||
if info.IsDir() { | ||
return nil | ||
} | ||
|
||
// Read XML file name | ||
xmlFileName := filepath.Base(xmlFilePath) | ||
|
||
// Remove file extension | ||
fileNameWithoutExt := strings.TrimSuffix(xmlFileName, filepath.Ext(xmlFileName)) | ||
|
||
// Markdown content | ||
markdownContent := fmt.Sprintf(` | ||
--- | ||
--- | ||
{{< datafetch variable="%s" >}} | ||
Filename of the associated XML file: %s | ||
`, fileNameWithoutExt, xmlFileName) | ||
|
||
// Create Markdown file | ||
mdFileName := filepath.Join(markdownDir, fileNameWithoutExt+".md") | ||
mdFile, err := os.Create(mdFileName) | ||
if err != nil { | ||
fmt.Printf("Error creating Markdown file %s: %v\n", mdFileName, err) | ||
return nil | ||
} | ||
defer mdFile.Close() | ||
|
||
// Write Markdown content to the file | ||
_, err = mdFile.WriteString(markdownContent) | ||
if err != nil { | ||
fmt.Printf("Error writing to Markdown file %s: %v\n", mdFileName, err) | ||
return nil | ||
} | ||
|
||
fmt.Printf("Markdown file %s created successfully!\n", mdFileName) | ||
|
||
return nil | ||
}) | ||
|
||
if err != nil { | ||
fmt.Println("Error walking through directory:", err) | ||
os.Exit(1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"net/http" | ||
"os" | ||
"path/filepath" | ||
|
||
log "github.com/sirupsen/logrus" | ||
|
||
"github.com/aws/aws-sdk-go-v2/aws" | ||
"github.com/aws/aws-sdk-go-v2/feature/s3/manager" | ||
"github.com/aws/aws-sdk-go-v2/service/s3" | ||
) | ||
|
||
func test(DeploymenClient *DeploymentBackend) { | ||
var ( | ||
localPath = "web/public/" | ||
bucket = DeploymenClient.Bucket | ||
) | ||
|
||
walker := make(fileWalk) | ||
go func() { | ||
// Gather the files to upload by walking the path recursively | ||
if err := filepath.Walk(localPath, walker.Walk); err != nil { | ||
log.Fatalln("Walk failed:", err) | ||
} | ||
close(walker) | ||
}() | ||
|
||
// For each file found walking, upload it to Amazon S3 | ||
for path := range walker { | ||
rel, err := filepath.Rel(localPath, path) | ||
if err != nil { | ||
log.Fatalln("Unable to get relative path:", path, err) | ||
} | ||
file, err := os.Open(path) | ||
if err != nil { | ||
log.Println("Failed opening file", path, err) | ||
continue | ||
} | ||
buf := make([]byte, 512) | ||
_, err = file.Read(buf) | ||
contentType := http.DetectContentType(buf) | ||
ext := filepath.Ext(path) | ||
if ext == ".css" { | ||
contentType = "text/css;" | ||
} | ||
|
||
if err != nil { | ||
log.Fatalln("File bytes empty", path, err) | ||
} | ||
|
||
client := DeploymenClient.Client | ||
uploader := manager.NewUploader(client) | ||
result, err := uploader.Upload(context.TODO(), &s3.PutObjectInput{ | ||
Bucket: &bucket, | ||
Key: aws.String(rel), | ||
Body: file, | ||
ContentType: aws.String(contentType), | ||
}) | ||
println(contentType) | ||
file.Close() | ||
if err != nil { | ||
log.Fatalln("Failed to upload", path, err) | ||
} | ||
log.Infoln("Uploaded", path, result.Location) | ||
} | ||
} | ||
|
||
type fileWalk chan string | ||
|
||
func (f fileWalk) Walk(path string, info os.FileInfo, err error) error { | ||
if err != nil { | ||
return err | ||
} | ||
if !info.IsDir() { | ||
f <- path | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# hugo.bp.datasets.nbis.se | ||
Bigpicture landing pages and data description pages using HUGO |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.