Skip to content

Commit 2ccc1f4

Browse files
committed
WIP
Signed-off-by: Tobias Anker <tobias.anker@kitsunemimi.moe>
1 parent 762cd9d commit 2ccc1f4

26 files changed

Lines changed: 414 additions & 603 deletions

File tree

.github/workflows/build_test.yml

Lines changed: 143 additions & 144 deletions
Large diffs are not rendered by default.

Dockerfile

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,38 +5,30 @@ ARG DEBIAN_FRONTEND=noninteractive
55
WORKDIR /app
66

77
RUN apt-get update && \
8-
apt-get install -y clang-15 \
8+
apt-get install -y clang-19 \
9+
gcc \
10+
g++ \
911
make \
1012
cmake \
11-
bison \
12-
flex \
1313
git \
1414
ssh \
15-
libssl-dev \
16-
libcrypto++-dev \
17-
libboost-dev \
18-
nlohmann-json3-dev \
19-
uuid-dev \
15+
rustup \
2016
libsqlite3-dev \
21-
protobuf-compiler && \
22-
ln -s /usr/bin/clang++-15 /usr/bin/clang++ && \
23-
ln -s /usr/bin/clang-15 /usr/bin/clang
17+
nlohmann-json3-dev
2418

2519
COPY . .
2620

27-
RUN rm -f src/libs/protobuf/hanami_messages.proto3.pb.cc src/libs/protobuf/hanami_messages.proto3.pb.h
28-
RUN cmake -DCMAKE_BUILD_TYPE=Release .
29-
RUN make -j8
30-
RUN mkdir -p /app/ && \
31-
find src -type f -executable -exec cp {} /app/ \;
21+
RUN rustup install stable --no-self-update
22+
RUN cargo build --release
23+
RUN cp target/release/hanami /app/
3224

3325

3426
FROM ubuntu:24.04
3527

3628
ARG DEBIAN_FRONTEND=noninteractive
3729

3830
RUN apt-get update && \
39-
apt-get install -y openssl libuuid1 libcrypto++8 libsqlite3-0 libboost1.74 libprotobuf32t64 && \
31+
apt-get install -y openssl libsqlite3-0 && \
4032
apt-get clean autoclean &&\
4133
apt-get autoremove --yes
4234

Earthfile

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ flake8:
6161
COPY testing testing
6262
COPY .flake8 .flake8
6363
RUN rm -rf src/sdk/python/hanami_sdk/hanami_sdk/hanami_messages/proto3_pb2.py src/sdk/python/hanami_sdk/hanami_env src/sdk/python/hanami_sdk/build
64-
RUN flake8 testing/python_sdk_api/sdk_api_test.py && \
65-
flake8 src/sdk/python
64+
RUN flake8 src/sdk/python
6665

6766

6867
ansible-lint:
@@ -146,8 +145,9 @@ compile-hanami:
146145
RUN apt-get update && \
147146
apt-get install -y libsqlite3-dev
148147
RUN cargo build
149-
RUN mkdir /tmp/hanami
150-
SAVE ARTIFACT ./target/debug/hanami /tmp/hanami
148+
RUN cp ./target/debug/hanami /tmp/
149+
SAVE ARTIFACT /tmp/hanami /tmp/hanami
150+
SAVE ARTIFACT /tmp/hanami AS LOCAL hanami
151151

152152
test-hanami:
153153
FROM +prepare-build-dependencies
@@ -174,38 +174,49 @@ build-image:
174174

175175

176176
generate-docs:
177-
COPY +compile-code/hanami/hanami /tmp/
177+
ENV HANAMI_ADMIN_ID asdf
178+
ENV HANAMI_ADMIN_NAME asdf
179+
ENV HANAMI_ADMIN_PASSPHRASE asdfasdf
180+
181+
COPY +compile-hanami/hanami /tmp/hanami
182+
COPY example_configs/openhanami /etc/openhanami
178183

179184
RUN apt-get update && \
180-
apt-get install -y openssl libuuid1 libcrypto++8 libsqlite3-0 libprotobuf23 libboost1.74 libgbm-dev libasound2 xvfb dbus
181-
RUN chmod +x /tmp/hanami_core
182-
RUN /tmp/hanami_core --generate_docu
185+
apt-get install -y openssl libsqlite3-0 libgbm-dev xvfb dbus
183186

