Umami not responding
-
@guyds said in Umami not responding:
Isn't there any way I can try to manually run the migration script in recovery mode?
Sure, you should be able to run the migration script in recovery mode. But the issue was that the upstream migration script is not working/complete in all situations, from what I remember. But yes, give it a try .
As for backups, restoring should work. What was the issue there? Just clone the app from backup and check the logs?
-
@girish said in Umami not responding:
@guyds said in Umami not responding:
Isn't there any way I can try to manually run the migration script in recovery mode?
Sure, you should be able to run the migration script in recovery mode. But the issue was that the upstream migration script is not working/complete in all situations, from what I remember. But yes, give it a try .
And how can I do that?
I already tried the instructions from the Umami website, but that doesn't work at all (some npm errors about prisma)As for backups, restoring should work. What was the issue there? Just clone the app from backup and check the logs?
The issue was that whenever I restored a backup, recent or from several weeks ago, the app still didn't start with the same errors in the logs.
-
@guyds so, I had to go back and look since it's been a while since Umami 2 was released. The changelog for package v3.0.0 already says that all event data is lost - https://git.cloudron.io/cloudron/umami-app/-/blob/master/CHANGELOG?ref_type=heads#L134 . Note that this is what upstream does - https://umami.is/docs/migrate-v1-v2#important . Bullet point 3 "The script will NOT migrate any event data into v2."
So, you have only two options:
- Either roll back to v2.4.2 package (which is the last release of umami 1). But of course, you are stuck here forever.
- Just start afresh. You lose all data anyway. Only thing retained with the migration is the websites. Even the tracker code/script is different.
Maybe we should have made a completely separate app for Umami 2 because for all practical purposes it's a different app from Umami 1...
-
@girish I understand this is not Cloudron's fault in any way.
i'm also aware that v2 is not backwards compatible with v1 in that the events can't be migrated.
And while that's definitely a real bummer, it should still be possible according to their docs to upgrade from v1 to v2 and keep all the existing accounts as well as all the websites and therefore also all the website ID's which are used by other people to look into the stats.
If I have to reinstall, I'll lose all the accounts and website id's.Rolling back to v2.4.2 is obviously not the best solution, but even if that could temporarily solve the situation I still can't because the backups can't be restored to a running state for some reason.
But yeah, I guess I have no other option than just starting from scratch.
That'll conclude a nice end of the week after having to deal with several other incompatible software upgrades this weekThanks anyway for you support!
And I know it's not your (nor Cloudron's) fault -
@guyds we are in sync about the situation
But to clarify, you should still be able to follow upstream instructions. It might be a bit different on Cloudron but you should atleast be able to try them out.
- You have to put the app in recovery mode. Repair -> Recovery
- Then, in a web terminal of the app, you can run whatever commands you want.
https://git.cloudron.io/cloudron/umami-app/-/blob/master/start.sh?ref_type=heads is the startup script of Cloudron. When in recovery mode, the app container is created but the start up script is not executed. So, you have to then execute the exports at https://git.cloudron.io/cloudron/umami-app/-/blob/master/start.sh?ref_type=heads#L11 manually in the web terminal. Hopefully, all this makes sense (if you have dealt with Docker before, it should be straightforward).
-
@girish said in Umami not responding:
@guyds we are in sync about the situation
Haha
But to clarify, you should still be able to follow upstream instructions. It might be a bit different on Cloudron but you should atleast be able to try them out.
- You have to put the app in recovery mode. Repair -> Recovery
- Then, in a web terminal of the app, you can run whatever commands you want.
https://git.cloudron.io/cloudron/umami-app/-/blob/master/start.sh?ref_type=heads is the startup script of Cloudron. When in recovery mode, the app container is created but the start up script is not executed. So, you have to then execute the exports at https://git.cloudron.io/cloudron/umami-app/-/blob/master/start.sh?ref_type=heads#L11 manually in the web terminal. Hopefully, all this makes sense (if you have dealt with Docker before, it should be straightforward).
Thanks for the pointers regarding the exports!
Initially, after the exports, I got the same error:
npx @umami/migrate-v1-v2@latest Running v0.15.0 /app/code/node_modules/.prisma/client/default.js:43 throw new Error( ^ Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again. In case this error is unexpected for you, please report it in https://pris.ly/prisma-prisma-bug-report at new PrismaClient (/app/code/node_modules/.prisma/client/default.js:43:11) at /root/.npm/_npx/429c6c96e109f52c/node_modules/@umami/migrate-v1-v2/index.js:298:12 at Object.<anonymous> (/root/.npm/_npx/429c6c96e109f52c/node_modules/@umami/migrate-v1-v2/index.js:323:3) at Module._compile (node:internal/modules/cjs/loader:1256:14) at Module._extensions..js (node:internal/modules/cjs/loader:1310:10) at Module.load (node:internal/modules/cjs/loader:1119:32) at Module._load (node:internal/modules/cjs/loader:960:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:86:12) at node:internal/main/run_main_module:23:47 Node.js v18.18.0
But I was able to locate the schema.prisma file, run prisma generate and then fix some other node issues until the migration finally worked:
npx @umami/migrate-v1-v2@latest Running v0.15.0 ā DATABASE_URL is defined. ā Database connection successful. ā Database v1 tables ready for migration. ā Database v2 tables found. ā Database is ready for migration. ā Starting v2 data migration. Please do no cancel this process, it may take a while. ā Ran sql file /db/postgresql/data-migration-v2.sql. ā Data migration from V1 to V2 tables completed. ā Do you want to delete V1 database tables? (Y/N) ā¦ n ā Migration successfully completed.
Now let's try to restart the app...
-
Unfortunately the app still won't start after the successful database migration.
It seams it tries to run another database migration during startup
Any clues?/app/pkg/start.sh ==> Changing ownership NOTICE: extension "pgcrypto" already exists, skipping CREATE EXTENSION => Running build script that generates the migrations yarn run v1.22.19 $ npm-run-all check-env build-db check-db build-tracker build-geo build-app $ node scripts/check-env.js $ npm-run-all copy-db-files build-db-client $ node scripts/copy-db-files.js Database type detected: postgresql Copied /app/code/db/postgresql to /app/code/prisma $ prisma generate Prisma schema loaded from prisma/schema.prisma ā Generated Prisma Client (v5.12.1) to ./node_modules/@prisma/client in 219ms Start using Prisma Client in Node.js (See: https://pris.ly/d/client)
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()or start using Prisma Client at the edge (See: https://pris.ly/d/accelerate)
import { PrismaClient } from '@prisma/client/edge'
const prisma = new PrismaClient()See other ways of importing Prisma Client: http://pris.ly/d/importing-client āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā Supercharge your Prisma Client with global database caching, ā ā scalable connection pooling and real-time database events. ā ā Explore Prisma Accelerate: https://pris.ly/cli/-accelerate ā ā Explore Prisma Pulse: https://pris.ly/cli/-pulse ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā ā Update available 5.12.1 -> 5.13.0 ā ā Run the following to update ā ā yarn add --dev prisma@latest ā ā yarn add @prisma/client@latest ā āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā $ node scripts/check-db.js ā DATABASE_URL is defined. ā Database connection successful. ā Database version check successful. Error: P3005 The database schema is not empty. Read more about how to baseline an existing production database: https://pris.ly/d/migrate-baseline ā Command failed: prisma migrate deploy Error: P3005 The database schema is not empty. Read more about how to baseline an existing production database: https://pris.ly/d/migrate-baseline error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. ERROR: "check-db" exited with 1. error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
-