Skip to content

Commit

Permalink
Fix: added REDIS url in dockerfile
Browse files Browse the repository at this point in the history
* chore(cli): double quotes

* Moving DB_URL composition to CMD

* chore(core): added redis

* chore(console): added redis url to package.json

* chore(cli): forced urls

* chore(cli): added REDIS USER

* chore(cli): encoded password

* chore(cli): added quotes to jq command

* chore(cli): added quotes to jq command

* chore(cli): updated jq command

* chore(cli): removed Redis for local deployment

* chore(core): removed redis url logging

* chore(core): removed redis auth

---------

Co-authored-by: William Monteiro <william.wd@gmail.com>
  • Loading branch information
SamSalvatico and williamwd authored May 8, 2024
1 parent 7f139dc commit a678ab4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ ENV PORT=3301
ENV ADMIN_PORT=3302
WORKDIR /etc/logto
COPY --from=builder /etc/logto .
RUN apk add --no-cache jq
EXPOSE 3301
EXPOSE 3302

ENTRYPOINT ["sh", "-c", "npm run cli db seed -- --swe && npm run ogcio:start"]
CMD [ "sh", "-c", "export ENCODED_PASSWORD=$(jq --slurp --raw-input --raw-output @uri <(printf \"%s\" $POSTGRES_PASSWORD)) && export DB_URL=\"postgres://$POSTGRES_USER:$ENCODED_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB_NAME\" && export REDIS_URL=\"redis://$REDIS_HOST:$REDIS_PORT\" && npm run cli db seed -- --swe && npm run cli db alteration deploy latest && npm run ogcio:start"]
1 change: 0 additions & 1 deletion docker-compose-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ services:
user: postgres
volumes:
- db:/var/lib/postgresql/data

environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: p0stgr3s
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dev:cloud": "IS_CLOUD=1 CONSOLE_PUBLIC_URL=/ pnpm dev",
"start:dev": "pnpm -r --parallel --filter=!@logto/integration-tests --filter \"!./packages/connectors/connector-*\" dev",
"start": "cd packages/core && NODE_ENV=production node .",
"ogcio:start": "cd packages/core && DB_URL=${DB_URL:-postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB_NAME} NODE_ENV=production node .",
"ogcio:start": "cd packages/core && node .",
"cli": "logto",
"changeset": "changeset",
"alteration": "logto db alt",
Expand Down
1 change: 1 addition & 0 deletions packages/core/src/caches/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export class RedisCache implements CacheStore {
url: conditional(!yes(redisUrl) && redisUrl),
});
this.client.on('error', (error) => {
consoleLog.error('Redis error', error);
void appInsights.trackException(error);
});
}
Expand Down

0 comments on commit a678ab4

Please sign in to comment.