Files
nplus/samples/sim/README.md
2025-01-24 16:18:47 +01:00

88 lines
3.1 KiB
Markdown

# 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"
```