Skip to content

Commit 229993d

Browse files
Keepup with new endpoint (#1)
* init commit
1 parent e402a60 commit 229993d

29 files changed

+2145
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Docker Image
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
docker:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout Repository
13+
uses: actions/checkout@v3
14+
15+
- name: Generate Docker Metadata
16+
id: meta
17+
uses: docker/metadata-action@v4
18+
with:
19+
images: ghcr.io/${{ github.repository }}
20+
tags: |
21+
type=ref,event=tag
22+
type=semver,pattern={{version}}
23+
type=semver,pattern={{major}}.{{minor}}
24+
flavor: latest=true
25+
26+
- name: Setup Docker Buildx
27+
uses: docker/setup-buildx-action@v2
28+
29+
- name: Login to GitHub Container Registry
30+
uses: docker/login-action@v2
31+
with:
32+
registry: ghcr.io
33+
username: ${{ github.actor }}
34+
password: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Build and Push Docker Image
37+
uses: docker/build-push-action@v3
38+
env:
39+
DOCKER_BUILDKIT: 1
40+
with:
41+
context: .
42+
file: docker/Dockerfile
43+
push: true
44+
tags: ${{ steps.meta.outputs.tags }}
45+
labels: ${{ steps.meta.outputs.labels }}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Release Charts
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
8+
jobs:
9+
release:
10+
permissions:
11+
contents: write
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Configure Git
20+
run: |
21+
git config user.name "$GITHUB_ACTOR"
22+
git config user.email "[email protected]"
23+
24+
- name: Install Helm
25+
uses: azure/setup-helm@v3
26+
27+
- name: Run chart-releaser
28+
uses: helm/[email protected]
29+
with:
30+
skip_existing: true
31+
packages_with_index: true
32+
env:
33+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,28 @@
11
# keepup
2+
3+
```
4+
go run main.go
5+
```
6+
7+
8+
```
9+
sudo cat /sys/devices/virtual/dmi/id/product_uuid
10+
0a6e14bf-b17f-4ec5-aec0-35427a1723a1
11+
# https://puppet.com/docs/puppet/7/core_facts.html#dmi
12+
# https://tickets.puppetlabs.com/browse/FACT-234
13+
```
14+
15+
16+
17+
```bash
18+
cat /etc/os-release
19+
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
20+
NAME="Debian GNU/Linux"
21+
VERSION_ID="11"
22+
VERSION="11 (bullseye)"
23+
VERSION_CODENAME=bullseye
24+
ID=debian
25+
HOME_URL="https://www.debian.org/"
26+
SUPPORT_URL="https://www.debian.org/support"
27+
BUG_REPORT_URL="https://bugs.debian.org/"
28+
```

charts/keepup/Chart.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
apiVersion: v1
2+
name: keepup
3+
version: 1.0.0
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{{- define "project.config" }}
2+
- name: APP_ENV
3+
valueFrom:
4+
configMapKeyRef:
5+
name: keepup-config
6+
key: APP_ENV
7+
8+
- name: REDIS_ADDR
9+
valueFrom:
10+
configMapKeyRef:
11+
name: keepup-config
12+
key: REDIS_ADDR
13+
14+
- name: REDIS_PORT
15+
valueFrom:
16+
configMapKeyRef:
17+
name: keepup-config
18+
key: REDIS_PORT
19+
20+
- name: REDIS_DBNO
21+
valueFrom:
22+
configMapKeyRef:
23+
name: keepup-config
24+
key: REDIS_DBNO
25+
26+
- name: TTL_SECONDS
27+
valueFrom:
28+
configMapKeyRef:
29+
name: keepup-config
30+
key: TTL_SECONDS
31+
32+
- name: API_TOKEN
33+
valueFrom:
34+
secretKeyRef:
35+
name: keepup-seecret
36+
key: API_TOKEN
37+
38+
{{ end -}}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
kind: ConfigMap
2+
apiVersion: v1
3+
metadata:
4+
name: keepup-config
5+
namespace: keepup
6+
data:
7+
APP_ENV: "prod"
8+
REDIS_ADDR: "127.0.0.1"
9+
REDIS_PORT: "6379"
10+
REDIS_DBNO: "7"
11+
TTL_SECONDS: "21600"
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: keepup-deployment
5+
labels:
6+
app: keepup
7+
type: backend
8+
spec:
9+
revisionHistoryLimit: 2
10+
selector:
11+
matchLabels:
12+
app: keepup
13+
type: backend
14+
replicas: {{ default 1 .Values.replicas }}
15+
template:
16+
metadata:
17+
labels:
18+
app: keepup
19+
type: backend
20+
{{- if .Values.annotations }}
21+
annotations:
22+
{{- toYaml .Values.annotations | nindent 8 }}
23+
{{- end }}
24+
spec:
25+
containers:
26+
{{ if .Values.redis.enabled }}
27+
- name: keepup-redis-container
28+
imagePullPolicy: {{ .Values.redis.pullPolicy }}
29+
image: {{ .Values.redis.image | quote }}
30+
{{ end }}
31+
- name: keepup-main-container
32+
imagePullPolicy: {{ .Values.main.pullPolicy }}
33+
image: {{ .Values.main.image | quote }}
34+
env:
35+
{{ include "project.config" . | indent 12 }}
36+
readinessProbe:
37+
httpGet:
38+
path: /healthcheck
39+
port: 80
40+
initialDelaySeconds: 10
41+
periodSeconds: 60
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{{- if .Values.ingress.enabled }}
2+
apiVersion: networking.k8s.io/v1
3+
kind: Ingress
4+
metadata:
5+
name: keepup-ingress
6+
annotations:
7+
kubernetes.io/ingress.class: nginx
8+
#nginx.ingress.kubernetes.io/service-upstream: "true"
9+
#nginx.ingress.kubernetes.io/proxy-request-buffering: "off"
10+
spec:
11+
tls:
12+
- hosts:
13+
- {{ .Values.ingress.host }}
14+
secretName: {{ .Values.ingress.secretName }}
15+
rules:
16+
- host: {{ .Values.ingress.host }}
17+
http:
18+
paths:
19+
- path: /os-release
20+
pathType: ImplementationSpecific
21+
backend:
22+
service:
23+
name: keepup-service
24+
port:
25+
number: 80
26+
- path: /package-version
27+
pathType: ImplementationSpecific
28+
backend:
29+
service:
30+
name: keepup-service
31+
port:
32+
number: 80
33+
{{ end }}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
kind: Secret
2+
apiVersion: v1
3+
metadata:
4+
name: keepup-seecret
5+
namespace: keepup
6+
data:
7+
API_TOKEN: {{ .Values.apiToken | b64enc }}
8+
type: Opaque

0 commit comments

Comments
 (0)