cleanup
This commit is contained in:
1 parent
1a8a18248b
commit
d139e0b643
70 files changed
+6
-2297
No files matched your search
@@ -1,17 +0,0 @@
|
||||
.DS_Store
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*.orig
|
||||
*~
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
||||
@@ -1,6 +0,0 @@
|
||||
apiVersion: v2
|
||||
name: checkmate-chart
|
||||
description: A Helm chart for Checkmate App
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "2.3"
|
||||
@@ -1,43 +0,0 @@
|
||||
# Kubernetes Installation Guide for Checkmate
|
||||
|
||||
This guide walks you through deploying Checkmate on your Kubernetes cluster using Helm.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- A running Kubernetes cluster
|
||||
- Helm CLI installed and configured
|
||||
- `kubectl` configured to access your cluster
|
||||
|
||||
## Steps
|
||||
|
||||
### 1. Clone the repo and navigate to the Helm chart
|
||||
|
||||
```bash
|
||||
git clone https://github.com/bluewave-labs/checkmate.git
|
||||
cd checkmate/charts/helm/checkmate
|
||||
```
|
||||
|
||||
### 2. Customize values.yaml
|
||||
Edit `values.yaml` to update:
|
||||
- `client.ingress.host` and `server.ingress.host` with your domain names
|
||||
- `server.protocol` (usually http or https)
|
||||
- **If upgrading**: Migrate persistence settings from flat structure to nested:
|
||||
- Old: `persistence.mongodbSize` → New: `persistence.mongo.size`
|
||||
- Old: `persistence.redisSize` → New: `persistence.redis.size`
|
||||
- Add: `persistence.mongo.storageClass` and `persistence.redis.storageClass` (leave empty for default)
|
||||
- Secrets under the `secrets` section (`JWT_SECRET`, email credentials, API keys, etc.) — replace all change_me values
|
||||
|
||||
### 3. Deploy the Helm chart
|
||||
```bash
|
||||
helm install checkmate ./charts/helm/checkmate
|
||||
```
|
||||
This will deploy the client, server, MongoDB, and Redis components.
|
||||
|
||||
### 4. Verify the deployment
|
||||
Check pods and services:
|
||||
```bash
|
||||
kubectl get pods
|
||||
kubectl get svc
|
||||
```
|
||||
|
||||
Once all pods are `Running` and `Ready`, you can access Checkmate via the configured ingress hosts.
|
||||
@@ -1,12 +0,0 @@
|
||||
{{- if eq .Values.client.ingress.host "change_me" }}
|
||||
{{- fail "client.ingress.host must be overridden and not set to 'change_me'" }}
|
||||
{{- end }}
|
||||
|
||||
{{- if eq .Values.server.ingress.host "change_me" }}
|
||||
{{- fail "server.ingress.host must be overridden and not set to 'change_me'" }}
|
||||
{{- end }}
|
||||
|
||||
{{- $protocol := .Values.server.protocol }}
|
||||
{{- if not (or (eq $protocol "http") (eq $protocol "https")) }}
|
||||
{{- fail "server.protocol must be either 'http' or 'https'" }}
|
||||
{{- end }}
|
||||
@@ -1,44 +0,0 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: checkmate-client
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: checkmate-client
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: checkmate-client
|
||||
spec:
|
||||
{{- with .Values.client.affinity }}
|
||||
affinity:
|
||||
{{- tpl ( . | toYaml) $ | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.client.tolerations }}
|
||||
tolerations:
|
||||
{{- tpl ( . | toYaml) $ | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: client
|
||||
image: {{ .Values.client.image }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.client.port }}
|
||||
env:
|
||||
- name: UPTIME_APP_API_BASE_URL
|
||||
value: "{{ .Values.server.protocol }}://{{ .Values.server.ingress.host }}/api/v1"
|
||||
- name: UPTIME_APP_CLIENT_HOST
|
||||
value: "{{ .Values.client.protocol }}://{{ .Values.client.ingress.host }}"
|
||||
volumeMounts:
|
||||
- name: config-volume
|
||||
mountPath: /etc/nginx/conf.d/default.conf
|
||||
subPath: default.conf
|
||||
{{- with .Values.client.resources }}
|
||||
resources:
|
||||
{{- tpl ( . | toYaml) $ | nindent 12 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: config-volume
|
||||
configMap:
|
||||
name: checkmate-server-nginx-cm
|
||||
@@ -1,25 +0,0 @@
|
||||
{{- if .Values.client.ingress.enabled }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: checkmate-client-ingress
|
||||
{{- if .Values.client.ingress.annotations }}
|
||||
annotations:
|
||||
{{- range $key, $value := .Values.client.ingress.annotations }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
ingressClassName: {{ .Values.client.ingress.className }}
|
||||
rules:
|
||||
- host: {{ .Values.client.ingress.host }}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: checkmate-client
|
||||
port:
|
||||
number: {{ .Values.client.port }}
|
||||
{{- end }}
|
||||
@@ -1,9 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: checkmate-client
|
||||
spec:
|
||||
selector:
|
||||
app: checkmate-client
|
||||
ports:
|
||||
- port: {{ .Values.client.port }}
|
||||
@@ -1,9 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: checkmate-mongodb
|
||||
spec:
|
||||
selector:
|
||||
app: checkmate-mongodb
|
||||
ports:
|
||||
- port: {{ .Values.mongodb.port }}
|
||||
@@ -1,44 +0,0 @@
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: checkmate-mongodb
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: checkmate-mongodb
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: checkmate-mongodb
|
||||
spec:
|
||||
{{- with .Values.mongodb.affinity }}
|
||||
affinity:
|
||||
{{- tpl ( . | toYaml) $ | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.mongodb.tolerations }}
|
||||
tolerations:
|
||||
{{- tpl ( . | toYaml) $ | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: mongodb
|
||||
image: {{ .Values.mongodb.image }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.mongodb.port }}
|
||||
command: ["mongod", "--quiet", "--bind_ip_all"]
|
||||
volumeMounts:
|
||||
- name: checkmate-mongo-persistent-storage
|
||||
mountPath: /data/db
|
||||
{{- with .Values.mongodb.resources }}
|
||||
resources:
|
||||
{{- tpl ( . | toYaml) $ | nindent 12 }}
|
||||
{{- end }}
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: checkmate-mongo-persistent-storage
|
||||
spec:
|
||||
storageClassName: {{ .Values.persistence.mongo.storageClass | quote }}
|
||||
accessModes: ["ReadWriteOnce"]
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.mongo.size | default "5Gi" | quote }}
|
||||
@@ -1,11 +0,0 @@
|
||||
{{- if .Values.redis.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: checkmate-redis
|
||||
spec:
|
||||
selector:
|
||||
app: checkmate-redis
|
||||
ports:
|
||||
- port: {{ .Values.redis.port }}
|
||||
{{- end }}
|
||||
@@ -1,33 +0,0 @@
|
||||
{{- if .Values.redis.enabled }}
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: checkmate-redis
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: checkmate-redis
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: checkmate-redis
|
||||
spec:
|
||||
containers:
|
||||
- name: redis
|
||||
image: {{ .Values.redis.image }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.redis.port }}
|
||||
volumeMounts:
|
||||
- name: redis-data
|
||||
mountPath: /data
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: checkmate-redis-persistent-storage
|
||||
spec:
|
||||
storageClassName: {{ .Values.persistence.redis.storageClass | quote }}
|
||||
accessModes: ["ReadWriteOnce"]
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.redis.size | default "1Gi" | quote }}
|
||||
{{- end }}
|
||||
@@ -1,15 +0,0 @@
|
||||
{{- $secrets := .Values.secrets }}
|
||||
|
||||
{{- if or (not $secrets.JWT_SECRET) (eq $secrets.JWT_SECRET "change_me") }}
|
||||
{{- fail "secrets.JWT_SECRET must be overridden and cannot be 'change_me'" }}
|
||||
{{- end }}
|
||||
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: checkmate-secrets
|
||||
type: Opaque
|
||||
stringData:
|
||||
{{- range $key, $value := $secrets }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
@@ -1,37 +0,0 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: checkmate-server
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: checkmate-server
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: checkmate-server
|
||||
spec:
|
||||
{{- with .Values.server.affinity }}
|
||||
affinity:
|
||||
{{- tpl ( . | toYaml) $ | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.server.tolerations }}
|
||||
tolerations:
|
||||
{{- tpl ( . | toYaml) $ | nindent 8 }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- name: server
|
||||
image: {{ .Values.server.image }}
|
||||
ports:
|
||||
- containerPort: {{ .Values.server.port }}
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: checkmate-secrets
|
||||
{{- with .Values.server.resources }}
|
||||
resources:
|
||||
{{- tpl ( . | toYaml) $ | nindent 12 }}
|
||||
{{- end }}
|
||||
env:
|
||||
- name: CLIENT_HOST
|
||||
value: "{{ .Values.client.protocol }}://{{ .Values.client.ingress.host }}"
|
||||
@@ -1,32 +0,0 @@
|
||||
{{- if .Values.server.ingress.enabled }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: checkmate-server-ingress
|
||||
{{- if .Values.server.ingress.annotations }}
|
||||
annotations:
|
||||
{{- range $key, $value := .Values.server.ingress.annotations }}
|
||||
{{ $key }}: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{/*#annotations:
|
||||
#nginx.ingress.kubernetes.io/rewrite-target: /
|
||||
#nginx.ingress.kubernetes.io/enable-cors: "true"
|
||||
#nginx.ingress.kubernetes.io/cors-allow-origin: "http://{{ .Values.client.ingress.host }},https://{{ .Values.client.ingress.host }}"
|
||||
#nginx.ingress.kubernetes.io/cors-allow-methods: "GET, PUT, POST, DELETE, PATCH, OPTIONS"
|
||||
#nginx.ingress.kubernetes.io/cors-allow-headers: "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization"
|
||||
#nginx.ingress.kubernetes.io/cors-allow-credentials: "true"*/}}
|
||||
spec:
|
||||
ingressClassName: {{ .Values.server.ingress.className }}
|
||||
rules:
|
||||
- host: {{ .Values.server.ingress.host }}
|
||||
http:
|
||||
paths:
|
||||
- path: /api/v1
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: checkmate-server
|
||||
port:
|
||||
number: {{ .Values.server.port }}
|
||||
{{- end }}
|
||||
@@ -1,41 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: checkmate-server-nginx-cm
|
||||
data:
|
||||
default.conf: |
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name checkmate-demo.bluewavelabs.ca;
|
||||
server_tokens off;
|
||||
|
||||
location /.well-known/acme-challenge/ {
|
||||
root /var/www/certbot;
|
||||
}
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# location /api/ {
|
||||
# proxy_pass http://{{ .Values.server.ingress.host }}:5000/api/;
|
||||
# proxy_http_version 1.1;
|
||||
# proxy_set_header Host $host;
|
||||
# proxy_set_header X-Real-IP $remote_addr;
|
||||
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
# proxy_set_header X-Forwarded-Proto $scheme;
|
||||
# }
|
||||
|
||||
location /api-docs/ {
|
||||
proxy_pass http://{{ .Values.server.ingress.host }}:5000/api-docs/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: checkmate-server
|
||||
spec:
|
||||
selector:
|
||||
app: checkmate-server
|
||||
ports:
|
||||
- port: {{ .Values.server.port }}
|
||||
@@ -1,52 +0,0 @@
|
||||
client:
|
||||
image: ghcr.io/bluewave-labs/checkmate-client:v3.2.0
|
||||
port: 80
|
||||
protocol: http
|
||||
ingress:
|
||||
enabled: true
|
||||
host: change_me
|
||||
className: nginx
|
||||
annotations: {}
|
||||
|
||||
server:
|
||||
image: ghcr.io/bluewave-labs/checkmate-backend:v3.2.0
|
||||
port: 52345
|
||||
protocol: http
|
||||
ingress:
|
||||
enabled: true
|
||||
host: change_me
|
||||
className: nginx
|
||||
annotations: {}
|
||||
|
||||
redis:
|
||||
enabled: false
|
||||
image: redis:7.2
|
||||
port: 6379
|
||||
|
||||
mongodb:
|
||||
image: ghcr.io/bluewave-labs/checkmate-mongo:v3.2.0
|
||||
port: 27017
|
||||
|
||||
secrets:
|
||||
JWT_SECRET: change_me
|
||||
# REFRESH_TOKEN_SECRET: change_me
|
||||
# SYSTEM_EMAIL_ADDRESS: test@example.com
|
||||
# SYSTEM_EMAIL_PASSWORD: change_me
|
||||
# SYSTEM_EMAIL_HOST: smtp.example.com
|
||||
# SYSTEM_EMAIL_PORT: "587"
|
||||
# PAGESPEED_API_KEY: change_me
|
||||
DB_CONNECTION_STRING: mongodb://checkmate-mongodb.namespace.svc:27017/uptime_db
|
||||
CLIENT_HOST: change_me
|
||||
# REDIS_HOST: redis
|
||||
# REDIS_PORT: "6379"
|
||||
# DB_TYPE: MongoDB
|
||||
# TOKEN_TTL: 99d
|
||||
# REFRESH_TOKEN_TTL: 99d
|
||||
|
||||
persistence:
|
||||
mongo:
|
||||
size: 5Gi
|
||||
storageClass: ""
|
||||
redis:
|
||||
size: 1Gi
|
||||
storageClass: ""
|
||||
@@ -1,24 +0,0 @@
|
||||
*.sh
|
||||
!quickstart.sh
|
||||
!build_images.sh
|
||||
dev/mongo/data/*
|
||||
dev/redis/data/*
|
||||
dist/mongo/data/*
|
||||
dist/redis/data/*
|
||||
prod/mongo/data/*
|
||||
prod/redis/data/*
|
||||
dist/docker-compose-test.yaml
|
||||
/dist-mono/mongo/data/*
|
||||
/dist-mono/redis/data/*
|
||||
/dist-arm/mongo/data/*
|
||||
*.env
|
||||
|
||||
# Custom CA certificates and keys (should not be committed)
|
||||
dev/certs/*
|
||||
!dev/certs/.gitkeep
|
||||
|
||||
# Certificate artifacts
|
||||
*.key
|
||||
*.csr
|
||||
*.srl
|
||||
*.log
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Change directory to root Server directory for correct Docker Context
|
||||
cd "$(dirname "$0")"
|
||||
cd ../../../
|
||||
|
||||
# Define an array of services and their Dockerfiles
|
||||
declare -A services=(
|
||||
["bluewaveuptime/uptime_client"]="./server/docker/dist/client.Dockerfile"
|
||||
["bluewaveuptime/uptime_database_mongo"]="./server/docker/dist/mongoDB.Dockerfile"
|
||||
["bluewaveuptime/uptime_redis"]="./server/docker/dist/redis.Dockerfile"
|
||||
["bluewaveuptime/uptime_server"]="./server/docker/dist/server.Dockerfile"
|
||||
)
|
||||
|
||||
# Loop through each service and build the corresponding image
|
||||
for service in "${!services[@]}"; do
|
||||
docker build -f "${services[$service]}" -t "$service" .
|
||||
|
||||
# Check if the build succeeded
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error building $service image. Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "All images built successfully"
|
||||
@@ -1,22 +0,0 @@
|
||||
FROM node:20-slim AS build
|
||||
|
||||
ENV NODE_OPTIONS="--max-old-space-size=4096"
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./client/package*.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY ./client .
|
||||
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:1.27.1-alpine
|
||||
|
||||
COPY ./server/docker/dist/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
COPY --from=build /app/env.sh /docker-entrypoint.d/env.sh
|
||||
RUN chmod +x /docker-entrypoint.d/env.sh
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
@@ -1,3 +0,0 @@
|
||||
FROM mongo
|
||||
EXPOSE 27017
|
||||
CMD ["mongod"]
|
||||
@@ -1,35 +0,0 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name checkmate-demo.bluewavelabs.ca;
|
||||
server_tokens off;
|
||||
|
||||
location /.well-known/acme-challenge/ {
|
||||
root /var/www/certbot;
|
||||
}
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://server:5000/api/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location /api-docs/ {
|
||||
proxy_pass http://server:5000/api-docs/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
FROM redis
|
||||
EXPOSE 6379
|
||||
@@ -1,18 +0,0 @@
|
||||
FROM node:20-slim
|
||||
|
||||
# Install ping
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y iputils-ping \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ../../package*.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY ../../ ./
|
||||
|
||||
EXPOSE 5000
|
||||
|
||||
CMD ["node", "index.js"]
|
||||
@@ -1,29 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Change directory to root Server directory for correct Docker Context
|
||||
cd "$(dirname "$0")"
|
||||
cd ../..
|
||||
|
||||
# Define service names and their corresponding Dockerfiles in parallel arrays
|
||||
services=("uptime_client" "uptime_mongo" "uptime_server")
|
||||
dockerfiles=(
|
||||
"./docker/dev/client.Dockerfile"
|
||||
"./docker/dev/mongoDB.Dockerfile"
|
||||
"./docker/dev/server.Dockerfile"
|
||||
)
|
||||
|
||||
# Loop through each service and build the corresponding image
|
||||
for i in "${!services[@]}"; do
|
||||
service="${services[$i]}"
|
||||
dockerfile="${dockerfiles[$i]}"
|
||||
|
||||
docker build -f "$dockerfile" -t "$service" .
|
||||
|
||||
# Check if the build succeeded
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error building $service image. Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "All images built successfully"
|
||||
Whitespace-only changes.
@@ -1,20 +0,0 @@
|
||||
FROM node:20-slim AS build
|
||||
|
||||
ENV NODE_OPTIONS="--max-old-space-size=4096"
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./client/package*.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY ./client ./
|
||||
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:1.27.1-alpine
|
||||
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
COPY --from=build /app/env.sh /docker-entrypoint.d/env.sh
|
||||
RUN chmod +x /docker-entrypoint.d/env.sh
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
@@ -1,30 +0,0 @@
|
||||
# Dev/Test only: Not required in production
|
||||
# Example Docker Compose configuration for custom CA trust
|
||||
# This file demonstrates how to configure Checkmate to trust custom CAs
|
||||
#
|
||||
# Usage: docker-compose -f docker-compose.yaml -f docker-compose.custom-ca-example.yaml up
|
||||
|
||||
services:
|
||||
server:
|
||||
image: uptime_server:latest
|
||||
restart: always
|
||||
ports:
|
||||
- "52345:52345"
|
||||
env_file:
|
||||
- server.env
|
||||
environment:
|
||||
# Mount your custom CA certificate
|
||||
NODE_EXTRA_CA_CERTS: /certs/custom-ca.pem
|
||||
volumes:
|
||||
# Mount the certs directory (read-only for security)
|
||||
- ./certs:/certs:ro
|
||||
depends_on:
|
||||
- redis
|
||||
- mongodb
|
||||
# Optional: Add healthcheck to ensure the server starts properly
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:52345/api/v1/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
@@ -1,35 +0,0 @@
|
||||
services:
|
||||
client:
|
||||
image: uptime_client:latest
|
||||
restart: always
|
||||
ports:
|
||||
- "80:80"
|
||||
environment:
|
||||
UPTIME_APP_API_BASE_URL: "http://localhost:52345/api/v1"
|
||||
UPTIME_APP_CLIENT_HOST: "http://localhost"
|
||||
volumes:
|
||||
- ./nginx/conf.d:/etc/nginx/conf.d/
|
||||
depends_on:
|
||||
- server
|
||||
server:
|
||||
image: uptime_server:latest
|
||||
restart: always
|
||||
ports:
|
||||
- "52345:52345"
|
||||
env_file:
|
||||
- server.env
|
||||
depends_on:
|
||||
- mongodb
|
||||
mongodb:
|
||||
image: uptime_mongo:latest
|
||||
restart: always
|
||||
command: ["mongod", "--quiet", "--bind_ip_all"]
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')", "--quiet"]
|
||||
interval: 5s
|
||||
timeout: 30s
|
||||
start_period: 0s
|
||||
start_interval: 1s
|
||||
retries: 30
|
||||
@@ -1,3 +0,0 @@
|
||||
FROM mongo
|
||||
EXPOSE 27017
|
||||
CMD ["mongod"]
|
||||
@@ -1,13 +0,0 @@
|
||||
# Dev/Test only: Not required in production
|
||||
# Docker Compose configuration for nginx test service
|
||||
|
||||
services:
|
||||
nginx-test:
|
||||
image: nginx:alpine
|
||||
ports:
|
||||
- "8443:443"
|
||||
volumes:
|
||||
- ../certs/host-int-cert.pem:/etc/nginx/certs/server.crt:ro
|
||||
- ../certs/host-int-key.pem:/etc/nginx/certs/server.key:ro
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
restart: unless-stopped
|
||||
@@ -1,14 +0,0 @@
|
||||
# Dev/Test only: Not required in production
|
||||
# Nginx configuration for testing custom CA trust functionality
|
||||
|
||||
events {}
|
||||
http {
|
||||
server {
|
||||
listen 443 ssl;
|
||||
ssl_certificate /etc/nginx/certs/server.crt;
|
||||
ssl_certificate_key /etc/nginx/certs/server.key;
|
||||
location / {
|
||||
return 200 "hello from tls\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
server {
|
||||
listen 80 default_server;
|
||||
listen [::]:80 default_server;
|
||||
|
||||
server_name localhost; # Set server name to localhost
|
||||
server_tokens off;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# location /api/ {
|
||||
# proxy_pass http://server:52345/api/;
|
||||
# proxy_http_version 1.1;
|
||||
# proxy_set_header Host $host;
|
||||
# proxy_set_header X-Real-IP $remote_addr;
|
||||
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
# proxy_set_header X-Forwarded-Proto $scheme;
|
||||
# proxy_set_header Connection '';
|
||||
# chunked_transfer_encoding off;
|
||||
# proxy_buffering off;
|
||||
# proxy_cache off;
|
||||
# }
|
||||
|
||||
# location /api-docs/ {
|
||||
# proxy_pass http://server:52345/api-docs/;
|
||||
# proxy_http_version 1.1;
|
||||
# proxy_set_header Host $host;
|
||||
# proxy_set_header X-Real-IP $remote_addr;
|
||||
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
# proxy_set_header X-Forwarded-Proto $scheme;
|
||||
# }
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
FROM node:20-slim
|
||||
|
||||
# Install ping
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y iputils-ping \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./server/package*.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY ./server/ ./
|
||||
|
||||
RUN npm run build
|
||||
|
||||
EXPOSE 52345
|
||||
|
||||
CMD ["node", "dist/index.js"]
|
||||
@@ -1,44 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e # Exit on error
|
||||
|
||||
# Change directory to root Server directory for correct Docker Context
|
||||
cd "$(dirname "$0")"
|
||||
cd ../..
|
||||
|
||||
# Ensure buildx builder exists and is used
|
||||
if ! docker buildx inspect mybuilder &>/dev/null; then
|
||||
docker buildx create --name mybuilder --use
|
||||
else
|
||||
docker buildx use mybuilder
|
||||
fi
|
||||
|
||||
# Define service names and Dockerfiles
|
||||
services=("mono_server_arm")
|
||||
dockerfiles=(
|
||||
"./docker/dist-arm/server.Dockerfile"
|
||||
)
|
||||
|
||||
# Static image name for GitHub Container Registry (GHCR)
|
||||
image="ghcr.io/bluewave-labs/checkmate:backend-dist-multi-arch"
|
||||
platforms="linux/amd64,linux/arm64"
|
||||
repo_url="https://github.com/bluewave-labs/checkmate"
|
||||
|
||||
# Loop through each service and build
|
||||
for i in "${!services[@]}"; do
|
||||
service="${services[$i]}"
|
||||
dockerfile="${dockerfiles[$i]}"
|
||||
|
||||
echo "🚀 Building multi-arch image for $service..."
|
||||
docker buildx build \
|
||||
--platform "$platforms" \
|
||||
-f "$dockerfile" \
|
||||
-t "$image" \
|
||||
--label "org.opencontainers.image.source=$repo_url" \
|
||||
--push \
|
||||
.
|
||||
|
||||
echo "✅ $image pushed for platforms: $platforms"
|
||||
done
|
||||
|
||||
echo "🎉 All multi-arch images built and pushed successfully"
|
||||
@@ -1,31 +0,0 @@
|
||||
services:
|
||||
server:
|
||||
image: ghcr.io/bluewave-labs/checkmate-backend-mono-multiarch:latest
|
||||
restart: always
|
||||
pull_policy: always
|
||||
ports:
|
||||
- "52345:52345"
|
||||
environment:
|
||||
- UPTIME_APP_API_BASE_URL=http://localhost:52345/api/v1
|
||||
- UPTIME_APP_CLIENT_HOST=http://localhost
|
||||
- DB_CONNECTION_STRING=mongodb://mongodb:27017/uptime_db
|
||||
- REDIS_URL=redis://redis:6379
|
||||
- CLIENT_HOST=http://localhost
|
||||
- JWT_SECRET=my_secret
|
||||
depends_on:
|
||||
- mongodb
|
||||
mongodb:
|
||||
image: mongo:4.4.18
|
||||
restart: always
|
||||
command: ["mongod", "--quiet", "--bind_ip_all"]
|
||||
ports:
|
||||
- "27017:27017"
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test: ["CMD", "mongo", "--eval", "db.runCommand({ ping: 1 })", "--quiet"]
|
||||
interval: 5s
|
||||
timeout: 30s
|
||||
start_period: 0s
|
||||
start_interval: 1s
|
||||
retries: 30
|
||||
@@ -1,46 +0,0 @@
|
||||
# ---------------------
|
||||
# Frontend build stage
|
||||
# ---------------------
|
||||
FROM node:24-slim AS frontend-build
|
||||
|
||||
|
||||
|
||||
WORKDIR /app/client
|
||||
|
||||
COPY client/package.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
RUN npm install esbuild@0.25.5 --build-from-source
|
||||
|
||||
COPY client ./
|
||||
|
||||
RUN npm run build
|
||||
|
||||
# ---------------------
|
||||
# Backend stage
|
||||
# ---------------------
|
||||
FROM node:24-slim AS backend
|
||||
|
||||
# Install ping
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y iputils-ping \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app/server
|
||||
|
||||
COPY server/package.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY server ./
|
||||
|
||||
RUN chmod +x ./scripts/inject-vars.sh
|
||||
|
||||
RUN npm run build
|
||||
|
||||
COPY --from=frontend-build /app/client/dist ./public
|
||||
|
||||
EXPOSE 52345
|
||||
|
||||
CMD ["sh", "-c", "./scripts/inject-vars.sh && node ./dist/index.js"]
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Change directory to root Server directory for correct Docker Context
|
||||
cd "$(dirname "$0")"
|
||||
cd ../..
|
||||
|
||||
# Define service names and their corresponding Dockerfiles in parallel arrays
|
||||
services=("mono_mongo" "mono_server")
|
||||
dockerfiles=(
|
||||
"./docker/dist-mono/mongoDB.Dockerfile"
|
||||
"./docker/dist-mono/server.Dockerfile"
|
||||
)
|
||||
|
||||
# Loop through each service and build the corresponding image
|
||||
for i in "${!services[@]}"; do
|
||||
service="${services[$i]}"
|
||||
dockerfile="${dockerfiles[$i]}"
|
||||
|
||||
docker build -f "$dockerfile" -t "$service" .
|
||||
|
||||
# Check if the build succeeded
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error building $service image. Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "All images built successfully"
|
||||
@@ -1,27 +0,0 @@
|
||||
services:
|
||||
server:
|
||||
image: mono_server
|
||||
restart: always
|
||||
ports:
|
||||
- "52345:52345"
|
||||
environment:
|
||||
- UPTIME_APP_API_BASE_URL=http://localhost:52345/api/v1
|
||||
- UPTIME_APP_CLIENT_HOST=http://localhost
|
||||
- DB_CONNECTION_STRING=mongodb://mongodb:27017/uptime_db
|
||||
- CLIENT_HOST=http://localhost
|
||||
- JWT_SECRET=my_secret
|
||||
depends_on:
|
||||
- mongodb
|
||||
mongodb:
|
||||
image: mono_mongo
|
||||
restart: always
|
||||
command: ["mongod", "--quiet", "--bind_ip_all"]
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')", "--quiet"]
|
||||
interval: 5s
|
||||
timeout: 30s
|
||||
start_period: 0s
|
||||
start_interval: 1s
|
||||
retries: 30
|
||||
@@ -1,28 +0,0 @@
|
||||
services:
|
||||
server:
|
||||
image: ghcr.io/bluewave-labs/checkmate-backend-mono:latest
|
||||
pull_policy: always
|
||||
restart: always
|
||||
ports:
|
||||
- "52345:52345"
|
||||
environment:
|
||||
- UPTIME_APP_API_BASE_URL=http://localhost:52345/api/v1
|
||||
- UPTIME_APP_CLIENT_HOST=http://localhost
|
||||
- DB_CONNECTION_STRING=mongodb://mongodb:27017/uptime_db
|
||||
- CLIENT_HOST=http://localhost
|
||||
- JWT_SECRET=my_secret
|
||||
depends_on:
|
||||
- mongodb
|
||||
mongodb:
|
||||
image: ghcr.io/bluewave-labs/checkmate-mongo:latest
|
||||
restart: always
|
||||
command: ["mongod", "--quiet", "--bind_ip_all"]
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
healthcheck:
|
||||
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')", "--quiet"]
|
||||
interval: 5s
|
||||
timeout: 30s
|
||||
start_period: 0s
|
||||
start_interval: 1s
|
||||
retries: 30
|
||||
@@ -1,3 +0,0 @@
|
||||
FROM mongo
|
||||
EXPOSE 27017
|
||||
CMD ["mongod"]
|
||||
@@ -1,33 +0,0 @@
|
||||
FROM node:20-slim AS frontend-build
|
||||
|
||||
WORKDIR /app/client
|
||||
|
||||
COPY client/package*.json ./
|
||||
RUN npm install
|
||||
|
||||
COPY client ./
|
||||
RUN npm run build
|
||||
|
||||
FROM node:20-slim AS app
|
||||
|
||||
# Install ping
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y iputils-ping \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app/server
|
||||
|
||||
COPY server ./
|
||||
|
||||
|
||||
RUN npm install
|
||||
|
||||
RUN npm run build
|
||||
|
||||
COPY --from=frontend-build /app/client/dist ./public
|
||||
|
||||
RUN chmod +x ./scripts/inject-vars.sh
|
||||
|
||||
EXPOSE 52345
|
||||
|
||||
CMD ./scripts/inject-vars.sh && node ./dist/index.js
|
||||
Vendored
-25
@@ -1,25 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Change directory to root Server directory for correct Docker Context
|
||||
cd "$(dirname "$0")"
|
||||
cd ../../
|
||||
|
||||
# Define an array of services and their Dockerfiles
|
||||
declare -A services=(
|
||||
["bluewaveuptime/uptime_client"]="./docker/dist/client.Dockerfile"
|
||||
["bluewaveuptime/uptime_database_mongo"]="./docker/dist/mongoDB.Dockerfile"
|
||||
["bluewaveuptime/uptime_server"]="./docker/dist/server.Dockerfile"
|
||||
)
|
||||
|
||||
for service in "${!services[@]}"; do
|
||||
docker build \
|
||||
-f "${services[$service]}" \
|
||||
-t "$service" \
|
||||
.
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error building $service image. Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "All images built successfully"
|
||||
Vendored
-22
@@ -1,22 +0,0 @@
|
||||
FROM node:20-slim AS build
|
||||
|
||||
ENV NODE_OPTIONS="--max-old-space-size=4096"
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./client/package*.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY ./client .
|
||||
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:1.27.1-alpine
|
||||
|
||||
COPY ./docker/dist/nginx/conf.d/default.conf /etc/nginx/conf.d/default.conf
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
COPY --from=build /app/env.sh /docker-entrypoint.d/env.sh
|
||||
RUN chmod +x /docker-entrypoint.d/env.sh
|
||||
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
Vendored
-38
@@ -1,38 +0,0 @@
|
||||
services:
|
||||
client:
|
||||
image: ghcr.io/bluewave-labs/checkmate-client:latest
|
||||
restart: always
|
||||
environment:
|
||||
UPTIME_APP_API_BASE_URL: "http://localhost:52345/api/v1"
|
||||
UPTIME_APP_CLIENT_HOST: "http://localhost"
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
depends_on:
|
||||
- server
|
||||
server:
|
||||
image: ghcr.io/bluewave-labs/checkmate-backend:latest
|
||||
restart: always
|
||||
ports:
|
||||
- "52345:52345"
|
||||
depends_on:
|
||||
- mongodb
|
||||
environment:
|
||||
- DB_CONNECTION_STRING=mongodb://mongodb:27017/uptime_db
|
||||
- CLIENT_HOST=http://localhost
|
||||
- JWT_SECRET=my_secret
|
||||
# volumes:
|
||||
# - /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
mongodb:
|
||||
image: ghcr.io/bluewave-labs/checkmate-mongo:latest
|
||||
restart: always
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
command: ["mongod", "--quiet", "--bind_ip_all"]
|
||||
healthcheck:
|
||||
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')", "--quiet"]
|
||||
interval: 5s
|
||||
timeout: 30s
|
||||
start_period: 0s
|
||||
start_interval: 1s
|
||||
retries: 30
|
||||
Vendored
-3
@@ -1,3 +0,0 @@
|
||||
FROM mongo
|
||||
EXPOSE 27017
|
||||
CMD ["mongod"]
|
||||
-35
@@ -1,35 +0,0 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name checkmate-demo.bluewavelabs.ca;
|
||||
server_tokens off;
|
||||
|
||||
location /.well-known/acme-challenge/ {
|
||||
root /var/www/certbot;
|
||||
}
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
# location /api/ {
|
||||
# proxy_pass http://server:5000/api/;
|
||||
# proxy_http_version 1.1;
|
||||
# proxy_set_header Host $host;
|
||||
# proxy_set_header X-Real-IP $remote_addr;
|
||||
# proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
# proxy_set_header X-Forwarded-Proto $scheme;
|
||||
# }
|
||||
|
||||
location /api-docs/ {
|
||||
proxy_pass http://server:5000/api-docs/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
Vendored
-20
@@ -1,20 +0,0 @@
|
||||
FROM node:20-slim
|
||||
|
||||
# Install ping
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y iputils-ping \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./server/package*.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY ./server/ ./
|
||||
|
||||
RUN npm run build
|
||||
|
||||
EXPOSE 52345
|
||||
|
||||
CMD ["node", "dist/index.js"]
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Change directory to root directory for correct Docker Context
|
||||
cd "$(dirname "$0")"
|
||||
cd ../../
|
||||
|
||||
# Define an array of services and their Dockerfiles
|
||||
declare -A services=(
|
||||
["uptime_client"]="./docker/prod/client.Dockerfile"
|
||||
["uptime_database_mongo"]="./docker/prod/mongoDB.Dockerfile"
|
||||
["uptime_server"]="./docker/prod/server.Dockerfile"
|
||||
)
|
||||
|
||||
# Loop through each service and build the corresponding image
|
||||
for service in "${!services[@]}"; do
|
||||
docker build -f "${services[$service]}" -t "$service" .
|
||||
|
||||
# Check if the build succeeded
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error building $service image. Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "All images built successfully"
|
||||
@@ -1,19 +0,0 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
webserver:
|
||||
image: nginx:latest
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
restart: always
|
||||
volumes:
|
||||
- ./nginx/conf.d/:/etc/nginx/conf.d/:ro
|
||||
- ./certbot/www/:/var/www/certbot/:ro
|
||||
certbot:
|
||||
image: certbot/certbot:latest
|
||||
volumes:
|
||||
- ./certbot/www/:/var/www/certbot/:rw
|
||||
- ./certbot/conf/:/etc/letsencrypt/:rw
|
||||
depends_on:
|
||||
- webserver
|
||||
@@ -1,20 +0,0 @@
|
||||
FROM node:20-slim AS build
|
||||
|
||||
ENV NODE_OPTIONS="--max-old-space-size=4096"
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./client/package*.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY ./client .
|
||||
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:1.27.1-alpine
|
||||
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
COPY --from=build /app/env.sh /docker-entrypoint.d/env.sh
|
||||
RUN chmod +x /docker-entrypoint.d/env.sh
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
@@ -1,62 +0,0 @@
|
||||
services:
|
||||
client:
|
||||
image: ghcr.io/bluewave-labs/checkmate:frontend-demo
|
||||
restart: always
|
||||
environment:
|
||||
UPTIME_APP_API_BASE_URL: "https://checkmate-demo.bluewavelabs.ca/api/v1"
|
||||
UPTIME_APP_CLIENT_HOST: "https://checkmate-demo.bluewavelabs.ca"
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
depends_on:
|
||||
- server
|
||||
volumes:
|
||||
- ./nginx/conf.d:/etc/nginx/conf.d/:ro
|
||||
- ./certbot/www:/var/www/certbot/:ro
|
||||
- ./certbot/conf/:/etc/nginx/ssl/:ro
|
||||
|
||||
certbot:
|
||||
image: certbot/certbot:latest
|
||||
restart: always
|
||||
volumes:
|
||||
- ./certbot/www/:/var/www/certbot/:rw
|
||||
- ./certbot/conf/:/etc/letsencrypt/:rw
|
||||
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew --webroot -w /var/www/certbot; sleep 12h & wait $${!}; done;'"
|
||||
|
||||
server:
|
||||
image: ghcr.io/bluewave-labs/checkmate:backend-demo
|
||||
restart: always
|
||||
ports:
|
||||
- "52345:52345"
|
||||
env_file:
|
||||
- server.env
|
||||
depends_on:
|
||||
- mongodb
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
mongodb:
|
||||
image: ghcr.io/bluewave-labs/checkmate:mongo-demo
|
||||
restart: always
|
||||
command: ["mongod", "--quiet", "--bind_ip_all"]
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
env_file:
|
||||
- mongo.env
|
||||
healthcheck:
|
||||
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')", "--quiet"]
|
||||
interval: 5s
|
||||
timeout: 30s
|
||||
start_period: 0s
|
||||
start_interval: 1s
|
||||
retries: 30
|
||||
capture:
|
||||
image: ghcr.io/bluewave-labs/capture:latest
|
||||
container_name: capture
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "59232:59232"
|
||||
environment:
|
||||
- API_SECRET=my_secret
|
||||
- GIN_MODE=release
|
||||
volumes:
|
||||
- /etc/os-release:/etc/os-release:ro
|
||||
@@ -1,41 +0,0 @@
|
||||
function initiateReplicaSet() {
|
||||
try {
|
||||
rs.initiate({
|
||||
_id: "rs0",
|
||||
members: [{ _id: 0, host: "localhost:27017" }],
|
||||
});
|
||||
} catch (e) {
|
||||
print("Replica set already initiated or error occurred: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
function waitForPrimary() {
|
||||
while (true) {
|
||||
const isMaster = db.isMaster();
|
||||
if (isMaster.ismaster) {
|
||||
print("This node is now PRIMARY.");
|
||||
break;
|
||||
}
|
||||
print("Waiting to become PRIMARY...");
|
||||
sleep(2000);
|
||||
}
|
||||
}
|
||||
|
||||
function createUser() {
|
||||
db = db.getSiblingDB("uptime_db");
|
||||
|
||||
var username = process.env.USERNAME_ENV_VAR;
|
||||
var password = process.env.PASSWORD_ENV_VAR;
|
||||
|
||||
db.createUser({
|
||||
user: username,
|
||||
pwd: password,
|
||||
roles: [{ role: "readWrite", db: "uptime_db" }],
|
||||
});
|
||||
|
||||
print("User '" + username + "' created successfully");
|
||||
}
|
||||
|
||||
initiateReplicaSet();
|
||||
waitForPrimary();
|
||||
createUser();
|
||||
@@ -1,3 +0,0 @@
|
||||
FROM mongo
|
||||
EXPOSE 27017
|
||||
CMD ["mongod"]
|
||||
@@ -1,15 +0,0 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name checkmate-demo.bluewavelabs.ca www.checkmate-demo.bluewavelabs.ca;
|
||||
server_tokens off;
|
||||
|
||||
location /.well-known/acme-challenge/ {
|
||||
root /var/www/certbot;
|
||||
}
|
||||
|
||||
location / {
|
||||
return 301 https://[domain-name]$request_uri;
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name checkmate-demo.bluewavelabs.ca;
|
||||
server_tokens off;
|
||||
|
||||
location /.well-known/acme-challenge/ {
|
||||
root /var/www/certbot;
|
||||
}
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://server:52345/api/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location /api-docs/ {
|
||||
proxy_pass http://server:52345/api-docs/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 default_server ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
|
||||
server_name checkmate-demo.bluewavelabs.ca;
|
||||
|
||||
ssl_certificate /etc/nginx/ssl/live/checkmate-demo.bluewavelabs.ca/fullchain.pem;
|
||||
ssl_certificate_key /etc/nginx/ssl/live/checkmate-demo.bluewavelabs.ca/privkey.pem;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://server:52345/api/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
location /api-docs/ {
|
||||
proxy_pass http://server:52345/api-docs/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
FROM node:20-slim
|
||||
|
||||
# Install ping
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y iputils-ping \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV NODE_OPTIONS="--max-old-space-size=2048"
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./server/package*.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY ./server ./
|
||||
|
||||
RUN npm run build
|
||||
|
||||
EXPOSE 52345
|
||||
|
||||
CMD ["node", "src/index.js"]
|
||||
@@ -1,25 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Change directory to root directory for correct Docker Context
|
||||
cd "$(dirname "$0")"
|
||||
cd ../../
|
||||
|
||||
# Define an array of services and their Dockerfiles
|
||||
declare -A services=(
|
||||
["uptime_client"]="./docker/staging/client.Dockerfile"
|
||||
["uptime_database_mongo"]="./docker/staging/mongoDB.Dockerfile"
|
||||
["uptime_server"]="./docker/staging/server.Dockerfile"
|
||||
)
|
||||
|
||||
# Loop through each service and build the corresponding image
|
||||
for service in "${!services[@]}"; do
|
||||
docker build -f "${services[$service]}" -t "$service" .
|
||||
|
||||
# Check if the build succeeded
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error building $service image. Exiting..."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "All images built successfully"
|
||||
@@ -1,19 +0,0 @@
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
webserver:
|
||||
image: nginx:latest
|
||||
ports:
|
||||
- 80:80
|
||||
- 443:443
|
||||
restart: always
|
||||
volumes:
|
||||
- ./nginx/conf.d/:/etc/nginx/conf.d/:ro
|
||||
- ./certbot/www/:/var/www/certbot/:ro
|
||||
certbot:
|
||||
image: certbot/certbot:latest
|
||||
volumes:
|
||||
- ./certbot/www/:/var/www/certbot/:rw
|
||||
- ./certbot/conf/:/etc/letsencrypt/:rw
|
||||
depends_on:
|
||||
- webserver
|
||||
@@ -1,20 +0,0 @@
|
||||
FROM node:20-slim AS build
|
||||
|
||||
ENV NODE_OPTIONS="--max-old-space-size=4096"
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./client/package*.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY ./client ./
|
||||
|
||||
RUN npm run build
|
||||
|
||||
FROM nginx:1.27.1-alpine
|
||||
|
||||
COPY --from=build /app/dist /usr/share/nginx/html
|
||||
COPY --from=build /app/env.sh /docker-entrypoint.d/env.sh
|
||||
RUN chmod +x /docker-entrypoint.d/env.sh
|
||||
CMD ["nginx", "-g", "daemon off;"]
|
||||
@@ -1,62 +0,0 @@
|
||||
services:
|
||||
client:
|
||||
image: ghcr.io/bluewave-labs/checkmate:frontend-staging
|
||||
restart: always
|
||||
environment:
|
||||
UPTIME_APP_API_BASE_URL: "https://checkmate-test.bluewavelabs.ca/api/v1"
|
||||
UPTIME_APP_CLIENT_HOST: "https://checkmate-test.bluewavelabs.ca"
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
depends_on:
|
||||
- server
|
||||
volumes:
|
||||
- ./nginx/conf.d:/etc/nginx/conf.d/:ro
|
||||
- ./certbot/www:/var/www/certbot/:ro
|
||||
- ./certbot/conf/:/etc/nginx/ssl/:ro
|
||||
|
||||
certbot:
|
||||
image: certbot/certbot:latest
|
||||
restart: always
|
||||
volumes:
|
||||
- ./certbot/www/:/var/www/certbot/:rw
|
||||
- ./certbot/conf/:/etc/letsencrypt/:rw
|
||||
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew --webroot -w /var/www/certbot; sleep 12h & wait $${!}; done;'"
|
||||
|
||||
server:
|
||||
image: ghcr.io/bluewave-labs/checkmate:backend-staging
|
||||
restart: always
|
||||
ports:
|
||||
- "52345:52345"
|
||||
env_file:
|
||||
- server.env
|
||||
depends_on:
|
||||
- mongodb
|
||||
mongodb:
|
||||
image: ghcr.io/bluewave-labs/checkmate:mongo-staging
|
||||
restart: always
|
||||
command: ["mongod", "--quiet", "--bind_ip_all"]
|
||||
ports:
|
||||
- "27017:27017"
|
||||
volumes:
|
||||
- ./mongo/data:/data/db
|
||||
env_file:
|
||||
- mongo.env
|
||||
healthcheck:
|
||||
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')", "--quiet"]
|
||||
interval: 5s
|
||||
timeout: 30s
|
||||
start_period: 0s
|
||||
start_interval: 1s
|
||||
retries: 30
|
||||
capture:
|
||||
image: ghcr.io/bluewave-labs/capture:latest
|
||||
container_name: capture
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "59232:59232"
|
||||
environment:
|
||||
- API_SECRET=my_secret
|
||||
- GIN_MODE=release
|
||||
volumes:
|
||||
- /etc/os-release:/etc/os-release:ro
|
||||
@@ -1,15 +0,0 @@
|
||||
try {
|
||||
const status = rs.status();
|
||||
printjson(status);
|
||||
} catch (e) {
|
||||
if (e.codeName === "NotYetInitialized") {
|
||||
print("Replica set not initialized. Initiating...");
|
||||
rs.initiate({
|
||||
_id: "rs0",
|
||||
members: [{ _id: 0, host: "mongodb:27017" }],
|
||||
});
|
||||
} else {
|
||||
print("Unexpected error during rs.status():");
|
||||
printjson(e);
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
var username = process.env.USERNAME_ENV_VAR;
|
||||
var password = process.env.PASSWORD_ENV_VAR;
|
||||
|
||||
db = db.getSiblingDB("uptime_db");
|
||||
|
||||
db.createUser({
|
||||
user: username,
|
||||
pwd: password,
|
||||
roles: [
|
||||
{
|
||||
role: "readWrite",
|
||||
db: "uptime_db",
|
||||
},
|
||||
],
|
||||
});
|
||||
print("User uptime_user created successfully");
|
||||
@@ -1,3 +0,0 @@
|
||||
FROM mongo
|
||||
EXPOSE 27017
|
||||
CMD ["mongod"]
|
||||
@@ -1,15 +0,0 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name checkmate-test.bluewavelabs.ca www.checkmate-test.bluewavelabs.ca;
|
||||
server_tokens off;
|
||||
|
||||
location /.well-known/acme-challenge/ {
|
||||
root /var/www/certbot;
|
||||
}
|
||||
|
||||
location / {
|
||||
return 301 https://[domain-name]$request_uri;
|
||||
}
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name checkmate-test.bluewavelabs.ca;
|
||||
server_tokens off;
|
||||
|
||||
location /.well-known/acme-challenge/ {
|
||||
root /var/www/certbot;
|
||||
}
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://server:52345/api/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Connection '';
|
||||
chunked_transfer_encoding off;
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
}
|
||||
|
||||
location /api-docs/ {
|
||||
proxy_pass http://server:52345/api-docs/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 default_server ssl http2;
|
||||
listen [::]:443 ssl http2;
|
||||
|
||||
server_name checkmate-test.bluewavelabs.ca;
|
||||
|
||||
ssl_certificate /etc/nginx/ssl/live/checkmate-test.bluewavelabs.ca/fullchain.pem;
|
||||
ssl_certificate_key /etc/nginx/ssl/live/checkmate-test.bluewavelabs.ca/privkey.pem;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ /index.html;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_pass http://server:52345/api/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header Connection '';
|
||||
chunked_transfer_encoding off;
|
||||
proxy_buffering off;
|
||||
proxy_cache off;
|
||||
}
|
||||
|
||||
location /api-docs/ {
|
||||
proxy_pass http://server:52345/api-docs/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
FROM node:20-slim
|
||||
|
||||
# Install ping
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y iputils-ping \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV NODE_OPTIONS="--max-old-space-size=2048"
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY ./server/package*.json ./
|
||||
|
||||
RUN npm install
|
||||
|
||||
COPY ./server ./
|
||||
|
||||
RUN npm run build
|
||||
|
||||
EXPOSE 52345
|
||||
|
||||
CMD ["node", "dist/index.js"]
|
||||
@@ -0,0 +1,6 @@
|
||||
window.__ENV = {
|
||||
GLOBAL_REFRESH: "60000",
|
||||
APP_HOST: "https://checkmate-ng.checkmate.so",
|
||||
APP_API_BASE_URL: "https://checkmate-ng.checkmate.so/api/v1",
|
||||
APP_DEPLOYMENT_MODE: "self_hosted",
|
||||
};
|
||||
@@ -1,143 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Dev/Test only: Not required in production
|
||||
# This script generates test certificates for development and testing purposes
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Colors for output
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Configuration
|
||||
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||
CERTS_DIR="$REPO_ROOT/docker/dev/certs"
|
||||
|
||||
# Function to print colored output
|
||||
print_status() {
|
||||
local status=$1
|
||||
local message=$2
|
||||
case $status in
|
||||
"PASS")
|
||||
echo -e "${GREEN}[PASS]${NC} $message"
|
||||
;;
|
||||
"INFO")
|
||||
echo -e "${BLUE}[INFO]${NC} $message"
|
||||
;;
|
||||
"WARN")
|
||||
echo -e "${YELLOW}[WARN]${NC} $message"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Function to check if a command exists
|
||||
command_exists() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# Function to generate certificates using mkcert
|
||||
generate_certs_mkcert() {
|
||||
print_status "INFO" "Generating certificates using mkcert..."
|
||||
|
||||
# Install mkcert CA (ignore if already done)
|
||||
mkcert -install 2>/dev/null || true
|
||||
|
||||
# Copy root CA
|
||||
local ca_root
|
||||
ca_root=$(mkcert -CAROOT)
|
||||
cp "$ca_root/rootCA.pem" "$CERTS_DIR/custom-ca.pem"
|
||||
|
||||
# Generate server certificate
|
||||
mkcert -key-file "$CERTS_DIR/host-int-key.pem" \
|
||||
-cert-file "$CERTS_DIR/host-int-cert.pem" \
|
||||
host.docker.internal
|
||||
|
||||
print_status "PASS" "Certificates generated using mkcert"
|
||||
}
|
||||
|
||||
# Function to generate certificates using OpenSSL
|
||||
generate_certs_openssl() {
|
||||
print_status "INFO" "Generating certificates using OpenSSL..."
|
||||
|
||||
# Create CA private key
|
||||
openssl genrsa -out "$CERTS_DIR/ca.key" 2048
|
||||
|
||||
# Create CA certificate
|
||||
openssl req -new -x509 -days 365 -key "$CERTS_DIR/ca.key" \
|
||||
-out "$CERTS_DIR/custom-ca.pem" \
|
||||
-subj "/C=US/ST=Test/L=Test/O=Test CA/CN=Test Root CA"
|
||||
|
||||
# Create server private key
|
||||
openssl genrsa -out "$CERTS_DIR/host-int-key.pem" 2048
|
||||
|
||||
# Create server certificate signing request
|
||||
openssl req -new -key "$CERTS_DIR/host-int-key.pem" \
|
||||
-out "$CERTS_DIR/host-int-cert.csr" \
|
||||
-subj "/C=US/ST=Test/L=Test/O=Test/CN=host.docker.internal"
|
||||
|
||||
# Create extfile for SAN
|
||||
cat > "$CERTS_DIR/san.ext" << EOF
|
||||
subjectAltName=DNS:host.docker.internal,IP:127.0.0.1
|
||||
EOF
|
||||
|
||||
# Sign server certificate with CA
|
||||
openssl x509 -req -days 365 \
|
||||
-in "$CERTS_DIR/host-int-cert.csr" \
|
||||
-CA "$CERTS_DIR/custom-ca.pem" \
|
||||
-CAkey "$CERTS_DIR/ca.key" \
|
||||
-CAcreateserial \
|
||||
-out "$CERTS_DIR/host-int-cert.pem" \
|
||||
-extfile "$CERTS_DIR/san.ext"
|
||||
|
||||
# Clean up temporary files
|
||||
rm -f "$CERTS_DIR/ca.key" "$CERTS_DIR/host-int-cert.csr" "$CERTS_DIR/san.ext" "$CERTS_DIR/.srl"
|
||||
|
||||
print_status "PASS" "Certificates generated using OpenSSL"
|
||||
}
|
||||
|
||||
# Main function
|
||||
main() {
|
||||
print_status "INFO" "Setting up custom CA certificates for Checkmate testing"
|
||||
echo "================================================================"
|
||||
|
||||
# Create certs directory if missing
|
||||
print_status "INFO" "Creating certificates directory..."
|
||||
mkdir -p "$CERTS_DIR"
|
||||
|
||||
# Generate certificates
|
||||
if command_exists mkcert; then
|
||||
generate_certs_mkcert
|
||||
else
|
||||
print_status "WARN" "mkcert not found, falling back to OpenSSL"
|
||||
generate_certs_openssl
|
||||
fi
|
||||
|
||||
# Create duplicate for compatibility with existing overrides
|
||||
print_status "INFO" "Creating duplicate CA file for compatibility..."
|
||||
cp "$CERTS_DIR/custom-ca.pem" "$CERTS_DIR/smallstep-root-ca.pem"
|
||||
|
||||
# Verify certificates exist
|
||||
if [ ! -f "$CERTS_DIR/custom-ca.pem" ] || [ ! -f "$CERTS_DIR/host-int-cert.pem" ] || [ ! -f "$CERTS_DIR/host-int-key.pem" ]; then
|
||||
echo "Error: Failed to generate required certificates"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Print summary
|
||||
echo ""
|
||||
print_status "PASS" "All required certificates generated successfully"
|
||||
echo ""
|
||||
echo "Certificate summary:"
|
||||
echo "===================="
|
||||
ls -l "$CERTS_DIR"
|
||||
echo ""
|
||||
echo "CA certificate preview:"
|
||||
echo "======================"
|
||||
head -3 "$CERTS_DIR/custom-ca.pem"
|
||||
echo ""
|
||||
print_status "INFO" "Certificates are ready for use with Checkmate custom CA trust"
|
||||
}
|
||||
|
||||
# Run main function
|
||||
main "$@"
|
||||
@@ -1,454 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Dev/Test only: Not required in production
|
||||
# This script tests the custom CA trust functionality in development environment
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Configuration
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
DEV_DIR="${ROOT_DIR}/docker/dev"
|
||||
CERT_DIR="${DEV_DIR}/certs"
|
||||
NGINX_DIR="${DEV_DIR}/nginx-test"
|
||||
COMPOSE_BASELINE="${DEV_DIR}/docker-compose.yaml"
|
||||
COMPOSE_CUSTOM_CA="${DEV_DIR}/docker-compose.custom-ca-example.yaml"
|
||||
COMPOSE_NGINX_TEST="${NGINX_DIR}/docker-compose.nginx-test.yaml"
|
||||
|
||||
# Test configuration
|
||||
NGINX_PORT=8443
|
||||
CHECKMATE_PORT=52345
|
||||
HEALTH_ENDPOINT="http://localhost:$CHECKMATE_PORT/api/v1/health"
|
||||
TEST_URL="https://host.docker.internal:$NGINX_PORT"
|
||||
MAX_WAIT=60
|
||||
WAIT_INTERVAL=2
|
||||
|
||||
# Global flag for cleanup behavior
|
||||
CLEAN_CERTS=false
|
||||
|
||||
# Function to print colored output
|
||||
print_status() {
|
||||
local status=$1
|
||||
local message=$2
|
||||
case $status in
|
||||
"PASS")
|
||||
echo -e "${GREEN}[PASS]${NC} $message"
|
||||
;;
|
||||
"FAIL")
|
||||
echo -e "${RED}[FAIL]${NC} $message"
|
||||
;;
|
||||
"INFO")
|
||||
echo -e "${BLUE}[INFO]${NC} $message"
|
||||
;;
|
||||
"WARN")
|
||||
echo -e "${YELLOW}[WARN]${NC} $message"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Function to check if a command exists
|
||||
command_exists() {
|
||||
command -v "$1" >/dev/null 2>&1
|
||||
}
|
||||
|
||||
# Function to check if certificates exist and are valid
|
||||
check_certificates() {
|
||||
local ca_file="${CERT_DIR}/custom-ca.pem"
|
||||
local cert_file="${CERT_DIR}/host-int-cert.pem"
|
||||
local key_file="${CERT_DIR}/host-int-key.pem"
|
||||
|
||||
if [ ! -f "$ca_file" ] || [ ! -f "$cert_file" ] || [ ! -f "$key_file" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Check if files are not empty
|
||||
if [ ! -s "$ca_file" ] || [ ! -s "$cert_file" ] || [ ! -s "$key_file" ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Check if CA file starts with BEGIN CERTIFICATE
|
||||
if ! head -1 "$ca_file" | grep -q "BEGIN CERTIFICATE"; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
# Function to wait for service to be ready
|
||||
wait_for_service() {
|
||||
local url=$1
|
||||
local service_name=$2
|
||||
local elapsed=0
|
||||
|
||||
print_status "INFO" "Waiting for $service_name to be ready..."
|
||||
|
||||
while [ $elapsed -lt $MAX_WAIT ]; do
|
||||
if curl -s -f "$url" >/dev/null 2>&1; then
|
||||
print_status "PASS" "$service_name is ready after ${elapsed}s"
|
||||
return 0
|
||||
fi
|
||||
|
||||
sleep $WAIT_INTERVAL
|
||||
elapsed=$((elapsed + WAIT_INTERVAL))
|
||||
echo -n "."
|
||||
done
|
||||
|
||||
print_status "FAIL" "$service_name failed to start within ${MAX_WAIT}s"
|
||||
return 1
|
||||
}
|
||||
|
||||
# Function to get container name by image
|
||||
get_container_name() {
|
||||
local image_name=$1
|
||||
docker ps --filter "ancestor=$image_name" --format "{{.Names}}" | head -n1
|
||||
}
|
||||
|
||||
# Function to run Node.js probe test
|
||||
run_probe_test() {
|
||||
local container_name=$1
|
||||
local test_name=$2
|
||||
local expected_exit_code=$3
|
||||
|
||||
print_status "INFO" "Running $test_name probe test..."
|
||||
|
||||
local probe_script="
|
||||
const https = require('https');
|
||||
https.get('https://host.docker.internal:8443', res => {
|
||||
console.log('STATUS', res.statusCode);
|
||||
process.exit(res.statusCode===200?0:1);
|
||||
}).on('error', e => {
|
||||
console.error('ERR', e.code||e.message);
|
||||
process.exit(1);
|
||||
});
|
||||
"
|
||||
|
||||
local exit_code
|
||||
if docker exec -i "$container_name" node -e "$probe_script" 2>/dev/null; then
|
||||
exit_code=$?
|
||||
else
|
||||
exit_code=$?
|
||||
fi
|
||||
|
||||
if [ $exit_code -eq $expected_exit_code ]; then
|
||||
print_status "PASS" "$test_name probe test completed with expected exit code $expected_exit_code"
|
||||
return 0
|
||||
else
|
||||
print_status "FAIL" "$test_name probe test failed with exit code $exit_code (expected $expected_exit_code)"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to setup certificates if needed
|
||||
setup_certificates_if_needed() {
|
||||
if check_certificates; then
|
||||
print_status "INFO" "Certificates already exist and are valid, skipping generation"
|
||||
return 0
|
||||
fi
|
||||
|
||||
print_status "INFO" "Certificates missing or invalid, generating new ones..."
|
||||
if [ -x "${ROOT_DIR}/scripts/dev/setup-custom-ca.sh" ]; then
|
||||
"${ROOT_DIR}/scripts/dev/setup-custom-ca.sh"
|
||||
else
|
||||
print_status "FAIL" "Certificate setup script not found at scripts/dev/setup-custom-ca.sh"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to create nginx test configuration
|
||||
create_nginx_test_config() {
|
||||
print_status "INFO" "Setting up nginx test configuration..."
|
||||
|
||||
mkdir -p "$NGINX_DIR"
|
||||
|
||||
# Create nginx.conf if it doesn't exist
|
||||
if [ ! -f "${NGINX_DIR}/nginx.conf" ]; then
|
||||
cat > "${NGINX_DIR}/nginx.conf" << 'EOF'
|
||||
events {}
|
||||
http {
|
||||
server {
|
||||
listen 443 ssl;
|
||||
ssl_certificate /etc/nginx/certs/server.crt;
|
||||
ssl_certificate_key /etc/nginx/certs/server.key;
|
||||
location / {
|
||||
return 200 "hello from tls\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
|
||||
# Create docker-compose.nginx-test.yaml if it doesn't exist
|
||||
if [ ! -f "$COMPOSE_NGINX_TEST" ]; then
|
||||
cat > "$COMPOSE_NGINX_TEST" << EOF
|
||||
services:
|
||||
nginx-test:
|
||||
image: nginx:alpine
|
||||
ports:
|
||||
- "$NGINX_PORT:443"
|
||||
volumes:
|
||||
- ../certs/host-int-cert.pem:/etc/nginx/certs/server.crt:ro
|
||||
- ../certs/host-int-key.pem:/etc/nginx/certs/server.key:ro
|
||||
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
restart: unless-stopped
|
||||
EOF
|
||||
fi
|
||||
|
||||
print_status "PASS" "Nginx test configuration created"
|
||||
}
|
||||
|
||||
# Function to start nginx test service
|
||||
start_nginx_test() {
|
||||
print_status "INFO" "Starting nginx test service..."
|
||||
|
||||
cd "$NGINX_DIR"
|
||||
docker-compose -f docker-compose.nginx-test.yaml up -d
|
||||
|
||||
# Wait for nginx to be ready
|
||||
local elapsed=0
|
||||
while [ $elapsed -lt $MAX_WAIT ]; do
|
||||
if curl -s -f -k "https://localhost:$NGINX_PORT" >/dev/null 2>&1; then
|
||||
print_status "PASS" "Nginx test service is ready"
|
||||
cd "$ROOT_DIR"
|
||||
return 0
|
||||
fi
|
||||
|
||||
sleep $WAIT_INTERVAL
|
||||
elapsed=$((elapsed + WAIT_INTERVAL))
|
||||
echo -n "."
|
||||
done
|
||||
|
||||
print_status "FAIL" "Nginx test service failed to start"
|
||||
cd "$ROOT_DIR"
|
||||
return 1
|
||||
}
|
||||
|
||||
# Function to stop nginx test service
|
||||
stop_nginx_test() {
|
||||
print_status "INFO" "Stopping nginx test service..."
|
||||
cd "$NGINX_DIR"
|
||||
docker-compose -f docker-compose.nginx-test.yaml down 2>/dev/null || true
|
||||
cd "$ROOT_DIR"
|
||||
}
|
||||
|
||||
# Function to run baseline test
|
||||
run_baseline_test() {
|
||||
print_status "INFO" "Running baseline test (should fail due to unknown CA)..."
|
||||
|
||||
# Start baseline Checkmate
|
||||
cd "$DEV_DIR"
|
||||
docker-compose -f docker-compose.yaml up -d --build
|
||||
|
||||
# Wait for Checkmate to be ready
|
||||
if ! wait_for_service "$HEALTH_ENDPOINT" "Checkmate baseline"; then
|
||||
cd "$ROOT_DIR"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Get container name
|
||||
local container_name
|
||||
container_name=$(get_container_name "uptime_server")
|
||||
if [ -z "$container_name" ]; then
|
||||
print_status "FAIL" "Could not find Checkmate server container"
|
||||
cd "$ROOT_DIR"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Run probe test (should fail)
|
||||
if run_probe_test "$container_name" "baseline" 1; then
|
||||
print_status "PASS" "Baseline test completed - TLS failure as expected"
|
||||
cd "$ROOT_DIR"
|
||||
return 0
|
||||
else
|
||||
print_status "FAIL" "Baseline test failed - unexpected behavior"
|
||||
cd "$ROOT_DIR"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to run custom CA test
|
||||
run_custom_ca_test() {
|
||||
print_status "INFO" "Running custom CA test (should succeed)..."
|
||||
|
||||
# Stop baseline Checkmate
|
||||
cd "$DEV_DIR"
|
||||
docker-compose -f docker-compose.yaml down
|
||||
|
||||
# Start Checkmate with custom CA
|
||||
docker-compose -f docker-compose.yaml -f docker-compose.custom-ca-example.yaml up -d --build
|
||||
|
||||
# Wait for Checkmate to be ready
|
||||
if ! wait_for_service "$HEALTH_ENDPOINT" "Checkmate custom CA"; then
|
||||
cd "$ROOT_DIR"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Get container name
|
||||
local container_name
|
||||
container_name=$(get_container_name "uptime_server")
|
||||
if [ -z "$container_name" ]; then
|
||||
print_status "FAIL" "Could not find Checkmate server container"
|
||||
cd "$ROOT_DIR"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Run probe test (should succeed)
|
||||
if run_probe_test "$container_name" "custom CA" 0; then
|
||||
print_status "PASS" "Custom CA test completed - TLS success as expected"
|
||||
cd "$ROOT_DIR"
|
||||
return 0
|
||||
else
|
||||
print_status "FAIL" "Custom CA test failed - unexpected behavior"
|
||||
cd "$ROOT_DIR"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Function to cleanup everything
|
||||
cleanup() {
|
||||
print_status "INFO" "Cleaning up test environment..."
|
||||
|
||||
# Stop all services
|
||||
cd "$DEV_DIR"
|
||||
docker-compose -f docker-compose.yaml down 2>/dev/null || true
|
||||
docker-compose -f docker-compose.yaml -f docker-compose.custom-ca-example.yaml down 2>/dev/null || true
|
||||
|
||||
stop_nginx_test
|
||||
|
||||
# Only remove certificates if --clean was specified
|
||||
if [ "$CLEAN_CERTS" = true ]; then
|
||||
print_status "INFO" "Removing certificates as requested with --clean"
|
||||
rm -rf "${CERT_DIR:?}"/*
|
||||
else
|
||||
print_status "INFO" "Preserving certificates for future test runs"
|
||||
fi
|
||||
|
||||
cd "$ROOT_DIR"
|
||||
print_status "PASS" "Cleanup completed"
|
||||
}
|
||||
|
||||
# Function to show usage
|
||||
show_usage() {
|
||||
echo "Usage: $0 [OPTIONS]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --clean Clean up all test containers and certificates"
|
||||
echo " --help Show this help message"
|
||||
echo ""
|
||||
echo "This script tests the custom CA trust functionality in Checkmate."
|
||||
}
|
||||
|
||||
# Main function
|
||||
main() {
|
||||
local clean_only=false
|
||||
|
||||
# Parse command line arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--clean)
|
||||
clean_only=true
|
||||
CLEAN_CERTS=true
|
||||
shift
|
||||
;;
|
||||
--help)
|
||||
show_usage
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
show_usage
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
print_status "INFO" "Starting Checkmate Custom CA Trust Test"
|
||||
echo "=================================================="
|
||||
|
||||
if [ "$clean_only" = true ]; then
|
||||
cleanup
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Check prerequisites
|
||||
if ! command_exists docker; then
|
||||
print_status "FAIL" "Docker is not installed or not in PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! command_exists docker-compose; then
|
||||
print_status "FAIL" "docker-compose is not installed or not in PATH"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if required files exist
|
||||
if [ ! -f "$COMPOSE_BASELINE" ]; then
|
||||
print_status "FAIL" "Baseline docker-compose.yaml not found at $COMPOSE_BASELINE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "$COMPOSE_CUSTOM_CA" ]; then
|
||||
print_status "FAIL" "Custom CA docker-compose override not found at $COMPOSE_CUSTOM_CA"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Setup test environment
|
||||
setup_certificates_if_needed
|
||||
create_nginx_test_config
|
||||
start_nginx_test
|
||||
|
||||
# Run tests
|
||||
local baseline_result=false
|
||||
local custom_ca_result=false
|
||||
|
||||
if run_baseline_test; then
|
||||
baseline_result=true
|
||||
fi
|
||||
|
||||
if run_custom_ca_test; then
|
||||
custom_ca_result=true
|
||||
fi
|
||||
|
||||
# Print summary
|
||||
echo ""
|
||||
echo "=================================================="
|
||||
print_status "INFO" "Test Summary"
|
||||
echo "=================================================="
|
||||
|
||||
if [ "$baseline_result" = true ]; then
|
||||
print_status "PASS" "Baseline: TLS failure as expected"
|
||||
else
|
||||
print_status "FAIL" "Baseline: Unexpected behavior"
|
||||
fi
|
||||
|
||||
if [ "$custom_ca_result" = true ]; then
|
||||
print_status "PASS" "Custom CA: TLS success (STATUS 200)"
|
||||
else
|
||||
print_status "FAIL" "Custom CA: Unexpected behavior"
|
||||
fi
|
||||
|
||||
if [ "$baseline_result" = true ] && [ "$custom_ca_result" = true ]; then
|
||||
echo ""
|
||||
print_status "PASS" "All tests passed! Custom CA trust is working correctly."
|
||||
echo ""
|
||||
print_status "INFO" "To clean up, run: $0 --clean"
|
||||
exit 0
|
||||
else
|
||||
echo ""
|
||||
print_status "FAIL" "Some tests failed. Custom CA trust may not be working correctly."
|
||||
echo ""
|
||||
print_status "INFO" "To clean up, run: $0 --clean"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Trap cleanup on script exit
|
||||
trap cleanup EXIT
|
||||
|
||||
# Run main function
|
||||
main "$@"
|
||||
Reference in new issue
Block a user