Skip to content

Commit

Permalink
feat: initial start script and dummy app
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeMac committed Nov 19, 2024
0 parents commit 3090b5c
Show file tree
Hide file tree
Showing 7 changed files with 119 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/release-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: ci

on:
push:

jobs:
docker:
permissions:
packages: write
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actore }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: get-glu/gitops-example/app:latest
7 changes: 7 additions & 0 deletions cmd/app/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM golang:1.23

ADD . .

RUN go build -o /bin/app ./...

CMD "/bin/app"
3 changes: 3 additions & 0 deletions cmd/app/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module get-glu/gitops-example/app

go 1.23.3
16 changes: 16 additions & 0 deletions cmd/app/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package main

import (
"log/slog"
"net/http"
)

func main() {
http.Handle("/", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Write([]byte(`<html><body><h1>Welcome!</h1></body></html>`))
}))

slog.Info("Starting server", "addr", ":8080")

http.ListenAndServe(":8080", nil)
}
21 changes: 21 additions & 0 deletions env/staging/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
27 changes: 27 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh

set -x

kind create cluster \
--wait 120s \
--config - <<EOF
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: glu-gitops-example
nodes:
- extraPortMappings:
- containerPort: 30080 # example application
hostPort: 30080
EOF

if ! command -v go 2>&1 >/dev/null; then
echo "Please install Go (>=1.23)"
exit 1
fi

if ! command -v timoni 2>&1 >/dev/null; then
go install github.com/stefanprodan/timoni/cmd/timoni@latest
fi

timoni bundle apply --kube-context kind-glu-gitops-example -f timoni/flux-aio.cue
19 changes: 19 additions & 0 deletions timoni/flux-aio.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
bundle: {
apiVersion: "v1alpha1"
name: "flux-aio"
instances: {
"flux": {
module: url: "oci://ghcr.io/stefanprodan/modules/flux-aio"
namespace: "flux-system"
values: {
controllers: {
helm: enabled: true
kustomize: enabled: true
notification: enabled: true
}
hostNetwork: false
securityProfile: "privileged"
}
}
}
}

0 comments on commit 3090b5c

Please sign in to comment.