-
-
Notifications
You must be signed in to change notification settings - Fork 438
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
bug: logto service is getting restarted and not running in self hosted Coolify #6535
Comments
Same here. Here is the log : 2024-09-04T15:23:30.854047018Z > cli |
problem continues |
Make sure you have run the database alteration scripts to upgrade your database too. |
no alterations |
I'm having a similar issue when attempting to upgrade from To revert, I had to go from the latest to the Previous Docker Compose with latest: image: svhd/logto:${TAG-latest} Docker Compose to revert back to image: 'svhd/logto:1.19' I also shelled into the Docker container running Logto to check for database alterations, and there were not any: /etc/logto # npx @logto/cli db alteration deploy
info Found 0 alteration to deploy |
@skyturtleio @JustMrMendez Have you guys upgrade your |
@charIeszhao you're right on the database alterations. Sorry about that. When I was shelling into my Docker container, it had already reverted back to Here is the error log when attempting to upgrade to 2024-09-20T19:12:36.498573264Z
2024-09-20T19:12:36.498664206Z > cli
2024-09-20T19:12:36.498673673Z > logto db seed --swe
2024-09-20T19:12:36.498677382Z
2024-09-20T19:12:37.560505928Z info Seeding skipped
2024-09-20T19:12:37.587172549Z npm notice
2024-09-20T19:12:37.587202065Z npm notice New patch version of npm available! 10.8.2 -> 10.8.3
2024-09-20T19:12:37.587206212Z npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.8.3
2024-09-20T19:12:37.587208897Z npm notice To update run: npm install -g npm@10.8.3
2024-09-20T19:12:37.587211233Z npm notice
2024-09-20T19:12:37.768354301Z
2024-09-20T19:12:37.768382305Z > start
2024-09-20T19:12:37.768388737Z > cd packages/core && NODE_ENV=production node .
2024-09-20T19:12:37.768393746Z
2024-09-20T19:12:38.699741189Z (node:44) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
2024-09-20T19:12:38.699778308Z (Use `node --trace-warnings ...` to show where the warning was created)
2024-09-20T19:12:40.919728328Z cache warn No Redis client initialized, skipping
2024-09-20T19:12:41.380557457Z pre error Found undeployed database alterations, you must deploy them first by npm run alteration deploy command.
2024-09-20T19:12:41.380576324Z
2024-09-20T19:12:41.380579419Z See https://docs.logto.io/docs/references/using-cli/database-alteration for reference.
2024-09-20T19:12:41.380581954Z
2024-09-20T19:12:41.380611069Z index error Error while initializing app:
2024-09-20T19:12:41.384797522Z index error Error: Undeployed database alterations found.
2024-09-20T19:12:41.384809636Z at checkAlterationState (file:///etc/logto/packages/core/build/main-F72FFTZD.js:26444:9)
2024-09-20T19:12:41.384812421Z at async Promise.all (index 0)
2024-09-20T19:12:41.384814526Z at async checkPreconditions (file:///etc/logto/packages/core/build/main-F72FFTZD.js:26408:3)
2024-09-20T19:12:41.384817020Z at async Promise.all (index 3)
2024-09-20T19:12:41.384819094Z at async file:///etc/logto/packages/core/build/main-F72FFTZD.js:26480:3 Is there a way to run the CLI command for database alterations, e.g. If not, I also saw an example job to run for database alterations in the deployment section of the Logto docs. I'm not too familiar with jobs in a Docker Compose file. Any chance you know where I could place this in the Docker Compose file? I've tried updating my Docker Compose a few times, but the build keeps failing. Coolify Docker Compose for Logto: services:
logto:
image: 'svhd/logto:${TAG-latest}'
depends_on:
postgres:
condition: service_healthy
entrypoint:
- sh
- '-c'
- 'npm run cli db seed -- --swe && npm start'
environment:
- TRUST_PROXY_HEADER=1
- 'DB_URL=postgres://${SERVICE_USER_POSTGRES}:${SERVICE_PASSWORD_POSTGRES}@postgres:5432/${POSTGRES_DB:-logto}'
- ENDPOINT=$LOGTO_ENDPOINT
- ADMIN_ENDPOINT=$LOGTO_ADMIN_ENDPOINT
healthcheck:
test:
- CMD-SHELL
- 'exit 0'
interval: 5s
timeout: 20s
retries: 10
postgres:
image: 'postgres:14-alpine'
user: postgres
environment:
POSTGRES_USER: '${SERVICE_USER_POSTGRES}'
POSTGRES_PASSWORD: '${SERVICE_PASSWORD_POSTGRES}'
POSTGRES_DB: '${POSTGRES_DB:-logto}'
volumes:
- 'logto-postgres-data:/var/lib/postgresql/data'
healthcheck:
test:
- CMD
- pg_isready
- '-U'
- $SERVICE_USER_POSTGRES
- '-d'
- $POSTGRES_DB
interval: 5s
timeout: 20s
retries: 10 Example database alteration from docs: apiVersion: batch/v1
kind: Job
metadata:
name: alteration
spec:
template:
spec:
containers:
- name: alteration
image: ghcr.io/logto-io/logto
imagePullPolicy: Always
env:
- name: CI
value: 'true'
- name: DB_URL
value: postgresql://user:password@localhost:5432/logto
command:
- /bin/sh
args:
- '-c'
- 'npm run alteration deploy latest'
restartPolicy: Never |
How about shelling into your docker container and upgrading |
@charIeszhao how do I upgrade the |
Can you do Also if you upgrade the latest docker image, you also have the latest version of CLI in the container shell env, as they are always shipped together. |
@charIeszhao thanks for the help, really appreciate it. I was able to run Yeah, I know the latest Docker image includes the CLI, but it was kind of a chicken and egg problem. When upgrading to the latest image (for Coolify at least), the container would keep restarting because there were database alterations that needed to be run. Because the container kept restarting, I wasn't able to shell into a container with Anyway, here is how I was able to upgrade Logto in Coolify:
|
@skyturtleio Thanks for the explaination and detailed steps! @capsmagick It seems we have a solution now, and I'm closing the ticket. Feel free to reopen it if necessary. |
When I pulled the latest release and updated the logto image in coolify the postgress container is working but the logto container is getting restarted continuously
Describe the bug
Expected behaviour
should be able to login to logto admin console.
How to reproduce?
Selfhost Coolify
Deploy Logto
Context
The text was updated successfully, but these errors were encountered: