0

With the recent announcement of Planetscale shutting down its lower and free tiers I've found myself in a bit of a situation.

I have a Serverless app which is connected to a Mysql database in Planetscale and it's still not making enough money for me to justify the $40 price tag that Planetscale now offers.

I've set up a VPS with Docker and have started a Mysql container with the following docker-compose.yml:

version: "3.8" 

services:
  mysql-container:
    image: ubuntu/mysql
    container_name: mysql
    volumes:
      - /docker-volumes/mysql/mysql-volume:/var/lib/mysql
      - /docker-volumes/mysql/config:/etc/mysql/conf.d
    environment:
      - TZ=UTC
    ports:
      - "127.0.0.1:3306:3306"
    network_mode: host
    restart: unless-stopped

This works great, I can connect to it and my data is persisted. However, a couple of times throughout the day I'll get issues connecting to it because it's exhausted connections from Serverless functions.

I'm aware that Planetscale used to get around this with Vitess so I tried setting it up myself as a docker container.

I have found this official guide on setting up Vitess in Docker, however it seems like a huge docker-compose and I can't quite tell if it's something I should be using in production or not.

According to the Readme it starts the following applications as well:

  • vtctld web ui: http://localhost:15000
  • vttablets web ui: http://localhost:15101/debug/status http://localhost:15102/debug/status http://localhost:15103/debug/status
  • vtgate web ui: http://localhost:15099/debug/status
  • vtorc ui: http://localhost:13000

I can't quite tell if these are for development, either way all of them give me 404 aside from vttablets, which are marked as healthy.

Logs from docker seem to repeat the following on a loop, so obviously I've done something wrong:

vitess-dev-vreplication-1                    | + /vt/bin/vtctldclient --server vtctld:15999 GetTablets
vitess-dev-vreplication-1                    | + grep ext_
vitess-dev-vreplication-1                    | + grep primary
vitess-dev-vreplication-1                    | + echo 'waiting for external primary..'
vitess-dev-vreplication-1                    | + sleep 1
vitess-dev-vreplication-1                    | waiting for external primary..
vitess-dev-vtorc-1                           | E0308 09:45:30.636448       8 analysis_dao.go:414] ignoring keyspace ext_my_database because no durability_policy is set. Please set it using SetKeyspaceDurabilityPolicy
vitess-dev-vttablet100-1                     | I0308 09:45:30.972908       7 tablegc.go:215] TableGC - started execution of Close. Acquiring initMutex lock
vitess-dev-vttablet100-1                     | I0308 09:45:30.973006       7 tablegc.go:218] TableGC - acquired lock
vitess-dev-vttablet100-1                     | I0308 09:45:30.973013       7 tablegc.go:220] TableGC - no collector is open
vitess-dev-vttablet100-1                     | I0308 09:45:30.973016       7 engine.go:92] messager Engine - started execution of Close. Acquiring mu lock
vitess-dev-vttablet100-1                     | I0308 09:45:30.973149       7 engine.go:94] messager Engine - acquired mu lock
vitess-dev-vttablet100-1                     | I0308 09:45:30.973162       7 engine.go:97] messager Engine is not open
vitess-dev-vreplication-1                    | + /vt/bin/vtctldclient --server vtctld:15999 GetTablets

I'm really only interested in the connection pooling functionality of Vitess, is there a minimal example on how to set this up myself anywhere?

Does setting up and using Vitess require further knowledge of database/network internals? Is this something I shouldn't attempt to set up myself?

2
  • the ports part is wrong ` ports: # <Port exposed> : <MySQL Port running inside container> - '3306:3306'`
    – nbk
    Mar 8 at 9:56
  • What do you mean? The Mysql compose works fine? Mar 8 at 10:00

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.