Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Deploy ASI Application

on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
workflow_dispatch:

jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Verify Python files syntax
run: |
python -m py_compile asi.py
python -m py_compile aeon.py

- name: Run basic import test
run: |
python -c "import asi; import aeon; print('Imports successful')"

build-docker:
runs-on: ubuntu-latest
needs: test
permissions:
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build Docker image
run: |
docker build -t asi-app:latest .

- name: Test Docker image
run: |
docker run --rm asi-app:latest python -c "import asi; print('Docker image works')"

- name: Save Docker image
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
run: |
docker save asi-app:latest | gzip > asi-app.tar.gz

- name: Upload Docker image artifact
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
uses: actions/upload-artifact@v4
with:
name: asi-docker-image
path: asi-app.tar.gz
retention-days: 7

deploy:
runs-on: ubuntu-latest
needs: build-docker
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
permissions:
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Deployment ready
run: |
echo "Application is ready for deployment"
echo "Docker image has been built and tested successfully"
echo "Use docker-compose up -d to deploy locally"
57 changes: 57 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# Virtual environments
venv/
ENV/
env/
.venv

# IDE
.vscode/
.idea/
*.swp
*.swo
*~
.DS_Store

# Data and memory files
genesis_memory.pkl
data/
*.pkl

# Docker
.dockerignore

# Logs
*.log

# Testing
.pytest_cache/
.coverage
htmlcov/

# OS
Thumbs.db
205 changes: 205 additions & 0 deletions DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
# ASI Application Deployment Guide

This guide provides instructions for deploying the ASI (Artificial Super Intelligence) application.

## Prerequisites

- Docker and Docker Compose installed
- Python 3.11 or higher (for local development)
- Git

## Quick Start with Docker

### 1. Build and Run with Docker Compose

The easiest way to deploy is using Docker Compose:

```bash
# Clone the repository
git clone https://github.com/DOUGLASDAVIS08161978/asi.git
cd asi

# Build and start the application
docker-compose up -d

# View logs
docker-compose logs -f

# Stop the application
docker-compose down
```

### 2. Build and Run with Docker

Alternatively, you can use Docker directly:

```bash
# Build the image
docker build -t asi-app:latest .

# Run the container
docker run -d \
--name asi-app \
-v $(pwd)/data:/app/data \
asi-app:latest

# View logs
docker logs -f asi-app

# Stop the container
docker stop asi-app
docker rm asi-app
```

## Local Development Deployment

### 1. Set up Python environment

```bash
# Create virtual environment
python3 -m venv venv

# Activate virtual environment
source venv/bin/activate # On Linux/Mac
# or
venv\Scripts\activate # On Windows

# Install dependencies
pip install -r requirements.txt
```

### 2. Run the application

```bash
# Run the main ASI script
python asi.py

# Or run AEON script
python aeon.py
```

## CI/CD Pipeline

The repository includes a GitHub Actions workflow that:

1. **Tests** - Validates Python syntax and imports
2. **Builds** - Creates Docker image
3. **Deploys** - Prepares artifacts for deployment

The workflow runs automatically on:
- Push to main/master branch
- Pull requests to main/master branch
- Manual trigger via workflow_dispatch

## Environment Variables

- `PYTHONUNBUFFERED=1` - Ensures Python output is not buffered
- `GENESIS_MEMORY_PATH=/app/data/genesis_memory.pkl` - Path for persistent memory storage

## Data Persistence

The application stores persistent memory in a pickle file. When using Docker:
- Data is stored in `./data` directory on the host
- This directory is mounted to `/app/data` in the container
- Memory persists across container restarts

## Deployment Options

### Option 1: Local Docker
Use Docker Compose for local deployment (recommended for development and testing).

### Option 2: Cloud Deployment

#### AWS
- Use AWS ECS or EKS to deploy the Docker container
- Store data in EFS or S3

#### Google Cloud
- Use Google Cloud Run or GKE
- Store data in Cloud Storage or Persistent Disks

#### Azure
- Use Azure Container Instances or AKS
- Store data in Azure Blob Storage or Azure Files

#### DigitalOcean
- Use DigitalOcean App Platform or Kubernetes
- Store data in Spaces or Volume storage

### Option 3: VPS Deployment
Deploy to any VPS (DigitalOcean, Linode, etc.):

```bash
# SSH into your server
ssh user@your-server

# Install Docker and Docker Compose
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

# Clone and deploy
git clone https://github.com/DOUGLASDAVIS08161978/asi.git
cd asi
docker-compose up -d
```

## Monitoring

### View Application Logs

```bash
# Docker Compose
docker-compose logs -f

# Docker
docker logs -f asi-app
```

### Check Container Status

```bash
# Docker Compose
docker-compose ps

# Docker
docker ps
```

## Troubleshooting

### Container won't start
- Check logs: `docker-compose logs`
- Verify dependencies: `pip install -r requirements.txt`
- Check disk space: `df -h`

### Memory persistence issues
- Ensure `./data` directory exists and is writable
- Check volume mounts: `docker inspect asi-app`

### Python errors
- Verify Python version: `python --version` (should be 3.11+)
- Reinstall dependencies: `pip install --upgrade -r requirements.txt`

## Security Considerations

1. **Data Protection** - Ensure the data directory has appropriate permissions
2. **Network Security** - Use firewalls to restrict access if deploying publicly
3. **Updates** - Regularly update dependencies and base Docker images

## Scaling

For production deployments:
1. Use orchestration tools like Kubernetes
2. Implement health checks
3. Set up monitoring and alerting
4. Use external data stores (databases, object storage)
5. Implement logging aggregation

## Support

For issues or questions:
- Open an issue on GitHub
- Check existing documentation
- Review logs for error messages
24 changes: 24 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Use Python 3.11 slim image as base
FROM python:3.11-slim

# Set working directory
WORKDIR /app

# Copy requirements first for better caching
COPY requirements.txt .

# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt

# Copy application files
COPY *.py ./

# Create directory for persistent memory
RUN mkdir -p /app/data

# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV GENESIS_MEMORY_PATH=/app/data/genesis_memory.pkl

# Default command - run the main ASI script
CMD ["python", "asi.py"]
Loading
Loading