Skip to content

Commit 4fb1324

Browse files
authored
Merge pull request #521 from vishnoianil/context-selection-upstream
Add context selection and document convertion features to upstream
2 parents a788e86 + 96054c4 commit 4fb1324

File tree

26 files changed

+1270
-682
lines changed

26 files changed

+1270
-682
lines changed

deploy/k8s/base/doclingserve/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ kind: Deployment
33
metadata:
44
name: doclingserve
55
spec:
6-
replicas: 1
6+
replicas: 3
77
strategy:
88
type: RollingUpdate
99
template:

deploy/podman/README.md

Lines changed: 6 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,11 @@
1-
# Podman deployment
1+
# InstructLab UI stack deployment in Podman
22

3-
To help support knowledge and skill additions as well as the capabilities to chat with a deployed model, the following Podman files have been included to be used with `podman kube play`. UI stack supports two mode of deployments:
3+
InstructLab UI provides a simple and intuitive web interface that users can use to create knowledge and skill contribution. InstructLab UI supports two mode of deployments:
44

5-
- Github mode: This mode is used to deploy the UI stack with Github integration. Users can create skill and knowledge and push it to the taxonomy repository present in instructlab org or their own personal clone of the taxonomy repository.
6-
- Native mode: This mode is used to deploy the UI stack without Github integration. User created skill and knowledge contributions are local to the machine where UI stack is deployed. Users can publish their contribution to any taxonomy repository present on the machine for data generation or training of the model.
5+
## Github mode
76

8-
## Secret
7+
Github mode is used to deploy the UI stack with Github integration. Users can create skill and knowledge contributions and push it to the taxonomy repository present in instructlab org or their own personal clone of the taxonomy repository present under the user's own organization. To deploy InstructLab UI stack in the Github mode on Podman, please follow the detailed instructions present [here](./github/README.md).
98

10-
A secret is required to personalize the Instructlab UI for both the above mentioned modes.
9+
## Native mode
1110

12-
Two options exist to generate the secret, either using `kubectl` or filling in values in the `secret.yaml` provided.
13-
14-
> [!NOTE]
15-
> It is not required to fill in every field. Double quotes `""` can be used for values that are not used.
16-
17-
### Kubectl secret creation
18-
19-
Using `kubectl`, we will use the `--dry-run -o yaml` flags to generate the secret for us.
20-
21-
#### For Github mode
22-
23-
```bash
24-
cd ./github
25-
26-
kubectl create secret generic ui-env \
27-
--from-literal=IL_UI_DEPLOYMENT=github \
28-
--from-literal=OAUTH_GITHUB_ID="" \
29-
--from-literal=OAUTH_GITHUB_SECRET="" \
30-
--from-literal=GITHUB_TOKEN="" \
31-
--from-literal=NEXTAUTH_SECRET=your_super_secretdom_string \
32-
--from-literal=NEXTAUTH_URL=http://localhost:3000 \
33-
--from-literal=NEXT_PUBLIC_AUTHENTICATION_ORG="" \
34-
--from-literal=NEXT_PUBLIC_TAXONOMY_REPO_OWNER="" \
35-
--from-literal=NEXT_PUBLIC_TAXONOMY_REPO="" \
36-
--from-literal=NEXT_PUBLIC_TAXONOMY_DOCUMENTS_REPO=github.com/instructlab-public/taxonomy-knowledge-docs \
37-
--from-literal=NEXT_PUBLIC_EXPERIMENTAL_FEATURES="false" \
38-
--from-literal=IL_GRANITE_API="" \
39-
--from-literal=IL_GRANITE_MODEL_NAME="" \
40-
--from-literal=IL_MERLINITE_API="" \
41-
--from-literal=IL_MERLINITE_MODEL_NAME="" \
42-
--from-literal=IL_ENABLE_DEV_MODE=false \
43-
--dry-run=client -o yaml > secret.yaml
44-
```
45-
46-
#### For Native mode
47-
48-
```bash
49-
cd ./native
50-
51-
kubectl create secret generic ui-env \
52-
--from-literal=IL_UI_DEPLOYMENT=native \
53-
--from-literal=IL_UI_ADMIN_USERNAME="" \
54-
--from-literal=IL_UI_ADMIN_PASSWORD="" \
55-
--from-literal=NEXTAUTH_SECRET=your_super_secretdom_string \
56-
--from-literal=NEXTAUTH_URL=http://localhost:3000 \
57-
--from-literal=NEXT_PUBLIC_TAXONOMY_ROOT_DIR="" \
58-
--from-literal=NEXT_PUBLIC_EXPERIMENTAL_FEATURES="false" \
59-
--from-literal=IL_ENABLE_DEV_MODE=false \
60-
--dry-run=client -o yaml > secret.yaml
61-
```
62-
63-
### Manual providing values
64-
65-
A file named `secret.yaml.example` exists for both the modes. Please rename the file to `secret.yaml`. The user can use this file to input their values in place.These values must be `base64` encoded.
66-
67-
Here is an example on how to `base64` encode a value.
68-
69-
```bash
70-
echo "password" | base64
71-
```
72-
73-
Using the above fill in the values as it relates to the environment.
74-
75-
## Deploy the secret
76-
77-
Now that the `secret.yaml` has been generated, use `podman kube play` to load the secret.
78-
79-
```bash
80-
podman kube play secret.yaml
81-
```
82-
83-
## Launching the UI
84-
85-
Now with the secret in place, use `podman kube play` to launch the containers. If you are deploying the Native mode, please replace the `<TAXONOMY_REPO_ROOT_DIR>` variable in `native/instructlab-ui.yaml` with the absolute path of the directory where the taxonomy repository is present. UI will look for the taxonomy repo in this directory to submit the skill and knowledge contributions.
86-
87-
```bash
88-
podman kube play instructlab-ui.yaml
89-
```
90-
91-
> [!NOTE]
92-
> If you are deploying the UI stack (Native mode) on a rootless Podman and SELinux enabled system, please make sure of the following two issues
93-
>
94-
> 1. Uncomment the `securityContext` in the `instructlab-ui.yaml` file and set the value of `runAsGroup` to the value of the host user's group id.
95-
> `id` command should give you the `gid` of the host user.
96-
>
97-
> 2. Make sure cpu and cpusets cgroup controllers are enabled for the user. To check if the cgroup controllers are enabled, run the following command:
98-
> ```cat "/sys/fs/cgroup/user.slice/user-$(id -u).slice/user@$(id -u).service/cgroup.controllers"```
99-
>
100-
> If the output of the above command does not contain `cpu` and `cpuset`, then you need to enable these cgroup controllers for the user. To enable these cgroup controllers, create the following file `/etc/systemd/system/[email protected]/delegate.conf` with the following content:
101-
>
102-
>```[Service]
103-
> Delegate=memory pids cpu cpuset```
104-
> Save the file and run `sudo systemctl daemon-reload` followed by `sudo systemctl restart user@$(id -u).service` to apply the changes.
105-
106-
## Accessing the UI
107-
108-
The Instructlab UI should now be accessible from `http://localhost:3000` or `http://<host-ip>:3000` depending on where the UI stack is deployed.
109-
110-
## Cleaning up
111-
112-
To clean up the deployment, use `podman kube down` to delete the deployment.
113-
114-
```bash
115-
podman kube down instructlab-ui.yaml
116-
podman kube down secret.yaml
117-
```
11+
Native mode is used to deploy the InstructLab UI stack without Github integration. User created skill and knowledge contributions are local to the machine where UI stack is deployed. Users can publish their contribution to any taxonomy repository present on the machine for synthetic data generation or training of the model using the [InstructLab tools](https://github.com/instructlab/instructlab). To deploy the InstructLab UI stack in Native mode, please follow the detailed instructions present [here](./native/README.md).

deploy/podman/github/README.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
2+
# InstructLab UI Github mode deployment in Podman
3+
4+
Please follow the below instructions to deploy UI stack with Github mode enabled in Podman.
5+
6+
## Generate Secret
7+
8+
A secret is required to provide required input to the UI stack in a secure way.
9+
10+
Two options exist to generate the secret, either using `kubectl` or filling in values in the `secret.yaml` provided.
11+
12+
### Generate secrets using kubectl
13+
14+
Using `kubectl`, we will use the `--dry-run -o yaml` flags to generate the secret for us.
15+
16+
```bash
17+
cd ./github
18+
19+
kubectl create secret generic ui-env \
20+
--from-literal=IL_UI_DEPLOYMENT=github \
21+
--from-literal=OAUTH_GITHUB_ID="<OAUTH_APP_GITHUB_ID>" \
22+
--from-literal=OAUTH_GITHUB_SECRET="<OAUTH_APP_GITHUB_SECRET>" \
23+
--from-literal=GITHUB_TOKEN="<GITHUB_PAT_TOKEN>" \
24+
--from-literal=NEXTAUTH_SECRET=your_super_secret_random_string \
25+
--from-literal=NEXTAUTH_URL=http://localhost:3000 \
26+
--from-literal=NEXT_PUBLIC_AUTHENTICATION_ORG="<OAUTH_APP_GITHUB_ID>" \
27+
--from-literal=NEXT_PUBLIC_TAXONOMY_REPO_OWNER="<GITHUB_TAXONOMY_OWNER_ORG>" \
28+
--from-literal=NEXT_PUBLIC_TAXONOMY_REPO="<TAXONOMY_REPO_NAME>" \
29+
--from-literal=NEXT_PUBLIC_EXPERIMENTAL_FEATURES="false" \
30+
--from-literal=IL_GRANITE_API="" \
31+
--from-literal=IL_GRANITE_MODEL_NAME="" \
32+
--from-literal=IL_MERLINITE_API="" \
33+
--from-literal=IL_MERLINITE_MODEL_NAME="" \
34+
--from-literal=IL_ENABLE_DEV_MODE=false \
35+
--dry-run=client -o yaml > secret.yaml
36+
```
37+
38+
Following are the required inputs that you must set for successful deployment of the InstructLab UI in Github mode. Github mode has a prerequisite to setup an OAuth App in the Github under user owned organization. Please follow the github documentation [here](https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/creating-an-oauth-app) to set up a Github OAuth App.
39+
40+
<OAUTH_APP_GITHUB_ID>: OAuth app ID generated after setting up the OAuth Github app.
41+
42+
<OAUTH_APP_GITHUB_SECRET>: OAuth app secret (it needs to be explicitly created once OAuth app is setup)
43+
44+
<GITHUB_TAXONOMY_OWNER_ORG>: Name of the organization under which the user is cloning the [taxonomy](https://github.com/instructlab/taxonomy) repo.
45+
46+
<TAXONOMY_REPO_NAME>: If you rename the [taxonomy](https://github.com/instructlab/taxonomy) repo while cloning it under the organization, please set it to the new name, otherwise use `taxonomy`
47+
48+
<GITHUB_PAT_TOKEN>: Generate a Personal Access Token in your profile that allows read/write access to the organization and the cloned taxonomy repo.
49+
50+
### Generate secrets manually
51+
52+
A file named [secret.yaml.example](secret.yaml.example) present in the [Github](../github/) directory. Please rename the file to `secret.yaml`. The user can use this file to input their values in place. This file is pre-filled with the default values for the non-mandatory input fields, please set the values of the required input fields as mentioned above. These values must be `base64` encoded.
53+
54+
Here is an example on how to `base64` encode a value.
55+
56+
```bash
57+
echo "password" | base64
58+
```
59+
60+
Using the above to fill in all the required input fields.
61+
62+
## Deploy the secret
63+
64+
Now that the `secret.yaml` has been generated, use `podman kube play` to load the secret.
65+
66+
```bash
67+
podman kube play secret.yaml
68+
```
69+
70+
## Deploying the InstructLab UI Stack
71+
72+
With the secrets in place, use the following command to launch the UI stack containers. [instructlab-ui.yaml](./instructlab-ui.yaml) file is present in the [Github](../github/) directory.
73+
74+
```bash
75+
podman kube play instructlab-ui.yaml
76+
```
77+
78+
Once the UI stack is up and running, all the skill and knowledge contributions will be pushed to the cloned repository present in the user's organization.
79+
80+
## Upstream contributor
81+
82+
If you are playing with Github mode deployment for making upstream contributions to InstructLab UI project, please reach out to the project maintainers in the [InstructLab UI slack channel or Join the Upstream UI Meeting](../../../README.md). Maintainers already have an existing setup in place that upstream contributors can use. They will be able to provide the secrets file that can be used to deploy the UI stack with Github mode in the matters of minutes.
83+
84+
> [!NOTE]
85+
> When you deploy the UI stack on a rootless Podman and SELinux enabled system, please make sure to do the following configurations
86+
>
87+
> 1. Uncomment the `securityContext` in the `instructlab-ui.yaml` file and set the value of `runAsGroup` to the value of the host user's group id.
88+
> `id` command should give you the `gid` of the host user.
89+
>
90+
> 2. Make sure cpu and cpusets cgroup controllers are enabled for the user. To check if the cgroup controllers are enabled, run the following command:
91+
> ```cat "/sys/fs/cgroup/user.slice/user-$(id -u).slice/user@$(id -u).service/cgroup.controllers"```
92+
>
93+
> If the output of the above command does not contain `cpu` and `cpuset`, then you need to enable these cgroup controllers for the user. To enable these cgroup controllers, create the following file `/etc/systemd/system/[email protected]/delegate.conf` with the following content:
94+
>
95+
>```[Service]
96+
> Delegate=memory pids cpu cpuset```
97+
> Save the file and run `sudo systemctl daemon-reload` followed by `sudo systemctl restart user@$(id -u).service` to apply the changes.
98+
99+
## Accessing the UI
100+
101+
The Instructlab UI should now be accessible from `http://localhost:3000` or `http://<host-ip>:3000` depending on where the UI stack is deployed.
102+
103+
## Cleaning up
104+
105+
To clean up the deployment, use `podman kube down` to delete the deployment.
106+
107+
```bash
108+
podman kube down instructlab-ui.yaml
109+
podman kube down secret.yaml
110+
```

deploy/podman/native/README.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
2+
# InstructLab UI Native mode deployment in Podman
3+
4+
Please follow the below instructions to deploy UI stack with Native mode enabled in Podman.
5+
6+
## Generate Secret
7+
8+
A secret is required to provide required input to the UI stack in a secure way.
9+
10+
Two options exist to generate the secret, either using `kubectl` or filling in values in the `secret.yaml` provided.
11+
12+
### Generate secrets using kubectl
13+
14+
Using `kubectl`, we will use the `--dry-run -o yaml` flags to generate the secret for us.
15+
16+
```bash
17+
cd ./native
18+
19+
kubectl create secret generic ui-env \
20+
--from-literal=IL_UI_DEPLOYMENT=native \
21+
--from-literal=IL_UI_ADMIN_USERNAME="<USERNAME_FOR_LOGIN>" \
22+
--from-literal=IL_UI_ADMIN_PASSWORD="<PASSWORD_FOR_LOGIN>" \
23+
--from-literal=NEXTAUTH_SECRET=your_super_secret_random_string \
24+
--from-literal=NEXTAUTH_URL=http://localhost:3000 \
25+
--from-literal=NEXT_PUBLIC_TAXONOMY_ROOT_DIR="<TAXONOMY_ROOT_DIR>" \
26+
--from-literal=NEXT_PUBLIC_EXPERIMENTAL_FEATURES="false" \
27+
--from-literal=IL_ENABLE_DEV_MODE=false \
28+
--dry-run=client -o yaml > secret.yaml
29+
```
30+
31+
Following are the required inputs that you must set for successful deployment of the InstructLab UI in native mode.
32+
33+
<USERNAME_FOR_LOGIN>: Set the username you want to use to login to the InstructLab UI
34+
<PASSWORD_FOR_LOGIN>: Set the password you want to use to login to the InstructLab UI
35+
<TAXONOMY_ROOT_DIR>: Absolute path of the parent directory where the taxonomy repo is cloned.
36+
37+
### Generate secrets manually
38+
39+
A file named [secret.yaml.example](secret.yaml.example) present in the [native](../native/) directory. Please rename the file to `secret.yaml`. The user can use this file to input their values in place. This file is pre-filled with the default values for the non-mandatory input fields, please set the values of the required input fields as mentioned above. These values must be `base64` encoded.
40+
41+
Here is an example on how to `base64` encode a value.
42+
43+
```bash
44+
echo "password" | base64
45+
```
46+
47+
Using the above to fill in all the required input fields.
48+
49+
## Deploy the secret
50+
51+
Now that the `secret.yaml` has been generated, use `podman kube play` to load the secret.
52+
53+
```bash
54+
podman kube play secret.yaml
55+
```
56+
57+
## Deploying the InstructLab UI Stack
58+
59+
One last step before you launch the InstructLab UI. A file named [instructlab-ui.yaml](instructlab-ui.yaml) present in the [native](../native/) directory. Search for <TAXONOMY_REPO_ROOT_DIR> in the yaml file and replace it with the same value that is used while creating the secret.yaml file. Now with the secret in place and deployment yaml updated, use `podman kube play` to launch the containers. UI will look for the taxonomy repo in this directory to submit the skill and knowledge contributions.
60+
61+
```bash
62+
podman kube play instructlab-ui.yaml
63+
```
64+
65+
> [!NOTE]
66+
> When you deploy the UI stack on a rootless Podman and SELinux enabled system, please make sure to do the following configurations
67+
>
68+
> 1. Uncomment the `securityContext` in the `instructlab-ui.yaml` file and set the value of `runAsGroup` to the value of the host user's group id.
69+
> `id` command should give you the `gid` of the host user.
70+
>
71+
> 2. Make sure cpu and cpusets cgroup controllers are enabled for the user. To check if the cgroup controllers are enabled, run the following command:
72+
> ```cat "/sys/fs/cgroup/user.slice/user-$(id -u).slice/user@$(id -u).service/cgroup.controllers"```
73+
>
74+
> If the output of the above command does not contain `cpu` and `cpuset`, then you need to enable these cgroup controllers for the user. To enable these cgroup controllers, create the following file `/etc/systemd/system/[email protected]/delegate.conf` with the following content:
75+
>
76+
>```[Service]
77+
> Delegate=memory pids cpu cpuset```
78+
> Save the file and run `sudo systemctl daemon-reload` followed by `sudo systemctl restart user@$(id -u).service` to apply the changes.
79+
80+
## Accessing the UI
81+
82+
The Instructlab UI should now be accessible from `http://localhost:3000` or `http://<host-ip>:3000` depending on where the UI stack is deployed.
83+
84+
## Cleaning up
85+
86+
To clean up the deployment, use `podman kube down` to delete the deployment.
87+
88+
```bash
89+
podman kube down instructlab-ui.yaml
90+
podman kube down secret.yaml
91+
```

deploy/podman/native/instructlab-ui.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ spec:
6767
containers:
6868
- name: ui
6969
image: ghcr.io/instructlab/ui/ui:main
70-
# securityContext:
71-
# runAsGroup: 1000
70+
securityContext:
71+
runAsGroup: 1000
7272
volumeMounts:
7373
- name: taxonomy-repo
7474
mountPath: /tmp/.instructlab-ui

deploy/podman/native/secret.yaml.example

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
apiVersion: v1
22
data:
3-
IL_UI_DEPLOYMENT:
4-
IL_ENABLE_DEV_MODE:
3+
IL_ENABLE_DEV_MODE: ZmFsc2U=
54
IL_UI_ADMIN_PASSWORD:
65
IL_UI_ADMIN_USERNAME:
7-
NEXT_PUBLIC_EXPERIMENTAL_FEATURES:
6+
IL_UI_DEPLOYMENT: bmF0aXZl
7+
NEXT_PUBLIC_EXPERIMENTAL_FEATURES: dHJ1ZQ==
88
NEXT_PUBLIC_TAXONOMY_ROOT_DIR:
9-
NEXTAUTH_SECRET:
10-
NEXTAUTH_URL:
9+
NEXTAUTH_SECRET:
10+
NEXTAUTH_URL: aHR0cDovL2xvY2FsaG9zdDozMDAw
1111
kind: Secret
1212
metadata:
1313
creationTimestamp: null

src/app/api/envConfig/route.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ export async function GET() {
1717
DEPLOYMENT_TYPE: process.env.IL_UI_DEPLOYMENT || '',
1818
ENABLE_DEV_MODE: process.env.IL_ENABLE_DEV_MODE || 'false',
1919
EXPERIMENTAL_FEATURES: process.env.NEXT_PUBLIC_EXPERIMENTAL_FEATURES || '',
20-
TAXONOMY_ROOT_DIR: process.env.NEXT_PUBLIC_TAXONOMY_ROOT_DIR || ''
20+
TAXONOMY_ROOT_DIR: process.env.NEXT_PUBLIC_TAXONOMY_ROOT_DIR || '',
21+
TAXONOMY_KNOWLEDGE_DOCUMENT_REPO: process.env.NEXT_PUBLIC_TAXONOMY_DOCUMENTS_REPO || 'github.com/instructlab-public/taxonomy-knowledge-docs'
2122
};
2223

2324
return NextResponse.json(envConfig);

0 commit comments

Comments
 (0)