JackEllis / singlestoredb-fly

You can use this repo to quickly run SingleStoreDB on Fly.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SingleStoreDB on Fly.io

This project contains everything you need to run SingleStoreDB on Fly.io for development. This deployment is not supported for production workloads or benchmarks so please keep that in mind when using it. Internally, this project uses the singlestoredb-dev-image, please see the documentation for that project if you want to customize the deployment.

If you have any questions or issues, please file an issue on the GitHub repo or our forums.

Quick Start

Before you can run this application you will need to get a free SingleStore License key. Sign up for a SingleStore account and then grab your license key from the customer portal to use below.

You will also need to install flyctl and sign up for a Fly.io account before continuing.

Next, follow these steps to deploy SingleStoreDB on your Fly.io account:

git clone https://github.com/singlestore-labs/singlestoredb-fly
cd singlestoredb-fly

# initialize the application on your Fly.io account
# with the singlestoredb-dev image
flyctl launch --copy-config --no-deploy \
  --image ghcr.io/singlestore-labs/singlestoredb-dev

# decide what size app to launch
# see sizes here: https://fly.io/docs/about/pricing/#virtual-machines
# dedicated-cpu-1x is minimum recommended size
flyctl scale vm dedicated-cpu-1x

# set your SingleStoreDB license key and root password like so:
flyctl secrets set SINGLESTORE_LICENSE="YOUR LICENSE KEY" ROOT_PASSWORD="SINGLESTORE PASSWORD"

# create volume to store SingleStoreDB data
flyctl volume create singlestoredb_data --size 30

# deploy the fly application
flyctl deploy

# check the logs
flyctl logs

# check SingleStoreDB status
flyctl status

# stop SingleStoreDB
flyctl scale count 0

# start SingleStoreDB
flyctl scale count 1

# destroy the app
flyctl destroy

Connect to SingleStoreDB

Once SingleStoreDB is running in Fly.io, you can connect to it using either the app IP or hostname. You can retrieve the app IP using flyctl ips list or open up the Studio console using flyctl open.

Note The Fly.io hostname (looks like app-name.fly.dev) can take a couple minutes to resolve, so if it doesn't work right away just use the IP address for now.

Once you have either the hostname or the IP, you can also run a local mysql shell like so:

mysql -u root -h <fly app ip> -p

The Data API can also be accessed over HTTPS on port 9000 using your app hostname (app-name.fly.dev) like so:

~ ➜ curl -s -XPOST -H "content-type: application/json" -d '{ "sql": "select 1" }' root:YOUR_ROOT_PASSWORD@APP_NAME.fly.dev:9000/api/v1/query/rows
{
  "results": [
    {
      "rows": [ { "1": 1 } ]
    }
  ]
}

Note For more information on how to use the Data API please visit the documentation.

Where can I learn how to use SingleStoreDB?

Now that you have SingleStore running, please check out the following sections of our official documentation for guides on what to do next.

About

You can use this repo to quickly run SingleStoreDB on Fly.io