Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Potential Solution to Replace Planetscale effectively #742

Open
rfrlcode opened this issue Apr 8, 2024 · 1 comment
Open

Potential Solution to Replace Planetscale effectively #742

rfrlcode opened this issue Apr 8, 2024 · 1 comment

Comments

@rfrlcode
Copy link

rfrlcode commented Apr 8, 2024

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:[email protected]: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:

  1. 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
  2. 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:[email protected]"

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!

Copy link

linear bot commented Apr 8, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant