Skip to content

Integrations DigitalOcean

remsky edited this page Feb 14, 2025 · 1 revision

Quick Guide: Running kokoro-fastapi on DigitalOcean

Caution

There's no security on the API itself yet, though will add it in shortly.

This means anybody who knows the droplet IP, will be able to access the interface and API freely unless you add additional security. See the section on the DigitalOcean firewall below for an interim solution

This guide will help you deploy and run the kokoro-fastapi Docker container on a DigitalOcean Droplet.

Replace the placeholder values (e.g., YOUR_USERNAME, YOUR_DROPLET_IP) with your actual account and instance details.


1. Set Up Your DigitalOcean Account & Droplet

  • Sign Up / Log In:
    Create or log into your DigitalOcean account

  • Create a Droplet:
    Use the DigitalOcean dashboard to create a new Droplet.

    • Choose the Docker Droplet image to have Docker and Docker Compose pre-installed, on Ubuntu.
    • Choose resources with at least 4gb of memory (may be able to get away with 2gb with some optimizing, but I haven't tested it)

Here's the version I used.

image

2. Generate & Configure Your SSH Keys (If Needed)

If you haven't already set up an SSH key pair, follow their guide to creating one on your local machine, and adding it to the droplet config

https://docs.digitalocean.com/products/droplets/how-to/add-ssh-keys/

e.g:

# Generate a new SSH key pair
ssh-keygen
  • When prompted, choose the default location or specify a different file.
  • Optionally, set a passphrase.

Once generated, display your public key:

cat ~/.ssh/id_rsa.pub

Copy the output and add it to your DigitalOcean account under Security > SSH Keys.

3. Connect to Your Droplet

Once your Droplet is set up, note its public IP address (for example, YOUR_DROPLET_IP). Use SSH to connect:

ssh root@YOUR_DROPLET_IP
  • Note: If this is your first time connecting, you'll be asked to confirm the host's authenticity. Type yes to continue.

4. Run the kokoro-fastapi Docker Container

As Docker is pre-installed, run the following command on your Droplet (within the ssh connection) and you're in:

docker run -p 8880:8880 ghcr.io/remsky/kokoro-fastapi-cpu:v0.2.2

This command will:

  • Pull the image from GitHub Container Registry if it isn’t already available locally.
  • Map port 8880 from the container to port 8880 on the Droplet.

5. Access the Web Interface

Once the container is running, the logs will indicate that the web player is available.

Ignore the printed IP address. Open your browser and navigate to:

http://YOUR_DROPLET_IP:8880/web/

You should now see the kokoro-fastapi web interface.


6. DigitalOcean Firewall

By default, anyone who knows your Droplet's public IP can freely access the interface and API. To enhance security, consider restricting access using DigitalOcean’s firewall settings.

You can allow-list only specific IPs (such as your own) to limit exposure. However, ensure that this method aligns with your security needs, as relying solely on it may not be sufficient for full protection.

Find Your Public IP

Run the following command to get your IP address:

curl -s https://checkip.amazonaws.com
# Example output: 192.123.123.123

Use this IP to configure DigitalOcean’s firewall settings.

DigitalOcean Firewall Settings

Be sure to review and verify your security settings before relying on this method.