Skip to content

Commit e8d03ed

Browse files
committed
feat: add release infrastructure and packaging scripts
1 parent 94ec012 commit e8d03ed

16 files changed

Lines changed: 374 additions & 23 deletions

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Dockerfile

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Simple Dockerfile for Terraphim Server
2+
FROM ubuntu:22.04
3+
4+
ARG RUST_VERSION=1.85.0
5+
6+
# Install system dependencies
7+
ENV DEBIAN_FRONTEND=noninteractive
8+
RUN apt-get update -qq && apt-get install -yqq --no-install-recommends \
9+
build-essential \
10+
bison \
11+
flex \
12+
ca-certificates \
13+
openssl \
14+
libssl-dev \
15+
pkg-config \
16+
git \
17+
curl \
18+
cmake \
19+
&& rm -rf /var/lib/apt/lists/*
20+
21+
# Install Rust
22+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${RUST_VERSION}
23+
ENV PATH="/root/.cargo/bin:$PATH"
24+
25+
WORKDIR /app
26+
27+
# Copy the source code
28+
COPY . .
29+
30+
# Build the application
31+
RUN cargo build --release --package terraphim_server
32+
33+
# Copy the binary to a location in PATH
34+
RUN cp target/release/terraphim_server /usr/local/bin/
35+
36+
# Create non-root user
37+
RUN useradd --create-home --shell /bin/bash terraphim
38+
RUN chown -R terraphim:terraphim /home/terraphim
39+
40+
# Switch to non-root user
41+
USER terraphim
42+
WORKDIR /home/terraphim
43+
44+
# Create config directory
45+
RUN mkdir -p .config/terraphim
46+
47+
# Environment variables
48+
ENV TERRAPHIM_SERVER_HOSTNAME="0.0.0.0:8000"
49+
ENV TERRAPHIM_SERVER_API_ENDPOINT="http://localhost:8000/api"
50+
ENV RUST_LOG="info"
51+
ENV RUST_BACKTRACE="1"
52+
53+
# Health check
54+
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
55+
CMD curl -f http://localhost:8000/health || exit 1
56+
57+
# Expose port
58+
EXPOSE 8000
59+
60+
# Default command
61+
ENTRYPOINT ["terraphim_server"]
62+
CMD ["--config", "/home/terraphim/.config/terraphim/config.json"]

PKGBUILD-server

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Maintainer: Terraphim Contributors <team@terraphim.ai>
2+
pkgname=terraphim-server
3+
pkgver=0.2.3
4+
pkgrel=1
5+
pkgdesc="Terraphim AI Server - Privacy-first AI assistant backend"
6+
arch=('x86_64')
7+
url="https://terraphim.ai"
8+
license=('Apache-2.0')
9+
depends=('glibc' 'openssl')
10+
makedepends=('rust' 'cargo')
11+
source=("$pkgname-$pkgver.tar.gz::https://github.com/terraphim/terraphim-ai/archive/refs/tags/v$pkgver.tar.gz")
12+
sha256sums=('SKIP')
13+
14+
prepare() {
15+
cd "$pkgname-$pkgver"
16+
export RUSTFLAGS="-C link-arg=-fuse-ld=lld"
17+
# Temporarily disable panic abort for building
18+
sed -i 's/panic = "abort"/# panic = "abort"/' .cargo/config.toml
19+
}
20+
21+
build() {
22+
cd "$pkgname-$pkgver"
23+
export RUSTFLAGS="-C link-arg=-fuse-ld=lld"
24+
cargo build --release --package terraphim_server
25+
}
26+
27+
check() {
28+
cd "$pkgname-$pkgver"
29+
cargo test --package terraphim_server
30+
}
31+
32+
package() {
33+
cd "$pkgname-$pkgver"
34+
install -Dm755 target/release/terraphim_server "$pkgdir/usr/bin/terraphim_server"
35+
install -Dm644 terraphim_server/default/*.json -t "$pkgdir/etc/terraphim-ai/"
36+
install -Dm644 README.md -t "$pkgdir/usr/share/doc/$pkgname/"
37+
install -Dm644 LICENSE-Apache-2.0 -t "$pkgdir/usr/share/licenses/$pkgname/"
38+
}

PKGBUILD-tui

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Maintainer: Terraphim Contributors <team@terraphim.ai>
2+
pkgname=terraphim-tui
3+
pkgver=0.2.3
4+
pkgrel=1
5+
pkgdesc="Terraphim TUI - Terminal User Interface for Terraphim AI"
6+
arch=('x86_64')
7+
url="https://terraphim.ai"
8+
license=('Apache-2.0')
9+
depends=('glibc' 'openssl')
10+
makedepends=('rust' 'cargo')
11+
source=("$pkgname-$pkgver.tar.gz::https://github.com/terraphim/terraphim-ai/archive/refs/tags/v$pkgver.tar.gz")
12+
sha256sums=('SKIP')
13+
14+
prepare() {
15+
cd "$pkgname-$pkgver"
16+
export RUSTFLAGS="-C link-arg=-fuse-ld=lld"
17+
# Temporarily disable panic abort for building
18+
sed -i 's/panic = "abort"/# panic = "abort"/' .cargo/config.toml
19+
}
20+
21+
build() {
22+
cd "$pkgname-$pkgver"
23+
export RUSTFLAGS="-C link-arg=-fuse-ld=lld"
24+
cargo build --release --package terraphim_tui --features repl-full
25+
}
26+
27+
check() {
28+
cd "$pkgname-$pkgver"
29+
cargo test --package terraphim_tui --features repl-full
30+
}
31+
32+
package() {
33+
cd "$pkgname-$pkgver"
34+
install -Dm755 target/release/terraphim-tui "$pkgdir/usr/bin/terraphim-tui"
35+
install -Dm644 README.md -t "$pkgdir/usr/share/doc/$pkgname/"
36+
install -Dm644 LICENSE-Apache-2.0 -t "$pkgdir/usr/share/licenses/$pkgname/"
37+
}

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,24 @@ Terraphim aims to bridge this gap by providing a privacy-first AI assistant that
3131

3232
## Getting Started
3333

34-
### Quick Start
34+
### 🚀 Quick Install (Recommended)
35+
36+
#### Option 1: Docker (Easiest)
37+
```bash
38+
# Automated Docker installation
39+
curl -fsSL https://raw.githubusercontent.com/terraphim/terraphim-ai/main/release/v0.2.3/docker-run.sh | bash
40+
```
41+
42+
#### Option 2: Binary Installation
43+
```bash
44+
# Automated source installation
45+
curl -fsSL https://raw.githubusercontent.com/terraphim/terraphim-ai/main/release/v0.2.3/install.sh | bash
46+
```
47+
48+
### 📚 Detailed Installation
49+
For detailed installation instructions, see our [Installation Guide](https://github.com/terraphim/terraphim-ai/blob/main/release/v0.2.3/README.md).
50+
51+
### 🛠️ Development Setup
3552

3653
1. **Clone the repository**:
3754
```bash

docker/Dockerfile.simple

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Simple Dockerfile for building Terraphim binaries
2+
FROM ubuntu:22.04
3+
4+
ARG RUST_VERSION=1.85.0
5+
6+
# Install system dependencies
7+
ENV DEBIAN_FRONTEND=noninteractive
8+
RUN apt-get update -qq && apt-get install -yqq --no-install-recommends \
9+
build-essential \
10+
bison \
11+
flex \
12+
ca-certificates \
13+
openssl \
14+
libssl-dev \
15+
pkg-config \
16+
git \
17+
curl \
18+
cmake \
19+
&& rm -rf /var/lib/apt/lists/*
20+
21+
# Install Rust
22+
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain ${RUST_VERSION}
23+
ENV PATH="/root/.cargo/bin:$PATH"
24+
25+
WORKDIR /code
26+
27+
# Copy dependency files first for better caching
28+
COPY Cargo.toml Cargo.lock ./
29+
COPY crates/ ./crates/
30+
COPY terraphim_server/ ./terraphim_server/
31+
COPY desktop/ ./desktop/
32+
33+
# Build the application
34+
RUN cargo build --release --package terraphim_server --package terraphim_tui
35+
36+
# Test the binaries
37+
RUN ./target/release/terraphim_server --version && \
38+
./target/release/terraphim-tui --version
39+
40+
# Copy binaries to output location
41+
RUN mkdir -p /release && \
42+
cp target/release/terraphim_server /release/ && \
43+
cp target/release/terraphim-tui /release/
44+
45+
WORKDIR /release
46+
CMD ["bash"]

terraphim-server-binary.spec

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Name: terraphim-server
2+
Version: 0.2.3
3+
Release: 1%{?dist}
4+
Summary: Terraphim AI Server - Privacy-first AI assistant backend
5+
6+
License: Apache-2.0
7+
URL: https://terraphim.ai
8+
9+
%description
10+
Terraphim AI Server - Privacy-first AI assistant backend.
11+
Provides HTTP API for semantic search and knowledge graphs.
12+
Operates locally with support for multiple knowledge repositories.
13+
14+
%install
15+
mkdir -p %{buildroot}%{_bindir}
16+
mkdir -p %{buildroot}%{_sysconfdir}/terraphim-ai
17+
mkdir -p %{buildroot}%{_docdir}/%{name}
18+
mkdir -p %{buildroot}%{_licensedir}/%{name}
19+
20+
install -m755 target/release/terraphim_server %{buildroot}%{_bindir}/terraphim_server
21+
install -m644 terraphim_server/default/*.json %{buildroot}%{_sysconfdir}/terraphim-ai/
22+
install -m644 README.md %{buildroot}%{_docdir}/%{name}/
23+
install -m644 LICENSE-Apache-2.0 %{buildroot}%{_licensedir}/%{name}/
24+
25+
%files
26+
%license LICENSE-Apache-2.0
27+
%doc README.md
28+
%{_bindir}/terraphim_server
29+
%dir %{_sysconfdir}/terraphim-ai
30+
%config %{_sysconfdir}/terraphim-ai/*.json
31+
32+
%changelog
33+
* Mon Oct 14 2024 Terraphim Contributors <team@terraphim.ai> - 0.2.3-1
34+
- Initial binary RPM release
35+
- Privacy-first AI assistant backend
36+
- HTTP API for semantic search and knowledge graphs

terraphim-server.spec

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
Name: terraphim-server
2+
Version: 0.2.3
3+
Release: 1%{?dist}
4+
Summary: Terraphim AI Server - Privacy-first AI assistant backend
5+
6+
License: Apache-2.0
7+
URL: https://terraphim.ai
8+
Source0: %{name}-%{version}.tar.gz
9+
10+
BuildRequires: gcc rust cargo openssl-devel
11+
12+
%description
13+
Terraphim AI Server - Privacy-first AI assistant backend.
14+
Provides HTTP API for semantic search and knowledge graphs.
15+
Operates locally with support for multiple knowledge repositories.
16+
17+
%prep
18+
%autosetup
19+
20+
%build
21+
export RUSTFLAGS="-C link-arg=-fuse-ld=lld"
22+
cargo build --release --package terraphim_server
23+
24+
%install
25+
install -Dm755 target/release/terraphim_server %{buildroot}%{_bindir}/terraphim_server
26+
install -d %{buildroot}%{_sysconfdir}/terraphim-ai
27+
install -m644 terraphim_server/default/*.json %{buildroot}%{_sysconfdir}/terraphim-ai/
28+
install -d %{buildroot}%{_docdir}/%{name}
29+
install -m644 README.md %{buildroot}%{_docdir}/%{name}/
30+
install -d %{buildroot}%{_licensedir}/%{name}
31+
install -m644 LICENSE-Apache-2.0 %{buildroot}%{_licensedir}/%{name}/
32+
33+
%files
34+
%license LICENSE-Apache-2.0
35+
%doc README.md
36+
%{_bindir}/terraphim_server
37+
%dir %{_sysconfdir}/terraphim-ai
38+
%config %{_sysconfdir}/terraphim-ai/*.json
39+
40+
%changelog
41+
* Mon Oct 14 2024 Terraphim Contributors <team@terraphim.ai> - 0.2.3-1
42+
- Initial RPM release
43+
- Privacy-first AI assistant backend
44+
- HTTP API for semantic search and knowledge graphs

terraphim-tui-binary.spec

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Name: terraphim-tui
2+
Version: 0.2.3
3+
Release: 1%{?dist}
4+
Summary: Terraphim TUI - Terminal User Interface for Terraphim AI
5+
6+
License: Apache-2.0
7+
URL: https://terraphim.ai
8+
9+
%description
10+
Terraphim TUI - Terminal User Interface for Terraphim AI.
11+
Command-line interface with interactive REPL and ASCII graph visualization.
12+
Supports search, configuration management, and data exploration.
13+
14+
%install
15+
mkdir -p %{buildroot}%{_bindir}
16+
mkdir -p %{buildroot}%{_docdir}/%{name}
17+
mkdir -p %{buildroot}%{_licensedir}/%{name}
18+
19+
install -m755 target/release/terraphim-tui %{buildroot}%{_bindir}/terraphim-tui
20+
install -m644 README.md %{buildroot}%{_docdir}/%{name}/
21+
install -m644 LICENSE-Apache-2.0 %{buildroot}%{_licensedir}/%{name}/
22+
23+
%files
24+
%license LICENSE-Apache-2.0
25+
%doc README.md
26+
%{_bindir}/terraphim-tui
27+
28+
%changelog
29+
* Mon Oct 14 2024 Terraphim Contributors <team@terraphim.ai> - 0.2.3-1
30+
- Initial binary RPM release
31+
- Terminal User Interface for Terraphim AI
32+
- Interactive REPL and ASCII graph visualization

terraphim-tui.spec

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
Name: terraphim-tui
2+
Version: 0.2.3
3+
Release: 1%{?dist}
4+
Summary: Terraphim TUI - Terminal User Interface for Terraphim AI
5+
6+
License: Apache-2.0
7+
URL: https://terraphim.ai
8+
Source0: %{name}-%{version}.tar.gz
9+
10+
BuildRequires: gcc rust cargo openssl-devel
11+
12+
%description
13+
Terraphim TUI - Terminal User Interface for Terraphim AI.
14+
Command-line interface with interactive REPL and ASCII graph visualization.
15+
Supports search, configuration management, and data exploration.
16+
17+
%prep
18+
%autosetup
19+
20+
%build
21+
export RUSTFLAGS="-C link-arg=-fuse-ld=lld"
22+
cargo build --release --package terraphim_tui --features repl-full
23+
24+
%install
25+
install -Dm755 target/release/terraphim-tui %{buildroot}%{_bindir}/terraphim-tui
26+
install -d %{buildroot}%{_docdir}/%{name}
27+
install -m644 README.md %{buildroot}%{_docdir}/%{name}/
28+
install -d %{buildroot}%{_licensedir}/%{name}
29+
install -m644 LICENSE-Apache-2.0 %{buildroot}%{_licensedir}/%{name}/
30+
31+
%files
32+
%license LICENSE-Apache-2.0
33+
%doc README.md
34+
%{_bindir}/terraphim-tui
35+
36+
%changelog
37+
* Mon Oct 14 2024 Terraphim Contributors <team@terraphim.ai> - 0.2.3-1
38+
- Initial RPM release
39+
- Terminal User Interface for Terraphim AI
40+
- Interactive REPL and ASCII graph visualization

0 commit comments

Comments
 (0)