Skip to content

Commit ff9ee6d

Browse files
authored
Merge pull request #528 from vishnoianil/one-touch-installation
Installer to install the UI stack in native mode on Podman.
2 parents 5403efd + a99521b commit ff9ee6d

File tree

7 files changed

+626
-44
lines changed

7 files changed

+626
-44
lines changed

.github/workflows/api-server.yml

Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,63 @@ jobs:
5858
run: |
5959
go build ./...
6060
61-
build-packages:
61+
build-darwin-packages:
62+
needs: [ fmt-build-test ]
63+
runs-on: macos-latest
64+
defaults:
65+
run:
66+
working-directory: api-server
67+
steps:
68+
- uses: actions/checkout@v4
69+
- name: Set up Go
70+
uses: actions/setup-go@v5
71+
with:
72+
go-version: '1.21.6'
73+
74+
- name: Build apiserver darwin packages
75+
id: build
76+
shell: bash
77+
run: |
78+
make -j dist/packages
79+
80+
- name: Upload apiserver tar.gz packages
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: apiserver-darwin-packages-tar
84+
if-no-files-found: error
85+
path: |
86+
./api-server/dist/packages/*.tar.gz
87+
88+
upload-s3-darwin-packages:
89+
needs: ["build-darwin-packages"]
90+
permissions:
91+
id-token: write
92+
contents: read
93+
runs-on: ubuntu-latest
94+
environment: registry-creds
95+
if: ${{ github.event_name == 'push' }}
96+
steps:
97+
- name: download tar.gz binary artifacts
98+
uses: actions/download-artifact@v4
99+
with:
100+
name: apiserver-darwin-packages-tar
101+
path: ./dist/packages
102+
103+
- name: Display structure of downloaded files
104+
run: ls -lah -R
105+
working-directory: ./dist/packages
106+
107+
- name: configure aws credentials
108+
uses: aws-actions/configure-aws-credentials@v4
109+
with:
110+
role-to-assume: ${{ secrets.AWS_ROLE }}
111+
role-session-name: apiserver-ci-deploy
112+
aws-region: us-east-1
113+
- name: copy binaries to s3
114+
run: |
115+
aws s3 sync dist/packages s3://instructlab-ui/apiserver
116+
117+
build-linux-packages:
62118
needs: [ fmt-build-test ]
63119
runs-on: ubuntu-latest
64120
defaults:
@@ -80,13 +136,13 @@ jobs:
80136
- name: Upload apiserver tar.gz packages
81137
uses: actions/upload-artifact@v4
82138
with:
83-
name: apiserver-packages-tar
139+
name: apiserver-linux-packages-tar
84140
if-no-files-found: error
85141
path: |
86142
./api-server/dist/packages/*.tar.gz
87143
88-
upload-s3-packages:
89-
needs: ["build-packages"]
144+
upload-s3-linux-packages:
145+
needs: ["build-linux-packages"]
90146
permissions:
91147
id-token: write
92148
contents: read
@@ -97,7 +153,7 @@ jobs:
97153
- name: download tar.gz binary artifacts
98154
uses: actions/download-artifact@v4
99155
with:
100-
name: apiserver-packages-tar
156+
name: apiserver-linux-packages-tar
101157
path: ./dist/packages
102158

103159
- name: Display structure of downloaded files

api-server/Makefile

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,33 @@ APISERVER_GCFLAGS?=
2323
APISERVER_BUILD_PROFILE?=dev
2424
APISERVER_LDFLAGS:=$(APISERVER_LDFLAGS) -X main.Version=$(APISERVER_VERSION)-$(APISERVER_RELEASE)
2525

26-
CGO_ENABLED?=0
26+
CGO_ENABLED?=1
2727
ifeq ($(APISERVER_RACE_DETECTOR),1)
2828
CGO_ENABLED=1
2929
APISERVER_BUILD_FLAGS+=-race
3030
endif
31-
ifneq ($(APISERVER_BUILD_TAGS),)
32-
APISERVER_BUILD_FLAGS+=-tags $(APISERVER_BUILD_TAGS)
33-
endif
3431
ifeq ($(CGO_ENABLED),0)
3532
APISERVER_LDFLAGS+=-extldflags=-static
3633
endif
3734

35+
OS := $(shell uname -s)
3836

39-
# Crunchy DB operator does not work well on arm64, use an different overlay to work around it.
40-
UNAME_M := $(shell uname -m)
41-
ifeq ($(UNAME_M),arm64)
42-
OVERLAY?=arm64
37+
ifeq ($(OS), Darwin)
38+
TARGET_BIN = dist/apiserver-darwin-amd64 dist/apiserver-darwin-arm64
39+
TARGET_PACKAGES= dist/packages/apiserver-darwin-amd64.tar.gz dist/packages/apiserver-darwin-arm64.tar.gz
40+
else ifeq ($(OS), Linux)
41+
TARGET_BIN = dist/apiserver-linux-amd64
42+
#TARGET_BIN = dist/apiserver-linux-amd64 dist/apiserver-linux-arm64
43+
TARGET_PACKAGES=dist/packages/apiserver-linux-amd64.tar.gz
44+
#TARGET_PACKAGES=dist/packages/apiserver-linux-amd64.tar.gz dist/packages/apiserver-linux-arm64.tar.gz
4345
else
44-
OVERLAY?=dev
46+
$(error Unsupported OS: $(OS))
4547
endif
4648

4749
##@ Binaries
4850

4951
.PHONY: apiserver
50-
apiserver: dist/apiserver dist/apiserver-linux-arm64 dist/apiserver-linux-amd64 dist/apiserver-darwin-amd64 dist/apiserver-darwin-arm64 ## Build Instructlab UI API server
52+
apiserver: dist/apiserver $(TARGET_BIN) ## Build Instructlab UI API server
5153

5254
# Use go list to find all the go files that make up a binary.
5355
APISERVER_DEPS:= $(shell go list -deps -f '{{if (and .Module (eq .Module.Path "github.com/instructlab/ui/api-server"))}}{{$$dir := .Dir}}{{range .GoFiles}}{{$$dir}}/{{.}} {{end}}{{end}}' ./)
@@ -67,23 +69,13 @@ dist/apiserver-%: $(APISERVER_DEPS) | dist
6769
$(CMD_PREFIX) CGO_ENABLED=$(CGO_ENABLED) GOOS=$(word 2,$(subst -, ,$(basename $@))) GOARCH=$(word 3,$(subst -, ,$(basename $@))) \
6870
go build $(APISERVER_BUILD_FLAGS) -gcflags="$(APISERVER_GCFLAGS)" \
6971
-ldflags="$(APISERVER_LDFLAGS)" -o $@ ./
70-
dist/packages: \
71-
dist/packages/apiserver-linux-amd64.tar.gz \
72-
dist/packages/apiserver-linux-arm64.tar.gz \
73-
dist/packages/apiserver-darwin-amd64.tar.gz \
74-
dist/packages/apiserver-darwin-arm64.tar.gz \
72+
dist/packages: $(TARGET_PACKAGES)
7573

7674
dist/packages/%: apiserver
7775
$(CMD_PREFIX) mkdir -p $(basename $(basename $@))
78-
$(CMD_PREFIX) cp README.md $(basename $(basename $@))
79-
$(CMD_PREFIX) cp dist/apiserver-$(subst apiserver-,,$(basename $(basename $(@F))))$(if $(findstring windows,$@),.exe) $(basename $(basename $@))/ilab-apiserver$(if $(findstring windows,$@),.exe)
80-
$(CMD_PREFIX) if test "$(word 2,$(subst -, ,$(shell basename $@)))" = "windows" ; then \
81-
printf " %-12s dist/packages/$(@F)\n" "[ZIP]" ;\
82-
cd dist/packages && zip -q9r $(@F) $(basename $(basename $(@F))) ;\
83-
else \
84-
printf " %-12s dist/packages/$(@F)\n" "[TAR]" ;\
85-
cd dist/packages && tar -czf $(@F) $(basename $(basename $(@F))) ;\
86-
fi
76+
$(CMD_PREFIX) cp dist/apiserver-$(subst apiserver-,,$(basename $(basename $(@F)))) $(basename $(basename $@))/ilab-apiserver$
77+
$(CMD_PREFIX) printf " %-12s dist/packages/$(@F)\n" "[TAR]" ;
78+
$(CMD_PREFIX) cd dist/packages && tar -czf $(@F) $(basename $(basename $(@F)));
8779

8880
.PHONY: clean
8981
clean: ## clean built binaries

api-server/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ func (srv *ILabServer) runServer(cmd *cobra.Command, args []string) {
214214
srv.ilabCmd = ilabPath
215215
} else {
216216
// Use ilab from virtual environment
217-
srv.ilabCmd = filepath.Join(srv.baseDir, "venv", "bin", "ilab")
217+
srv.ilabCmd = filepath.Join(srv.baseDir, "bin", "ilab")
218218
if _, err := os.Stat(srv.ilabCmd); os.IsNotExist(err) {
219219
srv.log.Fatalf("ilab binary not found at %s. Please ensure the virtual environment is set up correctly.", srv.ilabCmd)
220220
}

deploy/podman/native/README.md

Lines changed: 56 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,62 @@
33

44
Please follow the below instructions to deploy UI stack with Native mode enabled in Podman.
55

6-
## Generate Secret
6+
## Deploy using the installer (Recommended)
7+
8+
Make a temporary directory and download the installer
9+
10+
```shell
11+
mkdir instructlab-ui
12+
cd instructlab-ui
13+
14+
curl -fsSL https://raw.githubusercontent.com/instructlab/ui/refs/heads/main/installers/podman/ilab-ui-native-installer.sh
15+
```
16+
17+
Give execution permission to the install
18+
19+
```shell
20+
chmod a+x ilab-ui-native-installer.sh
21+
```
22+
23+
Execute the installer and follow the instructions prompted on the terminal.
24+
25+
If your deployment machine has InstructLab (ilab CLI) setup, either on the host or in python virtual environment, use the following command
26+
27+
```shell
28+
./ilab-ui-native-installer.sh --username <USERNAME> --password <PASSWORD>
29+
30+
e.g ./ilab-ui-native-installer.sh --username admin --password passw0rd
31+
```
32+
33+
If your deployment machine don't have InstructLab CLI setup, please clone the taxonomy repo and fire the following command.
34+
35+
```shell
36+
./ilab-ui-native-installer.sh --username <USERNAME> --password <PASSWORD> --taxonomy-dir <TAXONOMY_DIR>
37+
38+
e.g ./ilab-ui-native-installer.sh --username admin --password passw0rd --taxonomy-dir /Users/johndoe/instructlab/taxonomy
39+
```
40+
41+
>[!NOTE]
42+
> In the absence of InstructLab CLI, UI won't be able to support the synthetic data generation and fine tuning, but skill and knowledge contribution should work as expected.
43+
44+
If you are deploying the UI stack on a remote machine, please provide the auth url in the input
45+
46+
```shell
47+
./ilab-ui-native-installer.sh --username <USERNAME> --password <PASSWORD> --taxonomy-dir <TAXONOMY_DIR> --auth-url http://<REMOTE-IP>:3000
48+
```
49+
50+
Please use `--help` to see more options supported by the installer.
51+
52+
## Deploy manually
53+
54+
If you would like to install the UI stack manually, it's a two step process
55+
56+
- Generate the secret file with the required input
57+
- Deploy the UI stack manifest file using podman.
758

859
A secret is required to provide required input to the UI stack in a secure way.
960

10-
Two options exist to generate the secret, either using `kubectl` or filling in values in the `secret.yaml` provided.
61+
There are two options to generate the secret's file, either using `kubectl` or filling in values in the `secret.yaml` provided.
1162

1263
### Generate secrets using kubectl
1364

@@ -46,17 +97,17 @@ echo "password" | base64
4697

4798
Using the above to fill in all the required input fields.
4899

49-
## Deploy the secret
100+
### Deploy the secret
50101

51102
Now that the `secret.yaml` has been generated, use `podman kube play` to load the secret.
52103

53104
```bash
54105
podman kube play secret.yaml
55106
```
56107

57-
## Deploying the InstructLab UI Stack
108+
### Deploy the InstructLab UI Stack
58109

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.
110+
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_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.
60111

61112
```bash
62113
podman kube play instructlab-ui.yaml

deploy/podman/native/instructlab-ui.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,5 +127,5 @@ spec:
127127
volumes:
128128
- name: taxonomy-repo
129129
hostPath:
130-
path: <TAXONOMY_REPO_ROOT_DIR>
130+
path: <TAXONOMY_ROOT_DIR>
131131
type: Directory

deploy/podman/native/secret.yaml.example

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
apiVersion: v1
22
data:
3-
IL_ENABLE_DEV_MODE: ZmFsc2U=
4-
IL_UI_ADMIN_PASSWORD:
5-
IL_UI_ADMIN_USERNAME:
6-
IL_UI_DEPLOYMENT: bmF0aXZl
7-
NEXT_PUBLIC_EXPERIMENTAL_FEATURES: dHJ1ZQ==
8-
NEXT_PUBLIC_TAXONOMY_ROOT_DIR:
9-
NEXTAUTH_SECRET:
10-
NEXTAUTH_URL: aHR0cDovL2xvY2FsaG9zdDozMDAw
3+
IL_UI_ADMIN_PASSWORD: <PASSWORD>
4+
IL_UI_ADMIN_USERNAME: <USERNAME>
5+
IL_UI_DEPLOYMENT: <UI_DEPLOYMENT>
6+
IL_ENABLE_DEV_MODE: <DEV_MODE>
7+
NEXT_PUBLIC_EXPERIMENTAL_FEATURES: <EXPERIMENTAL_FEATURES>
8+
NEXT_PUBLIC_TAXONOMY_ROOT_DIR: <TAXONOMY_ROOT_DIR>
9+
NEXTAUTH_URL: <AUTH_URL>
10+
NEXTAUTH_SECRET: <AUTH_SECRET>
1111
kind: Secret
1212
metadata:
1313
creationTimestamp: null

0 commit comments

Comments
 (0)