-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd72be4
commit 117da6e
Showing
29 changed files
with
1,768 additions
and
1 deletion.
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
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,40 @@ | ||
name: scan:codeql | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
paths-ignore: | ||
- '**/*.md' | ||
schedule: | ||
- cron: "0 0 * * 0" | ||
|
||
permissions: | ||
actions: read # for github/codeql-action/init to get workflow details | ||
contents: read # for actions/checkout to fetch code | ||
security-events: write # for github/codeql-action/analyze to upload SARIF results | ||
|
||
jobs: | ||
codeql: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@cba0d00b1fc9a034e1e642ea0f1103c282990604 # 2.5.0 | ||
with: | ||
egress-policy: block | ||
disable-telemetry: true | ||
allowed-endpoints: > | ||
github.com:443 | ||
*.github.com:443 | ||
proxy.golang.org:443 | ||
storage.googleapis.com:443 | ||
sum.golang.org:443 | ||
objects.githubusercontent.com:443 | ||
- name: Check out code | ||
uses: actions/checkout@v3 | ||
- name: Initialize CodeQL | ||
uses: github/codeql-action/init@v2 | ||
with: | ||
languages: go | ||
queries: security-and-quality | ||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 |
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,109 @@ | ||
# Contribution guide | ||
|
||
Everyone is more than welcome to contribute to this project! That's what open source is all about! | ||
|
||
In the following, we try to provide some help and guidance on how to participate, contribute and develop on the project. | ||
|
||
**Table of content:** | ||
|
||
- [1. Raising an issue or feature request](#1-raising-an-issue-or-feature-request) | ||
- [2. Project Setup \& Development](#2-project-setup--development) | ||
- [2.1 Recommended IDE Setup](#21-recommended-ide-setup) | ||
- [2.1.1 Type Support for `.vue` Imports in TypeScript](#211-type-support-for-vue-imports-in-typescript) | ||
- [2.2 Daily-used commands](#22-daily-used-commands) | ||
- [2.2.1 Installing all dependencies](#221-installing-all-dependencies) | ||
- [2.2.2 Compile and Hot-Reload for Development](#222-compile-and-hot-reload-for-development) | ||
- [2.2.3 Lint with ESLint](#223-lint-with-eslint) | ||
- [2.2.4 Type-Check, Compile and Minify for Production](#224-type-check-compile-and-minify-for-production) | ||
- [2.3 Usage of mkcert](#23-usage-of-mkcert) | ||
- [2.4 Sandbox environment](#24-sandbox-environment) | ||
- [2.5 Git workflow](#25-git-workflow) | ||
- [2.5.1 Releases \& Versioning](#251-releases--versioning) | ||
- [2.5.2 Patching of older release](#252-patching-of-older-release) | ||
|
||
## 1. Raising an issue or feature request | ||
|
||
The simplest way to contribute to the project is to use it! | ||
|
||
Whenever you encounter any issues or missing features while using the project, please create a [GitHub Issue](https://github.com/florianrusch/vue3-quagga2/issues) in this project and describe what you found or what you need. To help you with this, we provide several templates to help and guide you through the issue creation. | ||
|
||
## 2. Project Setup & Development | ||
|
||
If you are interested in getting your hands dirty, the following subsections provide information and instructions for the setup of your local development environment. | ||
|
||
### 2.1 Recommended IDE Setup | ||
|
||
[VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin). | ||
|
||
#### 2.1.1 Type Support for `.vue` Imports in TypeScript | ||
|
||
TypeScript cannot handle type information for `.vue` imports by default, so we replaced the `tsc` CLI with `vue-tsc` for type checking. In editors, e.g. for [VSCode](https://code.visualstudio.com/) we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types. | ||
|
||
### 2.2 Daily-used commands | ||
|
||
#### 2.2.1 Installing all dependencies | ||
|
||
```sh | ||
npm install | ||
``` | ||
|
||
#### 2.2.2 Compile and Hot-Reload for Development | ||
|
||
> Please be aware that some browser allow access to the cameras only if the website uses http**s**. | ||
> Therefor we are using [mkcert](https://github.com/FiloSottile/mkcert). See [this chapter](#23-usage-of-mkcert) for more details. | ||
```sh | ||
npm run dev | ||
``` | ||
|
||
Or if you want to access the application from you mobile device while developing: | ||
|
||
```sh | ||
npm run dev-network | ||
``` | ||
|
||
#### 2.2.3 Lint with [ESLint](https://eslint.org/) | ||
|
||
```sh | ||
# Shows errors | ||
npm run lint | ||
|
||
# Fixes errors | ||
npm run lint:fix | ||
``` | ||
|
||
#### 2.2.4 Type-Check, Compile and Minify for Production | ||
|
||
```sh | ||
npm run build | ||
``` | ||
|
||
### 2.3 Usage of mkcert | ||
|
||
As some browsers only allow camera access on websites that were transferred via HTTP**S** we need for development purposes also HTTP**S**. To make it simple for the developer, we are using [mkcert](https://github.com/FiloSottile/mkcert) which was made to use one local Certificate Authority (CA) for all local development projects. | ||
|
||
As we are using vite for hosting our local development server, we are also using the [vite-plugin-mkcert](https://github.com/liuweiGL/vite-plugin-mkcert) to configure and set up mkcert. | ||
|
||
As the project is mostly focusing on mobile applications, we would also need to allow/accept the local self-signed certificates on our mobile devices. The vite-plugin we are using provides a good guide on how to do this: <https://github.com/liuweiGL/vite-plugin-mkcert#mobile-devices> | ||
|
||
### 2.4 Sandbox environment | ||
|
||
A sandbox environment has been set up for development purposes. You can find it in the [`/sandbox`](./sandbox/) folder and in the [`index.html`](./index.html). | ||
|
||
### 2.5 Git workflow | ||
|
||
The development is orientated on GitHub flow. Therefore every source code contribution needs to be provided through a [GitHub Pull-Request](https://github.com/florianrusch/vue3-quagga2/pulls) against the `main` branch. | ||
|
||
#### 2.5.1 Releases & Versioning | ||
|
||
Releases will be made by tagging a specific commit on the `main` branch. For the versioning we are using the [Semantic Versioning Schema](https://semver.org/): | ||
|
||
> Given a version number MAJOR.MINOR.PATCH, increment the: | ||
> | ||
> 1. MAJOR version when you make incompatible API changes | ||
> 2. MINOR version when you add functionality in a backwards compatible manner | ||
> 3. PATCH version when you make backwards compatible bug fixes | ||
#### 2.5.2 Patching of older release | ||
|
||
Sometimes it's happening that security issues appear in older releases. Regarding the fact that the community behind this project is not very large, we are not able to provide patches for each release we have ever published. Therefore, _**we will only maintain the latest minor version with security patches and bug fixes!**_ |
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,60 @@ | ||
# Path to the main file | ||
MAIN_FILE_PATH ?= ./main.go | ||
|
||
# Path where the binary will be stored | ||
BINARY_FILE_PATH = out/lb | ||
|
||
GOOS ?= linux | ||
GOARCH ?= amd64 | ||
|
||
# Setting SHELL to bash allows bash commands to be executed by recipes. | ||
# Options are set to exit when a recipe line exits non-zero or a piped command fails. | ||
SHELL = /usr/bin/env bash -o pipefail | ||
.SHELLFLAGS = -ec | ||
|
||
.PHONY: all | ||
all: build | ||
|
||
##@ General | ||
|
||
# The help target prints out all targets with their descriptions organized | ||
# beneath their categories. The categories are represented by '##@' and the | ||
# target descriptions by '##'. The awk commands is responsible for reading the | ||
# entire set of makefiles included in this invocation, looking for lines of the | ||
# file as xyz: ## something, and then pretty-format the target and help. Then, | ||
# if there's a line with ##@ something, that gets pretty-printed as a category. | ||
# More info on the usage of ANSI control characters for terminal formatting: | ||
# https://en.wikipedia.org/wiki/ANSI_escape_code#SGR_parameters | ||
# More info on the awk command: | ||
# http://linuxcommand.org/lc3_adv_awk.php | ||
|
||
.PHONY: help | ||
help: ## Display this help. | ||
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n"} /^[a-zA-Z_0-9-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) | ||
|
||
##@ Development | ||
|
||
.PHONY: dependencies | ||
dependencies: ## Run go mod download against code. | ||
go mod download | ||
|
||
.PHONY: fmt | ||
fmt: ## Run go fmt against code. | ||
go fmt ./... | ||
|
||
.PHONY: vet | ||
vet: ## Run go vet against code. | ||
go vet ./... | ||
|
||
.PHONY: test | ||
test: ## Run tests. | ||
go test ./... -coverprofile cover.out | ||
|
||
##@ Build | ||
|
||
.PHONY: ci | ||
ci: dependencies vet test build ## Run certain recipes for CI pipeline. | ||
|
||
.PHONY: build | ||
build: ## Build binary. | ||
GOOS=${GOOS} GOARCH=${GOARCH} go build --ldflags="-s -w" -o ${BINARY_FILE_PATH} ${MAIN_FILE_PATH} |
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,8 @@ | ||
# syntax=docker/dockerfile:1 | ||
|
||
# Copyright 2023 ZF Friedrichshafen AG. | ||
|
||
FROM zfdos.azurecr.io/base-images/go:1.0 | ||
|
||
COPY ../config.yaml /app/config.yaml | ||
COPY bin/application /app/application |
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,66 @@ | ||
# Lifeboat | ||
|
||
## Configuration | ||
|
||
| Config Name | Required | Default Value | Description | | ||
|-------------|----------|---------------|-----------------------------------------------------------------------------------------------------------------------------| | ||
| `logLevel` | | `info` | Defines the log level which will be used by the application. Possible values are: `trace`, `debug`, `info`, `warn`, `error` | | ||
|
||
### Sources | ||
|
||
#### HashiCorp Vault | ||
|
||
| Config Name | Required | Default Value | Description | | ||
|----------------------------|----------|---------------|--------------------------------------------------| | ||
| `source.hashiCorp.address` | X | | URL under which the vault REST API is accessible | | ||
| `source.hashiCorp.token` | X | | Vault token | | ||
|
||
### Destinations | ||
|
||
| Config Name | Required | Default Value | Description | | ||
|---------------------|----------|---------------|-----------------------------------------------------------------| | ||
| `destinations.path` | | `.` | Path under which the backup should be stored on the destination | | ||
|
||
#### AzureBlob | ||
|
||
| Config Name | Required | Default Value | Description | | ||
|---------------------------------------|----------|---------------|-------------------------------------------------| | ||
| `destination.azureBlob.accountName` | X | | Storage account name | | ||
| `destination.azureBlob.accountKey` | X | | Storage account key | | ||
| `destination.azureBlob.containerName` | X | | Container name inside the Azure Storage Account | | ||
|
||
## HashiCorp Vault authentication | ||
|
||
The policy which is used by the token need to have the `sudo` capability to create backups. | ||
|
||
## Additional Features | ||
|
||
- Define multiple destinations | ||
- Azure Blob | ||
- Support additional auth mechanism | ||
- Creating full-backups from | ||
- SSH/Rsync | ||
- MongoDB | ||
- PostgreSQL | ||
- Disk | ||
- Delete backups that are older than X | ||
- Create incremental backups from | ||
- MongoDB | ||
- PostgreSQL | ||
- Define multiple sources | ||
- K8s Volume replication | ||
- Encryption | ||
- Compression | ||
|
||
## Alternatives | ||
|
||
- [gobackup/gobackup](https://github.com/gobackup/gobackup) | ||
|
||
## TODOs | ||
|
||
- Make vault token been mountable as file | ||
- Block that the vault client automatically pull in env vars like `VAULT_ADDRESS` | ||
|
||
## Additional documentation | ||
|
||
- <https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/storage/azblob#readme> |
Binary file not shown.
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: backup | ||
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,22 @@ | ||
1. Get the application URL by running these commands: | ||
{{- if .Values.ingress.enabled }} | ||
{{- range $host := .Values.ingress.hosts }} | ||
{{- range .paths }} | ||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} | ||
{{- end }} | ||
{{- end }} | ||
{{- else if contains "NodePort" .Values.service.type }} | ||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "backup.fullname" . }}) | ||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") | ||
echo http://$NODE_IP:$NODE_PORT | ||
{{- else if contains "LoadBalancer" .Values.service.type }} | ||
NOTE: It may take a few minutes for the LoadBalancer IP to be available. | ||
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "backup.fullname" . }}' | ||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "backup.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") | ||
echo http://$SERVICE_IP:{{ .Values.service.port }} | ||
{{- else if contains "ClusterIP" .Values.service.type }} | ||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "backup.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | ||
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") | ||
echo "Visit http://127.0.0.1:8080 to use your application" | ||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT | ||
{{- end }} |
Oops, something went wrong.