Skip to content
Merged
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
4 changes: 3 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ services:
- .env

worker:
build: .
build:
context: .
dockerfile: dockerfile
command: arq core.workers.ingestion_worker.WorkerSettings
environment:
- JWT_SECRET_KEY=${JWT_SECRET_KEY:-your-secret-key-here}
Expand Down
72 changes: 72 additions & 0 deletions start.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/bash
set -e

# Function to check if Docker is running
check_docker() {
if ! docker info > /dev/null 2>&1; then
echo "Error: Docker is not running. Please start Docker and try again."
exit 1
fi
}

# Function to check if Docker Compose is installed
check_docker_compose() {
if ! docker compose version > /dev/null 2>&1; then
echo "Error: Docker Compose is not installed. Please install Docker Compose and try again."
exit 1
fi
}

# Function to create .env file if it doesn't exist
create_env_file() {
if [ ! -f .env ]; then
echo "Creating .env file..."
cat > .env << EOL
JWT_SECRET_KEY=your-secret-key-here
POSTGRES_URI=postgresql+asyncpg://morphik:morphik@postgres:5432/morphik
PGPASSWORD=morphik
HOST=0.0.0.0
PORT=8000
LOG_LEVEL=DEBUG
REDIS_HOST=redis
REDIS_PORT=6379
EOL
echo ".env file created successfully."
fi
}

# Function to create necessary directories
create_directories() {
mkdir -p storage logs
}

# Main execution
echo "Starting Morphik setup..."

# Check prerequisites
check_docker
check_docker_compose

# Create necessary files and directories
create_env_file
create_directories

# Build and start the containers
echo "Building and starting containers..."
docker compose build
docker compose up -d

# Wait for services to be ready
echo "Waiting for services to be ready..."
sleep 10

# Check if services are running
if ! docker compose ps | grep -q "Up"; then
echo "Error: Some services failed to start. Check the logs with 'docker compose logs'"
exit 1
fi

echo "Morphik is now running!"
echo "API is available at http://localhost:8000"
echo "To view logs, run: docker compose logs -f"
echo "To stop the services, run: docker compose down"