Skip to content

Getting_Started

Shannon Atkinson edited this page Oct 30, 2024 · 1 revision

Getting Started

This guide walks you through setting up and running the No-Code Architects Toolkit with Docker. You’ll find instructions for running it locally, on Google Cloud, or on DigitalOcean.


Prerequisites

Ensure the following are in place before you begin:

  • Docker: Install Docker on your machine. Download Docker
  • API Key: Generate a secure API_KEY to use for authentication.
  • Environment Variables: Set up the necessary environment variables based on your chosen deployment option.

Environment Variables

Configure the following environment variables depending on the storage provider you plan to use:

  • General Variables:

    • API_KEY: Authentication key for API requests.
    • GCP_SA_CREDENTIALS (optional): Google Cloud service account JSON key content for accessing Google Cloud Storage.
    • GDRIVE_USER (optional): Google Drive email for setting up Google Drive access.
  • Google Cloud Storage Variables:

    • GCP_BUCKET_NAME: Name of your Google Cloud Storage bucket for file storage.
  • S3-Compatible Storage Variables (DigitalOcean Spaces):

    • S3_ENDPOINT_URL: Endpoint for your S3-compatible storage service.
    • S3_ACCESS_KEY and S3_SECRET_KEY: Credentials for accessing the S3-compatible service.
    • S3_BUCKET_NAME: Name of your S3-compatible storage bucket.

Option 1: Running Locally with Docker

To run the toolkit locally using Docker, follow these steps:

  1. Build the Docker Image:

    docker build -t no-code-architects-toolkit .
  2. Run the Docker Container: Use one of the following commands based on your storage setup.

    • For Google Cloud Storage:

      docker run -p 8080:8080 \
         -e API_KEY=your_api_key \
         -e GCP_BUCKET_NAME=your_gcp_bucket_name \
         -e GCP_SA_CREDENTIALS='contents_of_your_service_account_json' \
         no-code-architects-toolkit
    • For Google Drive:

      • First, share the target Google Drive folder with the service account email provided by Google.
      • Then, run:
      docker run -p 8080:8080 \
         -e API_KEY=your_api_key \
         -e GDRIVE_USER=your_gdrive_user_email \
         -e GDRIVE_FOLDER_ID=your_folder_id \
         -e GCP_SA_CREDENTIALS='contents_of_your_service_account_json' \
         no-code-architects-toolkit
    • For S3-Compatible Storage (e.g., DigitalOcean Spaces):

      docker run -p 8080:8080 \
         -e API_KEY=your_api_key \
         -e S3_ENDPOINT_URL=https://nyc3.digitaloceanspaces.com \
         -e S3_ACCESS_KEY=your_s3_access_key \
         -e S3_SECRET_KEY=your_s3_secret_key \
         -e S3_BUCKET_NAME=your_bucket_name \
         no-code-architects-toolkit

Option 2: Deploying to Google Cloud with Docker

Google Cloud Run allows for serverless deployment of Docker containers. Follow these steps:

  1. Set Up Google Cloud Project:

    • Create a new project and enable Cloud Run and Google Cloud Storage APIs.
  2. Configure the Docker Image for Google Cloud Run:

    • Push the Docker image to a container registry (e.g., Google Container Registry):
      gcloud builds submit --tag gcr.io/YOUR_PROJECT_ID/no-code-architects-toolkit
  3. Deploy on Google Cloud Run:

    • Deploy the image to Cloud Run:
      gcloud run deploy no-code-architects-toolkit \
        --image gcr.io/YOUR_PROJECT_ID/no-code-architects-toolkit \
        --platform managed \
        --region us-central1 \
        --allow-unauthenticated \
        --set-env-vars API_KEY=your_api_key,GCP_BUCKET_NAME=your_gcp_bucket_name,GCP_SA_CREDENTIALS=your_service_account_json
  4. Access and Test:

    • Google Cloud Run will provide a URL where your service is running. Test it by making requests to the API, such as:
      curl -X POST https://your-service-url/authenticate -H "X-API-Key: your_api_key"

Option 3: Deploying on DigitalOcean App Platform

DigitalOcean App Platform offers a straightforward way to deploy Docker containers. Follow these steps:

  1. Create a DigitalOcean Account and App:

    • Create a new App in DigitalOcean, choose Container Image, and select the Deploy Docker Image option.
  2. Configure Environment Variables:

    • Add the necessary environment variables for your setup under “App Spec” > “Environment Variables”.
  3. Upload or Link the Docker Image:

    • Use DigitalOcean’s container registry or link your GitHub repository to build the Docker image.
  4. Select Scaling and Resource Options:

    • Set memory and CPU limits according to your application needs.
  5. Deploy and Test:

    • After deployment, DigitalOcean will provide a URL for your service. Test the endpoints using a similar method as described above.

Testing the Application

  1. Authenticate:

    • Make a POST request to verify that authentication is functioning correctly:
      curl -X POST http://localhost:8080/authenticate -H "X-API-Key: your_api_key"
  2. Convert Media to MP3:

    • Test media conversion by making a request to the /media-to-mp3 endpoint:
      curl -X POST http://localhost:8080/media-to-mp3 \
        -H "X-API-Key: your_api_key" \
        -H "Content-Type: application/json" \
        -d '{"media_url": "https://example.com/media.mp4", "webhook_url": "https://your-webhook.com"}'

This guide should help you set up and run the No-Code Architects Toolkit with Docker, whether locally, on Google Cloud, or on DigitalOcean. Let me know if you have any questions or need further customization!