Potential Solution to Replace Planetscale effectively
Opened this issue · 1 comments
I believe I might have found a way to replace planetscale with a different mysql provider, while keeping the features from planetscale.ts working completely.
First, startup a hosted mysql instance somewhere. Can be anywhere. I chose aiven.io.
Get the mysql uri from them. it will look like this:
mysql://username:password@hostname.a.aivencloud.com:28146/dbname?ssl-mode=REQUIRED
add this to your .env as the DATABASE_URL
We will now work on a way to deploy the docker image for the planetscale http sim.
Create a folder anywhere (can be named anything). This folder should contain two files:
-
docker-compose.yml
version: "3"
services:
planetscale-proxy:
build:
context: .
dockerfile: Dockerfile
environment:- MYSQL_DBNAME=dbname
- MYSQL_ADDR=hostname.a.aivencloud.com
- MYSQL_PORT=28146
-
Dockerfile
FROM ghcr.io/mattrobenolt/ps-http-sim:latest
CMD ["-listen-port=3900", "-mysql-dbname=dbname", "-mysql-addr=hostname.a.aivencloud.com", "-mysql-port=28146"]
Deploy this docker image anywhere. I used render.com for free hosting (upload the above folder with two files to github, and then deploy to render using github). render will give you a url like this: https://examples.onrender.com
Use the url, to add the following to your dub .env file (the username and password come from the mysql uri above)
PLANETSCALE_DATABASE_URL="https://username:password@examples.onrender.com"
now pnpm run dev, and everything should work as usual, and we dont have to pay the $$ for Planetscale.
Let me know what yall think, and if something can be improved!