Files
internalai-setup/README.md

302 lines
7.2 KiB
Markdown

# InternalAI Platform Setup
Official installer for the InternalAI Platform - a multi-service monorepo platform combining Python backends and TypeScript frontends for internal tools.
## Quick Start
Run this one-liner to install the InternalAI platform:
```bash
curl -fsSL https://gitea.app.monadical.io/monadical/internalai-setup/raw/branch/main/install.sh | bash
```
This will:
1. Check system dependencies (git, docker, docker compose, bash)
2. Install missing dependencies (just, uv)
3. Set up Gitea authentication
4. Clone the InternalAI platform repository
5. Configure git credentials
6. Install the `internalai` command-line tool
## Prerequisites
Before installing, ensure you have:
- **Git** - Version control system
- **Docker** - Container runtime (v20.10+)
- **Docker Compose** - Container orchestration (v2.0+)
- **Just** - Command runner (will auto-install if missing)
- **uv** - Python package manager (will auto-install if missing)
### Platform Requirements
- **macOS** 10.15+ or **Linux** (Ubuntu 20.04+, Debian 11+, etc.)
- **4GB RAM** minimum (8GB+ recommended)
- **10GB disk space** for platform and data
- **Ports available**: 42000 (or custom port)
## Authentication
The InternalAI platform repository is private. You'll need one of:
### Option 1: Personal Access Token (Recommended)
1. Go to [Gitea Token Settings](https://gitea.app.monadical.io/user/settings/applications)
2. Click "Generate New Token"
3. Give it a name (e.g., "InternalAI Setup")
4. Select the `repo` scope
5. Click "Generate Token" and copy it
6. Enter the token when prompted by the installer
### Option 2: SSH Key
1. Generate an SSH key if you don't have one:
```bash
ssh-keygen -t ed25519 -C "your.email@monadical.com"
```
2. Add your SSH key to [Gitea SSH Settings](https://gitea.app.monadical.io/user/settings/keys)
3. Select SSH authentication when prompted by the installer
## Installation Steps
### 1. Run the Installer
```bash
curl -fsSL https://gitea.app.monadical.io/monadical/internalai-setup/raw/branch/main/install.sh | bash
```
### 2. Follow the Prompts
The installer will guide you through:
- Dependency checking
- Authentication setup
- Repository cloning
- CLI installation
### 3. Configure the Platform
After installation, run:
```bash
internalai install
```
This will:
- Set up environment configuration
- Configure API keys (Hunter.io, Apollo.io, LLM)
- Set up Caddy reverse proxy with authentication
- Optionally configure HTTPS with a custom domain
- Create data directories
- Build and start all services
### 4. Verify Installation
Check the platform status:
```bash
internalai status
```
## Default Installation Location
The platform installs to: `$HOME/internalai`
You can change this during setup or set the `PLATFORM_ROOT` environment variable.
## CLI Commands
After installation, use these commands:
```bash
internalai install # Full platform setup
internalai start # Start all services
internalai stop # Stop all services
internalai restart # Restart services
internalai status # Show service status
internalai logs [svc] # View logs
internalai upgrade # Upgrade platform
internalai caddy # Manage Caddy proxy
internalai help # Show all commands
```
## Services
The platform includes:
- **ContactDB** - Unified contact management with relationship tracking
- **DataIndex** - Data aggregation and semantic search engine
- **Meeting Prep** - AI-powered meeting preparation assistant
- **Caddy** - Reverse proxy with authentication
## Accessing the Platform
Once started, access services at:
- **Dashboard**: http://localhost:42000 (or your configured URL)
- **ContactDB**: http://localhost:42000/contactdb/
- **DataIndex**: http://localhost:42000/dataindex/
- **Meeting Prep**: http://localhost:42000/meeting-prep/
Default credentials (if authentication is enabled):
- **Username**: `admin`
- **Password**: Generated during setup (saved in cache)
## Configuration
### Environment Variables
Configuration is stored in `$HOME/internalai/.env`
Key variables:
- `PLATFORM_BASE_URL` - Base URL for the platform
- `CONTACTDB_SELF_EMAIL` - Your email for contact management
- `SHARED_HUNTER_API_KEY` - Hunter.io API key
- `SHARED_APOLLO_API_KEY` - Apollo.io API key
- `SHARED_LLM_API_KEY` - LLM API key
### Credential Cache
Credentials are cached in `$HOME/internalai/.credentials.cache`
You can optionally encrypt this cache with AES-256-CBC during installation.
View or edit the cache:
```bash
internalai cache show
internalai cache edit
```
## Updating the CLI
To update the CLI tool to the latest version:
```bash
internalai update
```
This will re-download and reinstall the CLI from the latest version in the repository.
## Troubleshooting
### Dependencies Not Found
If the installer can't find Docker, Just, or other dependencies:
**macOS:**
```bash
brew install docker just
```
**Linux:**
```bash
# Docker (Ubuntu/Debian)
curl -fsSL https://get.docker.com | sh
# Just
cargo install just # Or download from releases
```
### Authentication Failed
If git clone fails with authentication error:
1. **For Token auth**: Verify your token has `repo` scope
2. **For SSH auth**: Test connection with `ssh -T git@gitea.app.monadical.io`
3. Check you're a member of the Monadical organization on Gitea
### Port Already in Use
If port 42000 is already in use, you can change it:
1. Edit `$HOME/internalai/.env`
2. Change `PLATFORM_BASE_URL=http://localhost:YOURPORT`
3. Restart: `internalai restart`
### Services Won't Start
Check logs for specific services:
```bash
internalai logs contactdb
internalai logs dataindex
```
Common issues:
- Docker not running: `docker info` should work
- Port conflicts: Check with `lsof -i :42000`
- Permission issues: Ensure Docker doesn't require sudo
## Manual Installation
If the automated installer doesn't work, you can install manually:
1. Clone the repository:
```bash
git clone git@gitea.app.monadical.io:monadical/internalai.git ~/internalai
cd ~/internalai
```
2. Install the CLI:
```bash
sudo cp scripts/internalai /usr/local/bin/internalai
sudo chmod +x /usr/local/bin/internalai
```
3. Configure the platform:
```bash
internalai install
```
## Uninstallation
To remove the InternalAI platform:
```bash
cd ~/internalai
just down # Stop services
cd ~
rm -rf ~/internalai # Remove platform files
sudo rm /usr/local/bin/internalai # Remove CLI
```
## Development
### Repository Structure
```
internalai-setup/
├── install.sh # Complete installation script
└── README.md # This file
```
The installer handles:
- Dependency checking and installation (just, uv)
- Gitea authentication (token or SSH)
- Repository cloning
- Git credential configuration
- CLI tool installation
The actual platform code is in the private `internalai` repository.
### Contributing
To contribute to the installer:
1. Fork the `internalai-setup` repository
2. Make your changes
3. Test thoroughly
4. Submit a pull request
## Support
For issues or questions:
- **Platform Issues**: Check `~/internalai/docs/`
- **CLI Issues**: Run `internalai help`
- **Setup Issues**: Create an issue in this repository
## License
Copyright © 2024 Monadical SAS. All rights reserved.