Skip to content

Commit

Permalink
Merge branch 'main' into add-new-app-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
marians authored Oct 16, 2023
2 parents b7d60e9 + a916672 commit 3527d37
Show file tree
Hide file tree
Showing 19 changed files with 478 additions and 11 deletions.
28 changes: 27 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Add instructions on how to create a new App repo.

## [0.10.2] - 2023-10-13

- Fix secret templates and values

## [0.10.1] - 2023-10-11

### Added

- Encode secret values using base64 encoding

## [0.10.0] - 2023-10-10

### Added

- Static CMS configuration (secret)

## [0.9.0] - 2023-10-08

### Added

- Add customized Static CMS setup (editor)

## [0.8.0] - 2023-10-05

### Added
Expand Down Expand Up @@ -213,7 +235,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Initial docsy setup.

[Unreleased]: https://github.com/giantswarm/handbook/compare/v0.8.0...HEAD
[Unreleased]: https://github.com/giantswarm/handbook/compare/v0.10.2...HEAD
[0.10.2]: https://github.com/giantswarm/handbook/compare/v0.10.1...v0.10.2
[0.10.1]: https://github.com/giantswarm/handbook/compare/v0.10.0...v0.10.1
[0.10.0]: https://github.com/giantswarm/handbook/compare/v0.9.0...v0.10.0
[0.9.0]: https://github.com/giantswarm/handbook/compare/v0.8.0...v0.9.0
[0.8.0]: https://github.com/giantswarm/handbook/compare/v0.7.1...v0.8.0
[0.7.1]: https://github.com/giantswarm/handbook/compare/v0.7.0...v0.7.1
[0.7.0]: https://github.com/giantswarm/handbook/compare/v0.6.0...v0.7.0
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ COPY . /src
RUN cd themes/docsy && npm install
# build static site
RUN hugo --verbose --gc --minify --enableGitInfo --cleanDestinationDir --destination /src/public
RUN mkdir -p /src/public/admin && cp /src/cms/cms-config.yaml /src/public/admin/config.yml

# use minimal nginx alpine image for serving static html
FROM quay.io/giantswarm/nginx-unprivileged:1.21-alpine
EXPOSE 8080
USER 0

# enable relative 301 redirects to fix invalid redirects on missing trailing slash
# (a downstream server doesn't necessarily know the public name and port)
RUN sed -i 's/location \/ {/location \/ {\n absolute_redirect off;/' /etc/nginx/conf.d/default.conf

# copy in staticly built hugo site from build step above
COPY --from=build /src/public /usr/share/nginx/html
USER 101
5 changes: 5 additions & 0 deletions cms/Dockerfile.cms
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# use minimal nginx alpine image for proxying to hugo and decap-cms containers
FROM staticjscms-hugo:latest

# add customized Decap CMS config for handbook
COPY cms-config.yaml /app/config.yml
52 changes: 52 additions & 0 deletions cms/cms-config-dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
backend:
name: github
repo: giantswarm/handbook
base_url: http://localhost:8081
branch: main
commit_messages:
create: "Create {{collection}} “{{path}}”"
update: "Update {{collection}} “{{path}}”"
delete: "Delete {{collection}} “{{path}}”"
uploadMedia: "Upload “{{path}}”"
deleteMedia: "Delete “{{path}}”"
openAuthoring: '{{message}}'

site_url: http://localhost:8081/docs
logo_url: http://localhost:8081/tile70x70.png
publish_mode: editorial_workflow
media_folder: "content/docs"
media_library: { folder_support: true, max_file_size: 1024000 }

collections:
- folder: content/docs
label: "Pages"
label_singular: "Page"
name: "pages"
media_folder: ""
public_folder: ""
media_library: { folder_support: true }
create: true
format: frontmatter
extension: md
index_file: '_index'
editor:
size: half
frame: true
preview: true
nested:
depth: 6
summary: "{{name}}"
path:
index_file: '_index'
branch_bundle: true
# path property meta object allows editing the path of entries
# moving an existing entry will move the entire subtree of the entry to the new location
meta: { path: { widget: string, label: 'Path', index_file: '_index' } }
fields:
- { label: "Title", name: title, widget: "string" }
- { label: "Description", name: description, widget: "string" }
- label: "Confidentiality"
name: confidentiality
widget: "select"
options: ["public", "operational", "private"]
- { label: "Body", name: body, widget: "markdown" }
52 changes: 52 additions & 0 deletions cms/cms-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
backend:
name: github
repo: giantswarm/handbook
base_url: https://handbook.giantswarm.io
branch: main
commit_messages:
create: "Create {{collection}} “{{path}}”"
update: "Update {{collection}} “{{path}}”"
delete: "Delete {{collection}} “{{path}}”"
uploadMedia: "Upload “{{path}}”"
deleteMedia: "Delete “{{path}}”"
openAuthoring: '{{message}}'

site_url: https://handbook.giantswarm.io/docs
logo_url: https://handbook.giantswarm.io/tile70x70.png
publish_mode: editorial_workflow
media_folder: "content/docs"
media_library: { folder_support: true, max_file_size: 1024000 }

collections:
- folder: content/docs
label: "Pages"
label_singular: "Page"
name: "pages"
media_folder: ""
public_folder: ""
media_library: { folder_support: true }
create: true
format: frontmatter
extension: md
index_file: '_index'
editor:
size: half
frame: true
preview: true
nested:
depth: 6
summary: "{{name}}"
path:
index_file: '_index'
branch_bundle: true
# path property meta object allows editing the path of entries
# moving an existing entry will move the entire subtree of the entry to the new location
meta: { path: { widget: string, label: 'Path', index_file: '_index' } }
fields:
- { label: "Title", name: title, widget: "string" }
- { label: "Description", name: description, widget: "string" }
- label: "Confidentiality"
name: confidentiality
widget: "select"
options: ["public", "operational", "private"]
- { label: "Body", name: body, widget: "markdown" }
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ Once workflows are ready, it is time to create release branch. The name
of the branch is important and it must follow this convention:

