Skip to content
This repository has been archived by the owner on Jan 16, 2025. It is now read-only.

Commit

Permalink
feat: introduce docker-compose.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
dimitrisnl committed Jan 21, 2024
1 parent 61a1e32 commit 52711db
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 20 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.storybook
1 change: 0 additions & 1 deletion app/core/jobs/register-queue.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ const LOCK_DURATION = 1000 * 60 * 15;
export function registerQueue<T>(name: string, processor: Processor<T>) {
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (!registeredQueues[name]) {
console.log(connection);
const queue = new Queue(name, {connection});
const queueEvents = new QueueEvents(name, {
connection,
Expand Down
19 changes: 8 additions & 11 deletions app/core/redis/redis.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@ import {Redis} from 'ioredis';
import {config} from './config.server.ts';

function makeRedis() {
return new Redis(
`rediss://${config.REDIS_USER}:${config.REDIS_PASSWORD}@${config.REDIS_HOST}:${config.REDIS_PORT}`,
{
maxRetriesPerRequest: null,
lazyConnect: true,
retryStrategy(times) {
if (times > 20) return null; // return null to stop retrying
return Math.min(times * 500, 2000);
},
}
);
return new Redis({
username: config.REDIS_USER,
password: config.REDIS_PASSWORD,
host: config.REDIS_HOST,
port: config.REDIS_PORT,
maxRetriesPerRequest: null,
lazyConnect: true,
});
}

let redis: ReturnType<typeof makeRedis>;
Expand Down
2 changes: 1 addition & 1 deletion app/core/use-cases/create-user/create-user.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function createUserRecord({
db
.insert('users', {
id,
email,
email: email.toLowerCase(),
email_verified: false,
password: passwordHash,
name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function getInvitationRecords(email: User.User['email']) {
.select(
'membership_invitations',
{
email: email,
email: email.toLowerCase(),
status: 'PENDING',
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export const action = withAction(
ForbiddenActionError: () =>
Effect.fail(
new Forbidden({
errors: ["You don't have access to invite a team member"],
errors: ["You don't have access to do this action"],
})
),
ParseOrgSlugError: () =>
Expand Down
25 changes: 25 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: '3.8'
services:
db:
image: postgres:14.1-alpine
restart: always
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
ports:
- '5432:5432'
volumes:
- db:/var/lib/postgresql/data
cache:
image: redis:6.2-alpine
restart: always
ports:
- '6379:6379'
command: redis-server --save 20 1 --loglevel warning --requirepass eYVX7EwVmmxKPCDmwMtyKVge8oLd2t81
volumes:
- cache:/data
volumes:
db:
driver: local
cache:
driver: local
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-simple-import-sort": "^10.0.0",
"eslint-plugin-storybook": "^0.6.15",
"husky": "^8.0.3",
"prettier": "^3.2.4",
"prettier-eslint": "^16.3.0",
"prettier-plugin-packagejson": "^2.4.9",
Expand All @@ -112,6 +111,9 @@
"vite-tsconfig-paths": "^4.3.1",
"vitest": "^1.2.1"
},
"optionalDependencies": {
"husky": "^8.0.3"
},
"engines": {
"node": ">=18"
}
Expand Down
12 changes: 8 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 52711db

Please sign in to comment.