Add deployment assets
This commit is contained in:
parent
86ed9a1808
commit
88acf29eb8
25
deploy/ansible/vm-playbook.yaml
Normal file
25
deploy/ansible/vm-playbook.yaml
Normal file
@ -0,0 +1,25 @@
|
||||
---
|
||||
- name: Deploy XControl on VM
|
||||
hosts: all
|
||||
become: true
|
||||
tasks:
|
||||
- name: Install Docker
|
||||
apt:
|
||||
name: docker.io
|
||||
state: present
|
||||
update_cache: yes
|
||||
|
||||
- name: Ensure Docker service is running
|
||||
service:
|
||||
name: docker
|
||||
state: started
|
||||
enabled: true
|
||||
|
||||
- name: Run XControl container
|
||||
community.docker.docker_container:
|
||||
name: xcontrol
|
||||
image: ghcr.io/example/xcontrol:latest
|
||||
ports:
|
||||
- "8080:8080"
|
||||
env:
|
||||
KB_DSN: "postgres://user:pass@db:5432/xcontrol?sslmode=disable"
|
||||
6
deploy/charts/xcontrol/Chart.yaml
Normal file
6
deploy/charts/xcontrol/Chart.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: xcontrol
|
||||
version: 0.1.0
|
||||
description: XControl platform chart
|
||||
type: application
|
||||
appVersion: "1.0"
|
||||
28
deploy/charts/xcontrol/templates/deployment.yaml
Normal file
28
deploy/charts/xcontrol/templates/deployment.yaml
Normal file
@ -0,0 +1,28 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: xcontrol
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: xcontrol
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: xcontrol
|
||||
spec:
|
||||
containers:
|
||||
- name: xcontrol
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
env:
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
- name: KB_DSN
|
||||
value: "postgres://{{ .Values.postgresql.auth.user }}:{{ .Values.postgresql.auth.password }}@xcontrol-postgres:5432/{{ .Values.postgresql.auth.database }}?sslmode=disable"
|
||||
{{- else if .Values.externalPostgresql.enabled }}
|
||||
- name: KB_DSN
|
||||
value: "postgres://{{ .Values.externalPostgresql.user }}:{{ .Values.externalPostgresql.password }}@{{ .Values.externalPostgresql.host }}/{{ .Values.externalPostgresql.database }}"
|
||||
{{- end }}
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
43
deploy/charts/xcontrol/templates/postgres.yaml
Normal file
43
deploy/charts/xcontrol/templates/postgres.yaml
Normal file
@ -0,0 +1,43 @@
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: xcontrol-postgres
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: xcontrol-postgres
|
||||
ports:
|
||||
- port: 5432
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: xcontrol-postgres
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: xcontrol-postgres
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: xcontrol-postgres
|
||||
spec:
|
||||
containers:
|
||||
- name: postgres
|
||||
image: {{ .Values.postgresql.image }}
|
||||
env:
|
||||
- name: POSTGRES_DB
|
||||
value: {{ .Values.postgresql.auth.database }}
|
||||
- name: POSTGRES_USER
|
||||
value: {{ .Values.postgresql.auth.user }}
|
||||
- name: POSTGRES_PASSWORD
|
||||
value: {{ .Values.postgresql.auth.password }}
|
||||
volumeMounts:
|
||||
- name: data
|
||||
mountPath: /var/lib/postgresql/data
|
||||
volumes:
|
||||
- name: data
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
11
deploy/charts/xcontrol/templates/service.yaml
Normal file
11
deploy/charts/xcontrol/templates/service.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: xcontrol
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
selector:
|
||||
app: xcontrol
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: 8080
|
||||
23
deploy/charts/xcontrol/values.yaml
Normal file
23
deploy/charts/xcontrol/values.yaml
Normal file
@ -0,0 +1,23 @@
|
||||
image:
|
||||
repository: ghcr.io/example/xcontrol
|
||||
tag: latest
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 8080
|
||||
|
||||
postgresql:
|
||||
enabled: true
|
||||
image: postgres:16
|
||||
auth:
|
||||
user: xcontrol
|
||||
password: xcontrol
|
||||
database: xcontrol
|
||||
|
||||
externalPostgresql:
|
||||
enabled: false
|
||||
host: ""
|
||||
user: ""
|
||||
password: ""
|
||||
database: ""
|
||||
20
deploy/nerdctl-compose.yml
Normal file
20
deploy/nerdctl-compose.yml
Normal file
@ -0,0 +1,20 @@
|
||||
version: "3"
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16
|
||||
environment:
|
||||
POSTGRES_DB: xcontrol
|
||||
POSTGRES_USER: xcontrol
|
||||
POSTGRES_PASSWORD: xcontrol
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
xcontrol:
|
||||
image: ghcr.io/example/xcontrol:latest
|
||||
environment:
|
||||
KB_DSN: postgres://xcontrol:xcontrol@postgres:5432/xcontrol?sslmode=disable
|
||||
ports:
|
||||
- "8080:8080"
|
||||
depends_on:
|
||||
- postgres
|
||||
volumes:
|
||||
pgdata:
|
||||
14
modules/markmind/Dockerfile
Normal file
14
modules/markmind/Dockerfile
Normal file
@ -0,0 +1,14 @@
|
||||
# Build XControl API including markmind module
|
||||
FROM golang:1.21 AS builder
|
||||
WORKDIR /src
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /markmind ./cmd/api
|
||||
|
||||
FROM gcr.io/distroless/base-debian12
|
||||
WORKDIR /
|
||||
COPY --from=builder /markmind /markmind
|
||||
EXPOSE 8080
|
||||
USER nonroot
|
||||
ENTRYPOINT ["/markmind"]
|
||||
12
ui/homepage/Dockerfile
Normal file
12
ui/homepage/Dockerfile
Normal file
@ -0,0 +1,12 @@
|
||||
# Build static homepage
|
||||
FROM node:20 AS build
|
||||
WORKDIR /app
|
||||
COPY ui/homepage/package.json ui/homepage/yarn.lock ./
|
||||
RUN yarn install --frozen-lockfile
|
||||
COPY ui/homepage .
|
||||
RUN yarn build
|
||||
|
||||
FROM nginx:alpine
|
||||
COPY --from=build /app/out /usr/share/nginx/html
|
||||
EXPOSE 80
|
||||
CMD ["nginx","-g","daemon off;"]
|
||||
12
ui/panel/Dockerfile
Normal file
12
ui/panel/Dockerfile
Normal file
@ -0,0 +1,12 @@
|
||||
# Build admin panel static site
|
||||
FROM node:20 AS build
|
||||
WORKDIR /app
|
||||
COPY ui/panel/package*.json ./
|
||||
RUN npm ci
|
||||
COPY ui/panel .
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:alpine
|
||||
COPY --from=build /app/out /usr/share/nginx/html
|
||||
EXPOSE 80
|
||||
CMD ["nginx","-g","daemon off;"]
|
||||
Loading…
Reference in New Issue
Block a user