184187
RUN apt-get update && \
185188
apt-get install -y python3 \
186189
python3-pip \
190+
python3-venv \
187191
wget \
188192
curl && \
189-
pip3 install mkdocs \
193+
python3 -m venv hanami_env && \
194+
. hanami_env/bin/activate && \
195+
pip3 install hapless \
196+
mkdocs \
190197
mkdocs-material \
191198
mkdocs-swagger-ui-tag \
192199
# pin mkdocs-drawio-exporter because 0.10.x is broken
193200
mkdocs-drawio-exporter==0.9.1 && \
194201
curl -s https://api.github.com/repos/jgraph/drawio-desktop/releases/latest | grep browser_download_url | grep "amd64" | grep "deb" | cut -d "\"" -f 4 | wget -i - && \
195202
apt -f -y install ./drawio-amd64-*.deb
196203

204+
RUN chmod +x /tmp/hanami
205+
RUN . hanami_env/bin/activate && \
206+
hap run /tmp/hanami && \
207+
sleep 5 && \
208+
curl 127.0.0.1:11418/openapi.json > ./open_api_docu.json
209+
197210
COPY mkdocs.yml .
198211
COPY CHANGELOG.md .
199212
COPY ROADMAP.md .
200213
COPY LICENSE .
201214
COPY docs docs
202-
RUN cp ./db.md docs/backend/
203-
RUN cp ./config.md docs/backend/
204215
RUN cp ./open_api_docu.json docs/frontend/
205216

206217
# the `xvfb-run -a` comes from the following trouble-shooting for a headless execution in github actions:
207218
# https://github.com/LukeCarrier/mkdocs-drawio-exporter?tab=readme-ov-file#headless-usage
208-
RUN xvfb-run -a mkdocs build --clean
219+
RUN . hanami_env/bin/activate && xvfb-run -a mkdocs build --clean
209220

210221
SAVE ARTIFACT site AS LOCAL site
211222

@@ -220,7 +231,6 @@ build-docs:
220231

221232
WORKDIR /openhanami_docs
222233

223-
RUN useradd -m ubuntu
224234
RUN chown -R ubuntu:ubuntu .
225235
USER ubuntu
226236

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ and multi-tenancy.
3333

3434
| Backend | SDK | Deployment |
3535
| ------------------------------------------------------------- | ------------------------------------------- | --------------------------------------------------- |
36-
| [![ubuntu-2204_clang-13][img_ubuntu-2204_clang-13]][Workflow] | [![python-3_9][img_python-3_9]][Workflow] | [![kubernetes-1_26][img_kubernetes-1_26]][Workflow] |
37-
| [![ubuntu-2204_clang-14][img_ubuntu-2204_clang-14]][Workflow] | [![python-3_10][img_python-3_10]][Workflow] | [![kubernetes-1_27][img_kubernetes-1_27]][Workflow] |
38-
| [![ubuntu-2204_clang-15][img_ubuntu-2204_clang-15]][Workflow] | [![python-3_11][img_python-3_11]][Workflow] | [![kubernetes-1_28][img_kubernetes-1_28]][Workflow] |
39-
| [![ubuntu-2404_clang-15][img_ubuntu-2404_clang-15]][Workflow] | [![python-3_12][img_python-3_12]][Workflow] | [![kubernetes-1_29][img_kubernetes-1_29]][Workflow] |
36+
| [![ubuntu-2204_clang-13][img_ubuntu-2204_clang-13]][Workflow] | [![python-3_10][img_python-3_10]][Workflow] | [![kubernetes-1_26][img_kubernetes-1_26]][Workflow] |
37+
| [![ubuntu-2204_clang-14][img_ubuntu-2204_clang-14]][Workflow] | [![python-3_11][img_python-3_11]][Workflow] | [![kubernetes-1_27][img_kubernetes-1_27]][Workflow] |
38+
| [![ubuntu-2204_clang-15][img_ubuntu-2204_clang-15]][Workflow] | [![python-3_12][img_python-3_12]][Workflow] | [![kubernetes-1_28][img_kubernetes-1_28]][Workflow] |
39+
| [![ubuntu-2404_clang-15][img_ubuntu-2404_clang-15]][Workflow] | | [![kubernetes-1_29][img_kubernetes-1_29]][Workflow] |
4040
| [![ubuntu-2404_clang-16][img_ubuntu-2404_clang-16]][Workflow] | | [![kubernetes-1_30][img_kubernetes-1_30]][Workflow] |
4141
| [![ubuntu-2404_clang-17][img_ubuntu-2404_clang-17]][Workflow] | | |
4242
| [![ubuntu-2404_clang-18][img_ubuntu-2404_clang-18]][Workflow] | | |
@@ -73,8 +73,6 @@ and multi-tenancy.
7373
https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/kitsudaiki/OpenHanami-badges/develop/compiler_version/ubuntu-2404_gcc-13/shields.json&style=flat-square
7474
[img_ubuntu-2404_gcc-14]:
7575
https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/kitsudaiki/OpenHanami-badges/develop/compiler_version/ubuntu-2404_gcc-14/shields.json&style=flat-square
76-
[img_python-3_9]:
77-
https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/kitsudaiki/OpenHanami-badges/develop/python_version/python-3_9/shields.json&style=flat-square
7876
[img_python-3_10]:
7977
https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/kitsudaiki/OpenHanami-badges/develop/python_version/python-3_10/shields.json&style=flat-square
8078
[img_python-3_11]:

