Added deployment capabilities

This commit is contained in:
mdnapo 2024-07-17 23:20:07 +02:00
parent 777b0fccc8
commit 577d61ed42
8 changed files with 197 additions and 33 deletions

3
docs/.gitignore vendored
View File

@ -18,3 +18,6 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.k8s/remote*.yml
!.k8s/remote.example.yml

61
docs/.k8s/local.yml Normal file
View File

@ -0,0 +1,61 @@
# =========================================
# App manifest
# =========================================
---
# App Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: m4g-docs-deployment
spec:
replicas: 1
selector:
matchLabels:
app: m4g-docs
template:
metadata:
labels:
app: m4g-docs
spec:
containers:
- name: m4g-docs
image: m4g_docs:latest
imagePullPolicy: Never
ports:
- containerPort: 80
---
# App Service
apiVersion: v1
kind: Service
metadata:
name: m4g-docs-service
spec:
selector:
app: m4g-docs
ports:
- protocol: TCP
port: 80
targetPort: 80
type: NodePort
---
# App Ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: m4g-docs-ingress
spec:
ingressClassName: caddy
rules:
- host: m4g.docs.local
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: m4g-docs-service
port:
number: 80

View File

@ -0,0 +1,67 @@
# =========================================
# App manifest
# =========================================
---
# App Deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: m4g-docs-deployment
spec:
replicas: 1
selector:
matchLabels:
app: m4g-docs
template:
metadata:
labels:
app: m4g-docs
spec:
containers:
- name: m4g-docs
image: git.devdisciples.com/devdisciples/m4gdocs:latest
imagePullPolicy: Always
ports:
- containerPort: 80
---
# App Service
apiVersion: v1
kind: Service
metadata:
name: m4g-docs-service
spec:
selector:
app: m4g-docs
ports:
- protocol: TCP
port: 80
targetPort: 80
type: NodePort
---
# App Ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: m4g-docs-ingress
annotations:
cert-manager.io/cluster-issuer: lets-encrypt
spec:
ingressClassName: public
tls:
- hosts:
- m4g.example.com
secretName: example-tls-secret
rules:
- host: m4g.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: m4g-docs-service
port:
number: 80

27
docs/Dockerfile Normal file
View File

@ -0,0 +1,27 @@
# syntax=docker/dockerfile:1
# Stage 1: Base image.
## Start with a base image containing NodeJS so we can build Docusaurus.
FROM node:lts AS base
## Disable colour output from yarn to make logs easier to read.
ENV FORCE_COLOR=0
## Enable corepack.
RUN corepack enable
## Set the working directory to `/opt/docusaurus`.
WORKDIR /opt/docusaurus
# Stage 2b: Production build mode.
FROM base AS prod
## Set the working directory to `/opt/docusaurus`.
WORKDIR /opt/docusaurus
## Copy over the source code.
COPY . /opt/docusaurus/
## Install dependencies with `--immutable` to ensure reproducibility.
RUN npm ci
## Build the static site.
RUN npm run build
## Use a stable nginx image
FROM nginx:stable-alpine AS deploy
WORKDIR /home/node/app
COPY --chown=node:node --from=prod /opt/docusaurus/build/ /usr/share/nginx/html/

View File

@ -39,3 +39,9 @@ $ GIT_USER=<Your GitHub username> yarn deploy
```
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
### Custom
kubectl --kubeconfig ~/.kube/main.k8s.config apply -f .k8s/remote.yml

View File

@ -1,5 +1,5 @@
---
sidebar_position: 5
---
---
sidebar_position: 5
---
# Command plugins

View File

@ -1,28 +1,28 @@
---
sidebar_position: 2
---
# Getting started
## Requirements
MycroForge has the following dependencies.
- bash
- git
- Python3 (3.10)
- Docker
- .NET 8
### Windows
To simplify the implementation of this tool, it assumes that it's running in a POSIX compliant environment.
MycroForge has been developed and tested on Windows in WSL2 Ubuntu 22.04.03.
So when running on Windows, it's recommended to run MycroForge in the same environment or atleast in a similar WSL2 distro.
### Install
```
dotnet tool install -g MycroForge.CLI
```
---
sidebar_position: 2
---
# Getting started
## Requirements
MycroForge has the following dependencies.
- bash
- git
- Python3 (3.10)
- Docker
- .NET 8
### Windows
To simplify the implementation of this tool, it assumes that it's running in a POSIX compliant environment.
MycroForge has been developed and tested on Windows in WSL2 Ubuntu 22.04.03.
So when running on Windows, it's recommended to run MycroForge in the same environment or atleast in a similar WSL2 distro.
### Install
```
dotnet tool install -g MycroForge.CLI
```

View File

@ -4,7 +4,7 @@
"private": true,
"scripts": {
"docusaurus": "docusaurus",
"start": "docusaurus start",
"start": "docusaurus start --host 0.0.0.0",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy",