Runway is a platform — you deploy your applications and use our services. We won’t lie and tell you that we don’t want you to use our services first, but Runway is really about being efficient: use what’s best for you.
In many cases, we don’t want to get into running everything — our vision is SQL database (PostgreSQL), cache and S3 compatible storage — everything beyond that should be third party.
Other examples for services you might want include: vector databases (qdrant), MySQL (PlanetScale) or let’s even say another PostgreSQL compatible one, like CockroachDB or Supabase.
In each one of these cases, the vendor allows you to create a database cluster of some kind and gives you credentials to use. When creating a database, select a region in the EU (or even Germany).
The credentials needed include the following:
The order of operations is always the same: add the credentials with runway app config set
and write the code to use the database. For brevity, we always fall back to panic()
for error handling — you know the drill!
qdrant is a vector database. qdrant can run on your own laptop or infrastructure, but also in their cloud. Once you setup your database (or created a cloud account), you will have to perform the following steps.
Install their go-client (sdk) into your project:
go get -u github.com/qdrant/go-client
Configure your application to have the credentials:
runway app config set \
QDRANT_HOSTNAME=your-host \
QDRANT_PORT=6334 \
QDRANT_USERNAME=username \
QDRANT_PASSWORD=password
The names of the variables are entirely up to you, but a prefix with the vendor name might be a good idea, if you have a lot of configuration.
Connecting to qdrant looks like this:
package main
import (
"context"
"crypto/tls"
"fmt"
"log"
pb "github.com/qdrant/go-client/qdrant"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/metadata"
)
func main() {
// Connect to Qdrant with TLS and auth
creds := credentials.NewTLS(&tls.Config{})
conn, err := grpc.Dial(fmt.Sprintf("%s:%s", os.Getenv("QDRANT_HOSTNAME"), os.Getenv("QDRANT_PORT"))),
grpc.WithTransportCredentials(creds),
)
if err != nil {
panic(err)
}
defer conn.Close()
client := pb.NewQdrantClient(conn)
// Create context with authentication
ctx := metadata.AppendToOutgoingContext(context.Background(),
"api-key", fmt.Sprintf("%s:%s",
os.Getenv("QDRANT_USERNAME"),
os.Getenv("QDRANT_PASSWORD"))),
)
collectionName := "my_collection"
// more
}
PlanetScale is a MySQL compatible database — great! The setup for that is very similar to what we described in the database guide.
Once you have setup your PlanetScale account and created a cluster, the connect modal will have the value you need for the DATABASE_URL
(they call it DSN
).
Use runway app config set DATABASE_URL=...
and then connect to your PlanetScale database from Runway.
Install the the MySQL driver for Golang:
go get -u github.com/go-sql-driver/mysql
And code away:
// Open a connection to the database
db, err = sql.Open("mysql", os.Getenv("DATABASE_URL"))
if err != nil {
panic("failed to open db connection: " + err.Error())
}
runway app config set DSN=...
and then run runway app deploy
Both of these vendor offer hosted PostgreSQL compatible databases. Sign-up for an account with either and then follow the database setup guide.