Public Information

This commit is contained in:
2025-01-24 16:18:47 +01:00
commit 0bd2038c86
449 changed files with 108655 additions and 0 deletions

87
samples/sim/README.md Normal file
View File

@@ -0,0 +1,87 @@
# Single-Instance-Mode
If you choose to separate tenants on your system not only by *nplus Instances* but also by *nplus Environments*, thus running each tenant in a separate Kubernetes *Namespace*, you do not need to create an *nplus Environment* first, but you can rather enable the *nplus Environment Components* within your instance:
```yaml
components:
sim:
dav: true
backend: true
operator: true
toolbox: true
```
Steps to run a SIM Instance:
1. Create the namespace and the necessary secrets to access the repo, registry as well as the nscale license file
```
SIM_NAME="empty-sim"
kubectl create ns $SIM_NAME
kubectl create secret docker-registry nscale-cr \
--namespace $SIM_NAME \
--docker-server=ceyoniq.azurecr.io \
--docker-username=$NSCALE_ACCOUNT \
--docker-password=$NSCALE_TOKEN
kubectl create secret docker-registry nplus-cr \
--namespace $SIM_NAME \
--docker-server=cr.nplus.cloud \
--docker-username=$NPLUS_ACCOUNT \
--docker-password=$NPLUS_TOKEN
kubectl create secret generic nscale-license \
--namespace $SIM_NAME \
--from-file=license.xml=$NSCALE_LICENSE
```
2. Deploy the Instance
```
helm install \
--values lab.yaml \
--values single-instance-mode.yaml \
--namespace $SIM_NAME \
$SIM_NAME nplus/nplus-instance
```
If you do not have any Application that requires assets such as scripts or apps, you are good to go with this.
However, if your Application does require assets, the *problem* is to get them into your (not existing) environment before the Applications is trying to access them.
There are three possible solutions:
1. You create an umbrella chart and have a job installing the assets into your Instance
2. You pull / download assets from your git server or an asset server before the Application deployment
3. You pull / download assets from your git server or an asset server before the Component deployment, including the Application
**Solution 1** obiously involes some implementation on your end. That is not covered in this documentation.
**Solution 2** can be achieved by defining a downloader in your application chart (see `empty-download.yaml`):
```yaml
components:
application: true
application:
docAreas:
- id: "Sample"
download:
- "https://git.nplus.cloud/public/nplus/raw/branch/master/samples/assets/sample.sh"
run:
- "/pool/downloads/sample.sh"
```
**Solutions 3** should be used if you have any assets that need to be available **before** the nscale Components start, like snippets for the web client etc.
You can use the *Prepper* for that purpose. The *Prepper* prepares everything required for the Instance to work as intended. It is very much like the *Application*, except that it does not connect to any nscale component (as they do not yet run by the time the prepper executes). But just like the Application, the Prepper is able to download assets and run scripts.
You can add this to your deployment:
```yaml
components:
prepper: true
prepper:
download:
- "https://git.nplus.cloud/public/nplus/raw/branch/master/assets/sample.tar.gz"
run:
- "/pool/downloads/sample/sample.sh"
```

46
samples/sim/build.sh Executable file
View File

@@ -0,0 +1,46 @@
#!/bin/bash
#
# This sample script builds the example as described. It is also used to build the test environment in our lab,
# so it should be well tested.
#
# Make sure it fails immediately, if anything goes wrong
set -e
# -- ENVironment variables:
# CHARTS: The path to the source code
# DEST: The path to the build destination
# SAMPLE: The directory of the sample
# NAME: The name of the sample, used as the .Release.Name
# KUBE_CONTEXT: The name of the kube context, used to build this sample depending on where you run it against. You might have different Environments such as lab, dev, qa, prod, demo, local, ...
# Check, if we have the source code available
if [ ! -d "$CHARTS" ]; then
echo "ERROR Building $SAMPLE example: The Charts Sources folder is not set. Please make sure to run this script with the full Source Code available"
exit 1
fi
if [ ! -d "$DEST" ]; then
echo "ERROR Building $SAMPLE example: DEST folder not found."
exit 1
fi
if [ ! -d "$CHARTS/instance" ]; then
echo "ERROR Building $SAMPLE example: Chart Sources in $CHARTS/instance not found. Are you running this script as a subscriber?"
exit 1
fi
# Set the Variables
SAMPLE="sim"
NAME="sample-$SAMPLE"
# Output what is happening
echo "Building $NAME"
# Create the manifest
mkdir -p $DEST/instance-sim
helm template --debug \
--values $SAMPLES/application/empty.yaml \
--values $SAMPLES/environment/$KUBE_CONTEXT.yaml \
--values $SAMPLES/resources/$KUBE_CONTEXT.yaml \
--values $SAMPLES/sim/values.yaml \
--namespace $NAME \
$NAME $CHARTS/instance > $DEST/instance-sim/$SAMPLE.yaml

7
samples/sim/values.yaml Normal file
View File

@@ -0,0 +1,7 @@
components:
sim:
dav: true
backend: true
operator: true
toolbox: true