-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·73 lines (63 loc) · 3.42 KB
/
install.sh
File metadata and controls
executable file
·73 lines (63 loc) · 3.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
# Ensure uv is installed — https://docs.astral.sh/uv/getting-started/installation/
# uv is only needed during this install script; the runtime wrappers activate
# the venv directly, so they don't need uv on PATH.
if ! command -v uv >/dev/null 2>&1; then
echo "uv not found — installing via the official installer..."
curl -LsSf https://astral.sh/uv/install.sh | sh
# The installer drops uv at ~/.local/bin/uv but does not touch the
# current shell's PATH, so add it explicitly for the rest of this script.
export PATH="$HOME/.local/bin:$PATH"
if ! command -v uv >/dev/null 2>&1; then
echo "uv installation failed. See https://docs.astral.sh/uv/getting-started/installation/"
exit 1
fi
fi
# Give current user permission to write to /var/lib/topologic
sudo mkdir -p /var/lib/topologic
sudo chown -R $USER:$USER /var/lib/topologic
# Install a uv-managed Python 3.12
uv python install 3.12
# Copy the Python project (pyproject.toml + uv.lock + topologic package) into place,
# then sync the venv from the lockfile. The venv lives at /var/lib/topologic/topologic_env
# (visible top-level path rather than a hidden `.venv` inside the project).
rm -rf /var/lib/topologic/lib
cp -R lib /var/lib/topologic/lib
( cd /var/lib/topologic/lib && UV_PROJECT_ENVIRONMENT=/var/lib/topologic/topologic_env uv sync --frozen )
# The labeler lives in its own package + venv because it needs a newer
# `transformers` than spacy-transformers allows in the main env. The main
# topologic pipeline shells out to `topologic-labeler` on demand.
rm -rf /var/lib/topologic/labeler
cp -R labeler /var/lib/topologic/labeler
( cd /var/lib/topologic/labeler && UV_PROJECT_ENVIRONMENT=/var/lib/topologic/topologic_labeler_env uv sync --frozen )
sudo ln -sf /var/lib/topologic/topologic_labeler_env/bin/topologic-labeler /usr/local/bin/topologic-labeler
# Install the topologic script
sudo cp topologic /usr/local/bin/
sudo chmod +x /usr/local/bin/topologic
echo -e "\nMoving web application components into place..."
if [ ! -f /etc/topologic/global_settings.ini ]
then
sudo mkdir -p /etc/topologic/
sudo cp config/global_settings.ini /etc/topologic/
echo "Storage is DuckDB — no database server setup required. Each trained model gets its own model.duckdb file inside its webapp directory."
else
echo "/etc/topologic/global_settings.ini already exists, not modifying..."
fi
sudo mkdir -p /var/lib/topologic/api_server/
sudo chown -R $USER:$USER /var/lib/topologic/api_server
cp api_server/web_server.sh /var/lib/topologic/api_server/
if [ ! -f /var/lib/topologic/api_server/gunicorn.conf.py ]
then
cp api_server/gunicorn.conf.py /var/lib/topologic/api_server/
else
echo "/var/lib/topologic/api_server/gunicorn.conf.py already exists, not modifying..."
fi
cp -R api /var/lib/topologic/
rm -rf /var/lib/topologic/web-app
# Copy everything except node_modules and the pre-built dist; the dist is
# regenerated per-deployment by the topologic CLI (which writes appConfig.json
# and then runs `npm install && npm run build` in the target directory).
rsync -a --exclude node_modules --exclude dist web-app/ /var/lib/topologic/web-app/
rm -rf /var/lib/topologic/config
cp -Rf config /var/lib/topologic
echo -e "\n## IMPORTANT ##\nTopoLogic runs behind the Gunicorn web server. Make sure you configure the Gunicorn config file in /var/lib/topologic/api_server/gunicorn.conf.py. You should also make sure it autostarts on boot.\n"