Skip to content

Commit

Permalink
Merge pull request #119 from acend/update_docsy
Browse files Browse the repository at this point in the history
update docsy and required fixes
  • Loading branch information
splattner authored Apr 26, 2024
2 parents 6abceeb + eca1d5c commit 0504721
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM klakegg/hugo:0.111.3-ext-ubuntu AS builder
FROM docker.io/floryn90/hugo:0.124.1-ext-ubuntu AS builder

ARG TRAINING_HUGO_ENV=default

Expand Down
19 changes: 13 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ Run the following command to update all modules with their newest upstream versi
hugo mod get -u
```

Command without hugo installation:

```bash
export HUGO_VERSION=$(grep "FROM docker.io/floryn90/hugo" Dockerfile | sed 's/FROM docker.io\/floryn90\/hugo://g' | sed 's/ AS builder//g')
docker run --rm --interactive -v $(pwd):/src docker.io/floryn90/hugo:${HUGO_VERSION} mod get -u
```


### Shortcode usage

Expand Down Expand Up @@ -83,15 +90,15 @@ To develop locally we don't want to rebuild the entire container image every tim
We simply mount the working directory into a running container, where hugo is started in the server mode.

```bash
export HUGO_VERSION=$(grep "FROM klakegg/hugo" Dockerfile | sed 's/FROM klakegg\/hugo://g' | sed 's/ AS builder//g')
docker run --rm --interactive --publish 8080:8080 -v $(pwd):/src klakegg/hugo:${HUGO_VERSION} server -p 8080 --bind 0.0.0.0
export HUGO_VERSION=$(grep "FROM docker.io/floryn90/hugo" Dockerfile | sed 's/FROM docker.io\/floryn90\/hugo://g' | sed 's/ AS builder//g')
docker run --rm --interactive --publish 8080:8080 -v $(pwd):/src docker.io/floryn90/hugo:${HUGO_VERSION} server -p 8080 --bind 0.0.0.0
```

use the following command to set the hugo environment

```bash
export HUGO_VERSION=$(grep "FROM klakegg/hugo" Dockerfile | sed 's/FROM klakegg\/hugo://g' | sed 's/ AS builder//g')
docker run --rm --interactive --publish 8080:8080 -v $(pwd):/src klakegg/hugo:${HUGO_VERSION} server --environment=<environment> -p 8080 --bind 0.0.0.0
export HUGO_VERSION=$(grep "FROM docker.io/floryn90/hugo" Dockerfile | sed 's/FROM docker.io\/floryn90\/hugo://g' | sed 's/ AS builder//g')
docker run --rm --interactive --publish 8080:8080 -v $(pwd):/src docker.io/floryn90/hugo:${HUGO_VERSION} server --environment=<environment> -p 8080 --bind 0.0.0.0
```


Expand All @@ -110,8 +117,8 @@ npm run mdlint
Npm not installed? no problem

```bash
export HUGO_VERSION=$(grep "FROM klakegg/hugo" Dockerfile | sed 's/FROM klakegg\/hugo://g' | sed 's/ AS builder//g')
docker run --rm --interactive -v $(pwd):/src klakegg/hugo:${HUGO_VERSION}-ci /bin/bash -c "set -euo pipefail;npm install; npm run mdlint;"
export HUGO_VERSION=$(grep "FROM docker.io/floryn90/hugo" Dockerfile | sed 's/FROM docker.io\/floryn90\/hugo://g' | sed 's/ AS builder//g')
docker run --rm --interactive -v $(pwd):/src docker.io/floryn90/hugo:${HUGO_VERSION}-ci /bin/bash -c "set -euo pipefail;npm install; npm run mdlint;"
```


Expand Down
2 changes: 1 addition & 1 deletion config/_default/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ queryParam = "u"
defaultValue = "user0"
href = true

[params.images]
[params.containerImages]
acendAwesomeApp-example-web-go = "quay.io/acend/example-web-go:latest"
acendAwesomeApp-example-web-python = "quay.io/acend/example-web-python:latest"
nginxinc-nginx-unprivileged = "docker.io/nginxinc/nginx-unprivileged:latest"
Expand Down
10 changes: 5 additions & 5 deletions content/en/docs/02/02_deployacontainerimage.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ First, we are going to directly start a new Pod:
{{% onlyWhenNot mobi %}}

```bash
{{% param cliToolName %}} run awesome-app --image={{% param "images.acendAwesomeApp-example-web-go" %}} --restart=Never --requests='cpu=10m,memory=16Mi' --limits='cpu=20m,memory=32Mi' --namespace +username+
{{% param cliToolName %}} run awesome-app --image={{% param "containerImages.acendAwesomeApp-example-web-go" %}} --restart=Never --requests='cpu=10m,memory=16Mi' --limits='cpu=20m,memory=32Mi' --namespace +username+
```

{{% /onlyWhenNot %}}
{{% onlyWhen mobi %}}

```bash
kubectl run awesome-app --image={{% param "images.acendAwesomeApp-example-web-go" %}} --requests='cpu=10m,memory=16Mi' --limits='cpu=20m,memory=32Mi' --restart=Never --namespace <namespace>
kubectl run awesome-app --image={{% param "containerImages.acendAwesomeApp-example-web-go" %}} --requests='cpu=10m,memory=16Mi' --limits='cpu=20m,memory=32Mi' --restart=Never --namespace <namespace>
```

{{% /onlyWhen %}}
Expand Down Expand Up @@ -84,7 +84,7 @@ spec:
app: example-web-go
spec:
containers:
- image: {{% param "images.acendAwesomeApp-example-web-go" %}}
- image: {{% param "containerImages.acendAwesomeApp-example-web-go" %}}
name: example-web-go
resources:
requests:
Expand Down Expand Up @@ -141,11 +141,11 @@ If you want to create your own container images and use them with {{% param dist
## Task {{% param sectionnumber %}}.3: Viewing the created resources

{{% onlyWhenNot mobi %}}
When we executed the command `{{% param cliToolName %}} create deployment example-web-go --image={{% param "images.acendAwesomeApp-example-web-go" %}} --namespace +username+`, {{% param distroName %}} created a Deployment resource.
When we executed the command `{{% param cliToolName %}} create deployment example-web-go --image={{% param "containerImages.acendAwesomeApp-example-web-go" %}} --namespace +username+`, {{% param distroName %}} created a Deployment resource.
{{% /onlyWhenNot %}}

{{% onlyWhen mobi %}}
When we executed the command `kubectl create deployment example-web-go --image={{% param "images.acendAwesomeApp-example-web-go" %}} --namespace +username+`, kubectl created a Deployment resource.
When we executed the command `kubectl create deployment example-web-go --image={{% param "containerImages.acendAwesomeApp-example-web-go" %}} --namespace +username+`, kubectl created a Deployment resource.
{{% /onlyWhen %}}


Expand Down
2 changes: 1 addition & 1 deletion content/en/docs/02/03_exposingaservice.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ With the ClusterIP Service ready, we can now create the {{% onlyWhenNot openshif
{{% onlyWhenNot openshift %}}
In order to create the Ingress resource, we first need to create the file `ingress.yaml` and change the `host` entry to match your environment:

{{< highlight yaml >}}{{< readfile file="content/en/docs/02/resources/ingress_example-web-go.yaml" >}}{{< /highlight >}}
{{< highlight yaml >}}{{< readfile file="/content/en/docs/02/resources/ingress_example-web-go.yaml" >}}{{< /highlight >}}

As you see in the resource definition at `spec.rules[0].http.paths[0].backend.serviceName` we use the previously created `example-web-go` ClusterIP Service.

Expand Down
10 changes: 5 additions & 5 deletions content/en/docs/02/04_scaling.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ spec:
app: example-web-python
spec:
containers:
- image: {{% param "images.acendAwesomeApp-example-web-python" %}}
- image: {{% param "containerImages.acendAwesomeApp-example-web-python" %}}
name: example-web-python
resources:
limits:
Expand Down Expand Up @@ -129,7 +129,7 @@ kubectl expose deployment example-web-python --type="ClusterIP" --name="example-

and we need to create an Ingress to access the application:

{{< highlight yaml >}}{{< readfile file="content/en/docs/02/resources/ingress_example-web-python.yaml" >}}{{< /highlight >}}
{{< highlight yaml >}}{{< readfile file="/content/en/docs/02/resources/ingress_example-web-python.yaml" >}}{{< /highlight >}}

Apply this Ingress definition using, e.g., `kubectl create -f ingress.yml --namespace +username+`

Expand Down Expand Up @@ -377,7 +377,7 @@ Now insert the readiness probe at `.spec.template.spec.containers` above the `re
```yaml
...
containers:
- image: {{% param "images.acendAwesomeApp-example-web-python" %}}
- image: {{% param "containerImages.acendAwesomeApp-example-web-python" %}}
imagePullPolicy: Always
name: example-web-python
# start to copy here
Expand All @@ -398,7 +398,7 @@ The `containers` configuration then looks like:
```yaml
...
containers:
- image: {{% param "images.acendAwesomeApp-example-web-python" %}}
- image: {{% param "containerImages.acendAwesomeApp-example-web-python" %}}
imagePullPolicy: Always
name: example-web-python
readinessProbe:
Expand Down Expand Up @@ -429,7 +429,7 @@ The command above results in the following `readinessProbe` snippet being insert
```yaml
...
containers:
- image: {{% param "images.acendAwesomeApp-example-web-python" %}}
- image: {{% param "containerImages.acendAwesomeApp-example-web-python" %}}
imagePullPolicy: Always
name: example-web-python
readinessProbe:
Expand Down
4 changes: 2 additions & 2 deletions content/en/docs/02/06_attachingadatabase.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ As we had seen in the earlier labs, all resources like Deployments, Services, Se
In our case we want to create a deployment including a Service for our MySQL database.
Save this snippet as `mariadb.yaml`:

{{< highlight yaml >}}{{< readfile file="content/en/docs/02/resources/mariadb_lab06.yaml" >}}{{< /highlight >}}
{{< highlight yaml >}}{{< readfile file="/content/en/docs/02/resources/mariadb_lab06.yaml" >}}{{< /highlight >}}

Execute it with:

Expand Down Expand Up @@ -242,7 +242,7 @@ You could also do the changes by directly editing the Deployment:
name: mariadb
- name: MYSQL_URI
value: mysql://$(MYSQL_DATABASE_USER):$(MYSQL_DATABASE_PASSWORD)@mariadb-svc/$(MYSQL_DATABASE_NAME)
image: {{% param "images.acendAwesomeApp-example-web-python" %}}
image: {{% param "containerImages.acendAwesomeApp-example-web-python" %}}
imagePullPolicy: Always
name: example-web-python
...
Expand Down
2 changes: 1 addition & 1 deletion content/en/docs/02/07_persistentstorage.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Because we just changed the DeploymentConfig with the `oc set` command, a new Po
The following command creates a PersistentVolumeClaim which requests a volume of 1Gi size.
Save it to `pvc.yaml`:

{{< highlight yaml >}}{{< readfile file="content/en/docs/02/resources/pvc.yaml" >}}{{< /highlight >}}
{{< highlight yaml >}}{{< readfile file="/content/en/docs/02/resources/pvc.yaml" >}}{{< /highlight >}}

And create it with:

Expand Down
18 changes: 9 additions & 9 deletions content/en/docs/02/09_kustomize.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ The structure of a Kustomize configuration typically looks like this:

Let's have a look at the `base` directory first which contains the base configuration. There's a `deployment.yaml` with the following content:

{{< highlight yaml >}}{{< readfile file="content/en/docs/02/resources/kustomize/base/deployment.yaml" >}}{{< /highlight >}}
{{< highlight yaml >}}{{< readfile file="/content/en/docs/02/resources/kustomize/base/deployment.yaml" >}}{{< /highlight >}}

There's also a Service for our Deployment in the corresponding `base/service.yaml`:

{{< highlight yaml >}}{{< readfile file="content/en/docs/02/resources/kustomize/base/service.yaml" >}}{{< /highlight >}}
{{< highlight yaml >}}{{< readfile file="/content/en/docs/02/resources/kustomize/base/service.yaml" >}}{{< /highlight >}}

And there's an additional `base/kustomization.yaml` which is used to configure Kustomize:

{{< highlight yaml >}}{{< readfile file="content/en/docs/02/resources/kustomize/base/kustomization.yaml" >}}{{< /highlight >}}
{{< highlight yaml >}}{{< readfile file="/content/en/docs/02/resources/kustomize/base/kustomization.yaml" >}}{{< /highlight >}}

It references the previous manifests `service.yaml` and `deployment.yaml` and makes them part of our base configuration.

Expand All @@ -104,35 +104,35 @@ Now let's have a look at the other directory which is called `overlays`. It cont

`overlays/staging/kustomization.yaml`:

{{< highlight yaml >}}{{< readfile file="content/en/docs/02/resources/kustomize/overlays/staging/kustomization.yaml" >}}{{< /highlight >}}
{{< highlight yaml >}}{{< readfile file="/content/en/docs/02/resources/kustomize/overlays/staging/kustomization.yaml" >}}{{< /highlight >}}

`overlays/production/kustomization.yaml`:

{{< highlight yaml >}}{{< readfile file="content/en/docs/02/resources/kustomize/overlays/production/kustomization.yaml" >}}{{< /highlight >}}
{{< highlight yaml >}}{{< readfile file="/content/en/docs/02/resources/kustomize/overlays/production/kustomization.yaml" >}}{{< /highlight >}}

Only the first key `nameSuffix` differs.

In both cases, the `kustomization.yaml` references our base configuration. However, the two directories contain two different `deployment-patch.yaml` files which patch the `deployment.yaml` from our base configuration.

`overlays/staging/deployment-patch.yaml`:

{{< highlight yaml >}}{{< readfile file="content/en/docs/02/resources/kustomize/overlays/staging/deployment-patch.yaml" >}}{{< /highlight >}}
{{< highlight yaml >}}{{< readfile file="/content/en/docs/02/resources/kustomize/overlays/staging/deployment-patch.yaml" >}}{{< /highlight >}}

`overlays/production/deployment-patch.yaml`:

{{< highlight yaml >}}{{< readfile file="content/en/docs/02/resources/kustomize/overlays/production/deployment-patch.yaml" >}}{{< /highlight >}}
{{< highlight yaml >}}{{< readfile file="/content/en/docs/02/resources/kustomize/overlays/production/deployment-patch.yaml" >}}{{< /highlight >}}

The main difference here is that the environment variable `APPLICATION_NAME` is set differently. The `app` label also differs because we are going to deploy both Deployments into the same Namespace.

The same applies to our Service. It also comes in two customizations so that it matches the corresponding Deployment in the same Namespace.

`overlays/staging/service-patch.yaml`:

{{< highlight yaml >}}{{< readfile file="content/en/docs/02/resources/kustomize/overlays/staging/service-patch.yaml" >}}{{< /highlight >}}
{{< highlight yaml >}}{{< readfile file="/content/en/docs/02/resources/kustomize/overlays/staging/service-patch.yaml" >}}{{< /highlight >}}

`overlays/production/service-patch.yaml`:

{{< highlight yaml >}}{{< readfile file="content/en/docs/02/resources/kustomize/overlays/production/service-patch.yaml" >}}{{< /highlight >}}
{{< highlight yaml >}}{{< readfile file="/content/en/docs/02/resources/kustomize/overlays/production/service-patch.yaml" >}}{{< /highlight >}}

{{% alert title="Note" color="primary" %}}
All files mentioned above are also directly accessible from [GitHub](https://github.com/acend/ch-open-workshop-tage-training/tree/master/content/en/docs/02/resources/kustomize).
Expand Down
10 changes: 6 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ module github.com/acend/ch-open-workshop-tage-training
go 1.19

require (
github.com/acend/docsy-acend v0.0.0-20220406070448-8027986336dc // indirect
github.com/acend/docsy-plus v0.0.0-20220428195954-da462686a1f4 // indirect
github.com/google/docsy v0.4.0 // indirect
github.com/google/docsy/dependencies v0.4.0 // indirect
github.com/FortAwesome/Font-Awesome v0.0.0-20240108205627-a1232e345536 // indirect
github.com/acend/docsy-acend v1.0.0 // indirect
github.com/acend/docsy-plus v1.1.0 // indirect
github.com/google/docsy v0.9.1 // indirect
github.com/google/docsy/dependencies v0.7.2 // indirect
github.com/twbs/bootstrap v5.3.3+incompatible // indirect
)
14 changes: 14 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,10 +1,24 @@
github.com/FortAwesome/Font-Awesome v0.0.0-20210804190922-7d3d774145ac/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo=
github.com/FortAwesome/Font-Awesome v0.0.0-20230327165841-0698449d50f2/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo=
github.com/FortAwesome/Font-Awesome v0.0.0-20240108205627-a1232e345536 h1:LFS9LpoSZYhxQ6clU0NIVbaGR08BlxAs4b+9W+7IGVQ=
github.com/FortAwesome/Font-Awesome v0.0.0-20240108205627-a1232e345536/go.mod h1:IUgezN/MFpCDIlFezw3L8j83oeiIuYoj28Miwr/KUYo=
github.com/acend/docsy-acend v0.0.0-20220406070448-8027986336dc h1:kNDPVcZCXsbJxqDstPoesa9YqWx84BVowj9cgxG6dnE=
github.com/acend/docsy-acend v0.0.0-20220406070448-8027986336dc/go.mod h1:92hTJB3aPssEooTK+gv0i84vwTjah30HKaLGdupJaPA=
github.com/acend/docsy-acend v1.0.0 h1:TwmHoH3z6lh5zcNj6zUpMP4lYOhQ+OOgcbBwr7AqVoo=
github.com/acend/docsy-acend v1.0.0/go.mod h1:h8XZkPe1VufdOQfFXcLVQ7FvOJyIMKr8rJcSvWStG2g=
github.com/acend/docsy-plus v0.0.0-20220428195954-da462686a1f4 h1:NH8RTlmPMcTPxfZYlqYWWcqoQ5STebCQikKByJVRnAA=
github.com/acend/docsy-plus v0.0.0-20220428195954-da462686a1f4/go.mod h1:FUTTPmi3S92rVMbCYqXdGNxixdyqACBrFTK7dOuMttQ=
github.com/acend/docsy-plus v1.1.0 h1:MgHPR3YRPrJSWtMS3eQKJivdCEwFHCIKD0jChsZS3SM=
github.com/acend/docsy-plus v1.1.0/go.mod h1:LPbI0Ljrhzt0YHUg8qozWVUXjrMVI1cFVPn3TyQxbcY=
github.com/google/docsy v0.4.0 h1:Eyt2aiDC1fnw/Qq/9xnIqUU5n5Yyk4c8gX3nBDdTv/4=
github.com/google/docsy v0.4.0/go.mod h1:vJjGkHNaw9bO42gpFTWwAUzHZWZEVlK46Kx7ikY5c7Y=
github.com/google/docsy v0.9.1 h1:+jqges1YCd+yHeuZ1BUvD8V8mEGVtPxULg5j/vaJ984=
github.com/google/docsy v0.9.1/go.mod h1:saOqKEUOn07Bc0orM/JdIF3VkOanHta9LU5Y53bwN2U=
github.com/google/docsy/dependencies v0.4.0 h1:FXwyjtuFfPIPBauU2t7uIAgS6VYfJf+OD5pzxGvkQsQ=
github.com/google/docsy/dependencies v0.4.0/go.mod h1:2zZxHF+2qvkyXhLZtsbnqMotxMukJXLaf8fAZER48oo=
github.com/google/docsy/dependencies v0.7.2 h1:+t5ufoADQAj4XneFphz4A+UU0ICAxmNaRHVWtMYXPSI=
github.com/google/docsy/dependencies v0.7.2/go.mod h1:gihhs5gmgeO+wuoay4FwOzob+jYJVyQbNaQOh788lD4=
github.com/twbs/bootstrap v4.6.1+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0=
github.com/twbs/bootstrap v5.2.3+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0=
github.com/twbs/bootstrap v5.3.3+incompatible h1:goFoqinzdHfkeegpFP7pvhbd0g+A3O2hbU3XCjuNrEQ=
github.com/twbs/bootstrap v5.3.3+incompatible/go.mod h1:fZTSrkpSf0/HkL0IIJzvVspTt1r9zuf7XlZau8kpcY0=

0 comments on commit 0504721

Please sign in to comment.