Skip to content

Commit 5d262c1

Browse files
committed
WIP: support running CHIME under Habitat
1 parent 330792c commit 5d262c1

File tree

7 files changed

+74
-0
lines changed

7 files changed

+74
-0
lines changed

.bldr.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[chime]
2+
plan_path = "habitat"
3+
paths = [
4+
"habitat/*",
5+
".bldr.toml",
6+
"src/*",
7+
]

.envrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export HAB_DOCKER_OPTS="-p 8000:8000"
2+
export HAB_STUDIO_SUP="false"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,4 @@ venv.bak/
1616
# mypy
1717
.mypy_cache/
1818
__pycache__/
19+
results/

.studiorc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export HAB_HART_COMPRESSION_LEVEL=0 # disables compression to speed up local dev

habitat/config/.streamlit/config.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[server]
2+
enableCORS = false
3+
headless = true
4+
port = 8000

habitat/hooks/run

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/sh
2+
export HOME="/hab/svc/chime/config"
3+
cd "/hab/svc/chime"
4+
5+
if [ "$(whoami)" = "root" ]; then
6+
exec chpst \
7+
-U root:hab \
8+
-u root:hab \
9+
streamlit run "{{pkg.path}}/app.py" 2>&1
10+
else
11+
exec streamlit run "{{pkg.path}}/app.py" 2>&1
12+
fi

habitat/plan.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
pkg_origin="bixu"
2+
pkg_name="chime"
3+
pkg_version="0.1.0"
4+
pkg_maintainer="Blake Irvin <[email protected]>"
5+
pkg_license=('MIT')
6+
pkg_deps=(
7+
"core/python"
8+
"core/sudo"
9+
"core/dbus"
10+
)
11+
pkg_build_deps=(
12+
"core/make"
13+
"core/git"
14+
)
15+
pkg_bin_dirs=(
16+
"bin"
17+
)
18+
pkg_svc_user="root"
19+
20+
do_prepare() {
21+
if ! ls "/etc/sudoers" &> "/dev/null"
22+
then
23+
echo "root ALL=(ALL) ALL" >> "/etc/sudoers"
24+
fi
25+
python -m venv "${pkg_prefix}"
26+
source "${pkg_prefix}/bin/activate"
27+
pip install --upgrade --force-reinstall "pip" "wheel"
28+
return $?
29+
}
30+
31+
do_build() {
32+
pip install -r ${PLAN_CONTEXT}/../requirements.txt
33+
return $?
34+
}
35+
36+
do_install() {
37+
cp -pr ${PLAN_CONTEXT}/../src/* "${pkg_prefix}/"
38+
return $?
39+
}
40+
41+
do_check() {
42+
return 0
43+
}
44+
45+
do_strip() {
46+
return 0
47+
}

0 commit comments

Comments
 (0)