```
${BASE}#release#v${VERSION}
${BASE}#release#${VERSION}
```

Where:

- `BASE` - is the name of the base branch for release PR. Usually it is
`master` or `main`.
- `VERSION` - either `major`, `minor`, `patch` or a specific version that is going to be created for the release.
- `VERSION` - either `major`, `minor`, `patch` or a specific version `v1.2.3` that is going to be created for the release.

Example:

Expand Down
27 changes: 25 additions & 2 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
version: '3.4'

services:
handbook-proxy:
container_name: handbook-proxy
build:
context: proxy
dockerfile: Dockerfile.handbook-proxy
ports:
- "8081:8081"
depends_on:
- hugo
- static-cms
hugo:
container_name: hugo
build:
context: .
target: build
ports:
- 1313:1313
volumes:
- ${PWD}/content:/src/content
- ${PWD}/layouts:/src/layouts
Expand All @@ -16,3 +24,18 @@ services:
- --enableGitInfo
- --bind=0.0.0.0
- --buildDrafts
static-cms:
container_name: static-cms
build:
context: cms
dockerfile: Dockerfile.cms
restart: always
volumes:
- ${PWD}/../static-cms/packages/app:/app/staticcms/app
environment:
ORIGIN: "${ORIGIN}"
OAUTH_CLIENT_ID: "${OAUTH_CLIENT_ID}"
OAUTH_CLIENT_SECRET: "${OAUTH_CLIENT_SECRET}"
GIT_HOSTNAME: "${GIT_HOSTNAME}"
#volumes:
# - ${PWD}/cms-config.yaml:/app/config.yml:ro
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ spec:
spec:
securityContext:
runAsUser: 1000

affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
Expand Down
File renamed without changes.
28 changes: 28 additions & 0 deletions helm/handbook/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,34 @@ spec:
name: handbook
port:
number: 8080
- path: /admin/config.yml
pathType: Prefix
backend:
service:
name: handbook
port:
number: 8080
- path: /admin/
pathType: Prefix
backend:
service:
name: staticjscms-hugo-standalone
port:
number: 8080
- path: /auth
pathType: Prefix
backend:
service:
name: staticjscms-hugo-standalone
port:
number: 8080
- path: /callback
pathType: Prefix
backend:
service:
name: staticjscms-hugo-standalone
port:
number: 8080
tls:
- hosts:
- handbook.giantswarm.io
Expand Down
19 changes: 19 additions & 0 deletions helm/handbook/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{ $this := . }}
{{ range $index, $secret := .Values.secrets }}
apiVersion: v1
kind: Secret
{{- if eq (index $secret.data 0).key ".dockerconfigjson" }}
type: kubernetes.io/dockerconfigjson
{{- else }}
type: Opaque
{{- end }}
metadata:
name: {{ $secret.name }}
namespace: {{ include "resource.default.namespace" $this }}
labels:
{{- include "labels.common" $this | nindent 4 }}
data:
{{- range $idx, $datum := $secret.data }}
{{ $datum.key }}: {{ $datum.value }}
{{- end }}
{{- end }}
77 changes: 77 additions & 0 deletions helm/handbook/templates/staticjscms-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: intranet
name: staticjscms-hugo-standalone
labels:
app: staticjscms-hugo-standalone
spec:
replicas: 2
revisionHistoryLimit: 2
selector:
matchLabels:
app: staticjscms-hugo-standalone
template:
metadata:
name: staticjscms-hugo-standalone
labels:
app: staticjscms-hugo-standalone
spec:
securityContext:
runAsUser: 1000
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchLabels:
app: staticjscms-hugo-standalone
topologyKey: kubernetes.io/hostname
weight: 100
containers:
- name: staticjscms-hugo-standalone
image: ghcr.io/giantswarm/staticjscms-hugo-standalone:{{ .Values.staticJsCmsHugoStandaloneVersion }}
imagePullPolicy: Always
env:
- name: ORIGIN
valueFrom:
secretKeyRef:
name: staticjscms-secret
key: ORIGIN
- name: OAUTH_CLIENT_ID
valueFrom:
secretKeyRef:
name: staticjscms-secret
key: OAUTH_CLIENT_ID
- name: OAUTH_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: staticjscms-secret
key: OAUTH_CLIENT_SECRET
- name: GIT_HOSTNAME
valueFrom:
secretKeyRef:
name: staticjscms-secret
key: GIT_HOSTNAME
ports:
- containerPort: 8080
name: http
resources:
requests:
cpu: 100m
memory: 100M
limits:
cpu: 300m
memory: 100M
livenessProbe:
httpGet:
path: /
port: 8080
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 30
timeoutSeconds: 2
serviceAccount: handbook
serviceAccountName: handbook
imagePullSecrets:
- name: staticjscms-hugo-standalone-pull-secret
13 changes: 13 additions & 0 deletions helm/handbook/templates/staticjscms-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
kind: Service
apiVersion: v1
metadata:
namespace: intranet
name: staticjscms-hugo-standalone
labels:
app: staticjscms-hugo-standalone
spec:
ports:
- port: 8080
targetPort: http
selector:
app: staticjscms-hugo-standalone
Loading

0 comments on commit 3527d37

Please sign in to comment.