deploy/k8s/openhanami/templates/hanami-config.yaml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,29 @@ apiVersion: v1
22
metadata:
33
name: hanami-config
44
data:
5-
hanami.conf: |+
6-
[DEFAULT]
7-
debug = True
8-
log_path = "/var/log"
9-
database = "/etc/openhanami/data/hanami_db"
10-
use_cuda = false
5+
hanami.toml: |+
6+
debug = true
7+
log_path = ""
118
129
[storage]
13-
dataset_location = "/etc/openhanami/data/datasets"
14-
checkpoint_location = "/etc/openhanami/data/checkpoints"
15-
tempfile_location = "/etc/openhanami/data/tempfiles"
10+
dataset_location = "/etc/openhanami/datasets"
11+
checkpoint_location = "/etc/openhanami/checkpoints"
12+
tempfile_location = "/etc/openhanami/tempfiles"
1613
tempfile_timeout = 10
1714
1815
[processing]
19-
use_of_free_memory = {{ .Values.processing.use_of_free_memory }}
16+
use_of_free_memory = 0.2
2017
2118
[auth]
22-
policies = "/etc/openhanami/policies"
2319
token_key_path = "/etc/openhanami/token_key"
24-
token_expire_time = {{ .Values.token.expire_time }}
20+
token_expire_time = 36000
2521
26-
[http]
27-
enable = True
28-
ip = 127.0.0.1
22+
[api]
23+
ip = "0.0.0.0"
2924
port = 11418
3025
26+
[database]
27+
host = "0.0.0.0"
28+
port = 1234
29+
3130
kind: ConfigMap

deploy/k8s/openhanami/templates/hanami-deployment.yaml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,18 @@ spec:
3838
image: {{ .Values.docker.registry }}/hanami:{{ .Values.docker.tag }}
3939
imagePullPolicy: Always
4040
env:
41-
- name: HANAMI_ADMIN_USER_ID
41+
- name: HANAMI_ADMIN_ID
4242
value: {{ required "user.id is required!" .Values.user.id }}
43-
- name: HANAMI_ADMIN_USER_NAME
43+
- name: HANAMI_ADMIN_NAME
4444
value: {{ required "user.name is required!" .Values.user.name }}
4545
- name: HANAMI_ADMIN_PASSPHRASE
4646
value: {{ required "user.passphrase is required!" .Values.user.passphrase }}
4747
volumeMounts:
4848
- name: data-volume
4949
mountPath: /etc/openhanami/data/
5050
- name: hanami-config
51-
mountPath: /etc/openhanami/hanami.conf
52-
subPath: hanami.conf
53-
- name: policies-config
54-
mountPath: /etc/openhanami/policies
55-
subPath: policies
51+
mountPath: /etc/openhanami/hanami.toml
52+
subPath: hanami.toml
5653
- name: token-key
5754
mountPath: /etc/openhanami/token_key
5855
subPath: token_key
@@ -76,9 +73,6 @@ spec:
7673
- name: hanami-config
7774
configMap:
7875
name: hanami-config
79-
- name: policies-config
80-
configMap:
81-
name: policies-config
8276
- name: token-key
8377
secret:
8478
secretName: token-key

0 commit comments

Comments
 (0)