From 27e0ddf95b28909941ab5412f3fcd86d84d6228f Mon Sep 17 00:00:00 2001 From: Peter Kurfer Date: Mon, 29 Apr 2024 19:18:42 +0200 Subject: [PATCH] feat: deploy pages to Cloudflare pages --- .dockerignore | 8 --- .drone.yml | 96 ------------------------------- .forgejo/workflows/deploy.yml | 21 +++++++ config.toml | 81 +++++++++++++------------- content/about.md | 1 + content/projects.md | 1 + deploy/k8s/deployment.yaml | 62 -------------------- deploy/k8s/ingress.yaml | 21 ------- deploy/k8s/kustomization.yaml | 19 ------ deploy/k8s/pod_monitor.yaml | 14 ----- deploy/k8s/service.yaml | 17 ------ go.mod | 4 +- go.sum | 4 +- layouts/partials/custom-head.html | 2 + 14 files changed, 68 insertions(+), 283 deletions(-) delete mode 100644 .dockerignore delete mode 100644 .drone.yml create mode 100644 .forgejo/workflows/deploy.yml delete mode 100644 deploy/k8s/deployment.yaml delete mode 100644 deploy/k8s/ingress.yaml delete mode 100644 deploy/k8s/kustomization.yaml delete mode 100644 deploy/k8s/pod_monitor.yaml delete mode 100644 deploy/k8s/service.yaml create mode 100644 layouts/partials/custom-head.html diff --git a/.dockerignore b/.dockerignore deleted file mode 100644 index a39aa8d..0000000 --- a/.dockerignore +++ /dev/null @@ -1,8 +0,0 @@ -public/ -.github/ -.git/ - -Dockerfile -.dockerignore -.gitignore -.gitmodules \ No newline at end of file diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index cdf79f4..0000000 --- a/.drone.yml +++ /dev/null @@ -1,96 +0,0 @@ ---- -kind: pipeline -type: docker -name: amd64 - -platform: - arch: amd64 - -steps: -- name: image build - image: gcr.io/kaniko-project/executor:debug - network_mode: host - commands: - - > - echo "{\"auths\": {\"https://code.icb4dc0.de\": {\"auth\" : \"$(printf '%s:%s' $$GITEA_USER $$GITEA_TOKEN | base64)\" }}}" > /kaniko/.docker/config.json - - /kaniko/executor --destination "$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}_$${IMAGE_TAG}" --context "$${BUILD_CONTEXT}" - environment: - GITEA_USER: prskr - GITEA_TOKEN: - from_secret: gitea_token - IMAGE_REPO: code.icb4dc0.de/prskr/blog - IMAGE_TAG: x86_64 - BUILD_CONTEXT: . - ---- -kind: pipeline -type: docker -name: arm64 - -platform: - arch: arm64 - -steps: -- name: image build - image: gcr.io/kaniko-project/executor:debug - network_mode: host - commands: - - > - echo "{\"auths\": {\"https://code.icb4dc0.de\": {\"auth\" : \"$(printf '%s:%s' $$GITEA_USER $$GITEA_TOKEN | base64)\" }}}" > /kaniko/.docker/config.json - - /kaniko/executor --destination "$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}_$${IMAGE_TAG}" --context "$${BUILD_CONTEXT}" - environment: - GITEA_USER: prskr - GITEA_TOKEN: - from_secret: gitea_token - IMAGE_REPO: code.icb4dc0.de/prskr/blog - IMAGE_TAG: arm64 - BUILD_CONTEXT: . - ---- -kind: pipeline -type: docker -name: deploy - -depends_on: - - amd64 - - arm64 - -steps: -- name: manifest - image: quay.io/buildah/stable - network_mode: host - privileged: true - commands: - - buildah login "$${IMAGE_REGISTRY}" --username "$${GITEA_USER}" --password "$${GITEA_TOKEN}" - - buildah manifest create "$${IMAGE_REGISTRY}/$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}" - - buildah manifest add "$${IMAGE_REGISTRY}/$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}" "docker://$${IMAGE_REGISTRY}/$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}_x86_64" - - buildah manifest add "$${IMAGE_REGISTRY}/$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}" "docker://$${IMAGE_REGISTRY}/$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}_arm64" - - buildah manifest push --all "$${IMAGE_REGISTRY}/$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}" "docker://$${IMAGE_REGISTRY}/$${IMAGE_REPO}:$${DRONE_COMMIT_SHA}" - environment: - GITEA_USER: prskr - GITEA_TOKEN: - from_secret: gitea_token - IMAGE_REGISTRY: code.icb4dc0.de - IMAGE_REPO: prskr/blog - -- name: deploy - image: code.icb4dc0.de/prskr/ci-images/kustomize:latest - network_mode: host - commands: - - cd deploy/k8s - - kustomize edit set image buildr-docs=code.icb4dc0.de/prskr/blog:$DRONE_COMMIT_SHA - - kubectl config set-cluster hetzner --server=$K8S_API_URL --insecure-skip-tls-verify=true - - kubectl config set-credentials drone-deploy --token=$K8S_TOKEN - - kubectl config set-context hetzner --user=drone-deploy --namespace=buildr --cluster hetzner - - kubectl config use-context hetzner - - kubectl apply -k . - environment: - K8S_TOKEN: - from_secret: k8s_token - K8S_API_URL: - from_secret: k8s_api_url - when: - ref: - include: - - refs/tags/** - - refs/heads/main \ No newline at end of file diff --git a/.forgejo/workflows/deploy.yml b/.forgejo/workflows/deploy.yml new file mode 100644 index 0000000..81683da --- /dev/null +++ b/.forgejo/workflows/deploy.yml @@ -0,0 +1,21 @@ +name: Deploy pages +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Hugo + uses: peaceiris/actions-hugo@v3 + - name: Build + run: hugo --minify --environment production + - name: Deploy + uses: cloudflare/wrangler-action@v3 + with: + apiToken: ${{ secrets.CF_PAGES_TOKEN }} + accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} + command: pages deploy public --project-name=blog diff --git a/config.toml b/config.toml index 3e6184a..42c9784 100644 --- a/config.toml +++ b/config.toml @@ -1,60 +1,57 @@ baseURL = 'https://www.icb4dc0.de/' languageCode = 'en-us' title = 'icb4dc0.de' -theme = ['github.com/Mitrichius/hugo-theme-anubis'] -paginate = 10 -enableEmoji = true -disqusShortname = "" -googleAnalytics = "" -[author] -name = "Peter Kurfer" +[module] +[[module.imports]] + path = 'github.com/LordMathis/hugo-theme-nightfall' [params] -author = "Peter Kurfer" style= "auto" copyCodeButton = true rssAsSocialIcon = true +readingTime = true +published = true -[[menu.main]] -identifier = "about" -name = "About" -url = "/about/" -weight = 1 + [params.author] + name = "Peter Kurfer" + email = "peter.kurfer@gmail.com" -[[menu.main]] -identifier = "projects" -name = "Projects" -url = "/projects/" -weight = 2 - -[[menu.main]] -identifier = "tags" -name = "Tags" -url = "/tags/" -weight = 3 - -[[menu.main]] -identifier = "archive" -name = "Archive" -url = "/posts/" -weight = 4 +[menu] + [[menu.header]] + name = "blog" + weight = 0 + url = "blog" + [[menu.header]] + name = "about" + weight = 1 + url = "about" + [[menu.header]] + name = "projects" + weight = 2 + url = "projects" + [[menu.header]] + name = "tags" + weight = 3 + url = "tags" [[params.social]] -id = "github" -name = "baez90" +name = "github" +url = "https://github.com/prskr" +icon = "fa-brands fa-github" +target = "_blank" +aria = "GitHub Profile" [[params.social]] -id = "linkedin" -name = "peter-s-kurfer" +name = "linkedin" +url = "https://www.linkedin.com/in/peter-s-kurfer/" +icon = "fa-brands fa-linkedin" +target = "_blank" +aria = "LinkedIn Profile" [[params.social]] -id = "xing" +name = "xing" url = "https://www.xing.com/profile/Sebastian_Kurfer" - -[taxonomies] -category = "categories" -tag = "tags" - -[markup.goldmark.renderer] -unsafe = true \ No newline at end of file +icon = "fa-brands fa-xing" +target = "_blank" +aria = "Xing Profile" diff --git a/content/about.md b/content/about.md index 35aa976..41129e8 100644 --- a/content/about.md +++ b/content/about.md @@ -2,6 +2,7 @@ title: 'About me' button: 'About me' weight: 1 +showMetadata: false --- My name's Peter. I'm a passionate software developer especially interested in all kind of networking stuff but also asynchronous data processing, software architecture, distributed computing, testing and automatic software quality analysis and many more. diff --git a/content/projects.md b/content/projects.md index 23f00ac..ca0f962 100644 --- a/content/projects.md +++ b/content/projects.md @@ -2,6 +2,7 @@ title: 'Projects' button: 'Projects' weight: 2 +showMetadata: false --- ## INetMock diff --git a/deploy/k8s/deployment.yaml b/deploy/k8s/deployment.yaml deleted file mode 100644 index da4839e..0000000 --- a/deploy/k8s/deployment.yaml +++ /dev/null @@ -1,62 +0,0 @@ ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - name: blog - namespace: blog - labels: - app.kubernetes.io/name: blog -spec: - replicas: 2 - selector: - matchLabels: - app.kubernetes.io/name: blog - template: - metadata: - labels: - app.kubernetes.io/name: blog - spec: - containers: - - name: blog - image: blog - ports: - - name: http - containerPort: 3000 - protocol: TCP - - name: metrics - containerPort: 9100 - protocol: TCP - resources: - limits: - cpu: 100m - memory: 60Mi - requests: - cpu: 50m - memory: 20Mi - livenessProbe: - httpGet: - path: / - port: http - scheme: HTTP - timeoutSeconds: 1 - periodSeconds: 10 - successThreshold: 1 - failureThreshold: 3 - readinessProbe: - httpGet: - path: / - port: http - scheme: HTTP - timeoutSeconds: 1 - periodSeconds: 10 - successThreshold: 1 - failureThreshold: 3 - imagePullPolicy: IfNotPresent - securityContext: - capabilities: - drop: - - ALL - runAsUser: 65532 - runAsNonRoot: true - readOnlyRootFilesystem: true - allowPrivilegeEscalation: false \ No newline at end of file diff --git a/deploy/k8s/ingress.yaml b/deploy/k8s/ingress.yaml deleted file mode 100644 index fab2073..0000000 --- a/deploy/k8s/ingress.yaml +++ /dev/null @@ -1,21 +0,0 @@ ---- -apiVersion: networking.k8s.io/v1 -kind: Ingress -metadata: - name: blog - namespace: blog - labels: - app.kubernetes.io/name: blog -spec: - ingressClassName: traefik - rules: - - host: www.icb4dc0.de - http: - paths: - - path: / - pathType: ImplementationSpecific - backend: - service: - name: blog - port: - number: 3000 diff --git a/deploy/k8s/kustomization.yaml b/deploy/k8s/kustomization.yaml deleted file mode 100644 index d49bca1..0000000 --- a/deploy/k8s/kustomization.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: kustomize.config.k8s.io/v1beta1 -kind: Kustomization - -namespace: blog - -commonLabels: - app.kubernetes.io/instance: blog - app.kubernetes.io/managed-by: kustomize - -images: - - name: blog - newName: code.icb4dc0.de/prskr/blog - newTag: latest - -resources: - - "deployment.yaml" - - "service.yaml" - - "ingress.yaml" - - "pod_monitor.yaml" \ No newline at end of file diff --git a/deploy/k8s/pod_monitor.yaml b/deploy/k8s/pod_monitor.yaml deleted file mode 100644 index 3baf317..0000000 --- a/deploy/k8s/pod_monitor.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -apiVersion: monitoring.coreos.com/v1 -kind: PodMonitor -metadata: - name: blog-metrics - labels: - prometheus: default - app.kubernetes.io/name: blog -spec: - selector: - matchLabels: - app.kubernetes.io/name: blog - podMetricsEndpoints: - - port: metrics \ No newline at end of file diff --git a/deploy/k8s/service.yaml b/deploy/k8s/service.yaml deleted file mode 100644 index 87c2a7e..0000000 --- a/deploy/k8s/service.yaml +++ /dev/null @@ -1,17 +0,0 @@ ---- -apiVersion: v1 -kind: Service -metadata: - name: blog - namespace: blog - labels: - app.kubernetes.io/name: blog -spec: - ports: - - name: http - protocol: TCP - port: 3000 - targetPort: http - selector: - app.kubernetes.io/name: blog - type: ClusterIP \ No newline at end of file diff --git a/go.mod b/go.mod index a561844..93df476 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,5 @@ module code.icb4dc0.de/prskr/blog -go 1.19 +go 1.22.2 -require github.com/Mitrichius/hugo-theme-anubis v0.0.0-20220725170731-d4ba47cd2196 // indirect +require github.com/LordMathis/hugo-theme-nightfall v0.7.1 // indirect diff --git a/go.sum b/go.sum index 0aa4f5a..b6c3659 100644 --- a/go.sum +++ b/go.sum @@ -1,2 +1,2 @@ -github.com/Mitrichius/hugo-theme-anubis v0.0.0-20220725170731-d4ba47cd2196 h1:TzahMQaJXpezO9D2iQHnifGWPUn+41IWgYNBg/wNtQE= -github.com/Mitrichius/hugo-theme-anubis v0.0.0-20220725170731-d4ba47cd2196/go.mod h1:FKD3NbdsQzL+cXsC3x99XD/t/Rd5EyhDlNBAxQhULbo= +github.com/LordMathis/hugo-theme-nightfall v0.7.1 h1:n8T4Eg/5ZJLXGWmRHHAZ9DrbIv0yXBATeNo/A3p8EoM= +github.com/LordMathis/hugo-theme-nightfall v0.7.1/go.mod h1:0tCPxAeg5+tWhv17517Q8Lti/TPh0KNyON/uferEU30= diff --git a/layouts/partials/custom-head.html b/layouts/partials/custom-head.html new file mode 100644 index 0000000..8eb95f7 --- /dev/null +++ b/layouts/partials/custom-head.html @@ -0,0 +1,2 @@ + + \ No newline at end of file