Running on PlanetScale
PlanetScale is a MySQL-compatible serverless database platform. PlanetScale uses Vitess which doesn't support foreign keys and therefore we have to modify schema.mysql.sql
as explained below.
Setup
- Fork the https://github.com/umami-software/umami project to your GitHub account.
- Create a database on PlanetScale called
umami-db
and get its connection string (Hint: select "Prisma" from the "Connect with" menu). It should look something like this:mysql://username:password@host/umami-db?sslaccept=strict
- Add
DATABASE_URL
andHASH_SALT
(any random string) to you.env
file:
DATABASE_URL=mysql://username:password@host/umami-db?sslaccept=strict
HASH_SALT=any-random-string
- Open
schema.mysql.sql
and delete all lines starting withforeign key
and make sure to delete the dangling commas. - Download the PlanetScale CLI and authenticate with
pscale auth login
. - Create the tables by running the following command on the root of the project:
pscale shell umami-db main < sql/schema.mysql.sql
. - You should now be able to build and start Umami (
npm run build
followed bynpm start
). - Follow the Getting started guide starting from the Login step and be sure to change the default password.
Troubleshooting
If are getting an error like the following example:
PrismaClientInitializationError: Can't reach database server at `host.aws-region.psdb.cloud`:`3306`
You can try add a connection timeout query parameter on your DATABASE_URL
:
DATABASE_URL=mysql://username:password@host/umami-db?sslaccept=strict&connect_timeout=300