Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kubernetes #104

Open
nilzao opened this issue Apr 8, 2024 · 0 comments
Open

kubernetes #104

nilzao opened this issue Apr 8, 2024 · 0 comments

Comments

@nilzao
Copy link
Contributor

nilzao commented Apr 8, 2024

Hi brothers, easy way to run sbrw, first yaml version:

apiVersion: v1
kind: Namespace
metadata:
  name: sbrw
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: openfire
  name: openfire-lb
  namespace: sbrw
spec:
  ports:
    - name: admin-console
      port: 9090
      protocol: TCP
      targetPort: 9090
    - name: xmpp
      port: 5222
      protocol: TCP
      targetPort: 5222
  selector:
    app: openfire
  sessionAffinity: None
  type: LoadBalancer
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: mysql
  name: mysql-lb
  namespace: sbrw
spec:
  ports:
    - name: mysql
      port: 3306
      protocol: TCP
      targetPort: 3306
  selector:
    app: mysql
  sessionAffinity: None
  type: LoadBalancer
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: wildfly
  name: wildfly-lb
  namespace: sbrw
spec:
  ports:
    - name: wildfly
      port: 8080
      protocol: TCP
      targetPort: 8080
  selector:
    app: wildfly
  sessionAffinity: None
  type: LoadBalancer
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: freeroam
  name: freeroam-lb
  namespace: sbrw
spec:
  ports:
    - name: freeroam
      port: 9999
      protocol: UDP
      targetPort: 9999
  selector:
    app: freeroam
  sessionAffinity: None
  type: LoadBalancer
---
apiVersion: v1
kind: Service
metadata:
  labels:
    app: multiplayer
  name: multiplayer-lb
  namespace: sbrw
spec:
  ports:
    - name: multiplayer
      port: 9998
      protocol: UDP
      targetPort: 9998
  selector:
    app: multiplayer
  sessionAffinity: None
  type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
  labels:
    app: openfire
  name: openfire
  namespace: sbrw
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      app: openfire
  template:
    metadata:
      labels:
        app: openfire
    spec:
      containers:
        - image: registry.gitlab.com/soapboxrace/openfire:latest
          env:
            - name: DOMAIN
              value: 192.168.13.121
            - name: FQDN
              value: 192.168.13.121
            - name: ADMIN_PASSWORD
              value: admin
            - name: REST_API_SECRET
              value: superSecret2
          imagePullPolicy: Always
          name: openfire
          ports:
            - containerPort: 9090
              protocol: TCP
            - containerPort: 5222
              protocol: TCP
      dnsPolicy: ClusterFirst
      restartPolicy: Always
---
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
  labels:
    app: mysql
  name: mysql
  namespace: sbrw
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      app: mysql
  template:
    metadata:
      labels:
        app: mysql
    spec:
      containers:
        - image: registry.gitlab.com/soapboxrace/mysql:latest
          imagePullPolicy: Always
          name: mysql
          ports:
            - containerPort: 3306
              protocol: TCP
      dnsPolicy: ClusterFirst
      restartPolicy: Always
---
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
  labels:
    app: wildfly
  name: wildfly
  namespace: sbrw
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      app: wildfly
  template:
    metadata:
      labels:
        app: wildfly
    spec:
      containers:
        - image: registry.gitlab.com/soapboxrace/wildfly12-mysql:latest
          env:
            - name: MYSQL_JDBC
              value: jdbc:mysql://mysql-lb.sbrw:3306/SOAPBOX
            - name: XMPP_IP
              value: 192.168.13.121
            - name: UDP_FREEROAM_IP
              value: 192.168.13.121
            - name: UDP_RACE_IP
              value: 192.168.13.121
            - name: OPENFIRE_ADDRESS
              value: http://openfire-lb.sbrw:9090/plugins/restapi/v1
          imagePullPolicy: Always
          name: wildfly
          ports:
            - containerPort: 8080
              protocol: TCP
          livenessProbe:
            exec:
              command:
                - /bin/sh
                - -c
                - "status_code=$(curl -s -o /dev/null -w '%{http_code}' 'http://127.0.0.1:8080/soapbox-race-core/'); if [ $status_code -ne 200 ]; then exit 1; fi"
            initialDelaySeconds: 60
            periodSeconds: 10
      dnsPolicy: ClusterFirst
      restartPolicy: Always
---
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
  labels:
    app: freeroam
  name: freeroam
  namespace: sbrw
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      app: freeroam
  template:
    metadata:
      labels:
        app: freeroam
    spec:
      containers:
        - image: registry.gitlab.com/soapboxrace/freeroam:latest
          imagePullPolicy: Always
          name: freeroam
          ports:
            - containerPort: 9999
              protocol: UDP
      dnsPolicy: ClusterFirst
      restartPolicy: Always
---
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
  labels:
    app: multiplayer
  name: multiplayer
  namespace: sbrw
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      app: multiplayer
  template:
    metadata:
      labels:
        app: multiplayer
    spec:
      containers:
        - image: registry.gitlab.com/soapboxrace/multiplayer:latest
          imagePullPolicy: Always
          name: multiplayer
          ports:
            - containerPort: 9998
              protocol: UDP
      dnsPolicy: ClusterFirst
      restartPolicy: Always
kubectl apply -f sbrw.yaml

if powerups not working, kill wildfly pod and wait the new pod run.

tested on lan, just change the 192.168.13.121 address to your ipv4 lan address before run kubectl apply

tested with linux k8s cluster with metallb

tested with docker desktop for windows 10, with kubernetes enabled.

to persist the mysql database, need to create a volume mount.

have fun

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant