Skip to content
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

chore(rethinkdb): Remove all references to RethinkDB #10395

Merged
merged 11 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
13 changes: 13 additions & 0 deletions .config/kysely.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {defineConfig} from 'kysely-ctl'
import getKysely from '../packages/server/postgres/getKysely'

export default defineConfig({
kysely: getKysely(),
migrations: {
getMigrationPrefix: () => `${new Date().toISOString()}_`,
migrationFolder: './packages/server/postgres/migrations',
migrationTableSchema: 'public',
migrationTableName: '_migration',
migrationLockTableName: '_migrationLock'
}
})
2 changes: 0 additions & 2 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ REDIS_URL='redis://localhost:6379'
# REDIS_TLS_KEY_FILE=./docker/stacks/development/redis/certs/redis.key
# REDIS_TLS_CA_FILE=./docker/stacks/development/redis/certs/redisCA.crt
# REDIS_TLS_REJECT_UNAUTHORIZED='false'
RETHINKDB_URL='rethinkdb://localhost:28015/actionDevelopment'
RETHINKDB_SSL='false'

# DATADOG DD-Trace
# https://ddtrace.readthedocs.io/en/stable/configuration.html
Expand Down
14 changes: 7 additions & 7 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

### Pre-submission instructions (remove me before creating an issue)

- [ ] Decide is this is a bug or an enhancement request (if you can't decide, join the chat in [slack](http://slackin.parabol.co/) and ask in `#general`)
- [ ] I've checked open (and closed!) issues and made sure that the issue doesn't already exist.
- [ ] I've updated RethinkDB, node, and npm to the latest version available
- [ ] I've updated node, and npm to the latest version available
- [ ] I've completed the Bug section below
- [ ] I've deleted this checklist section before I hit submit

Expand All @@ -22,13 +21,14 @@ assignees: ''
- **Browser:** Chrome / Safari / Lynx / ? + version
- **Node version:** `node --version`
- **NPM version:** `npm --version`
- **RethinkDB version:** `rethinkdb --version`

### Acceptance Criteria (optional)

Users can:
- Do this
- Do that
- Cannot do that
Triage is performed to find the root cause of the bug, timeboxed to ~1 hour.

- Do this
- Do that
- Cannot do that
Triage is performed to find the root cause of the bug, timeboxed to ~1 hour.

**Estimated effort:** 1 hour to triage. More if root cause is already identified.
9 changes: 1 addition & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ jobs:
POSTGRES_DB: "tempdb"
ports:
- 5432:5432
rethinkdb:
image: rethinkdb:2.4.2
ports:
- 8080:8080
- 28015:28015
- 29015:29015
redis:
image: redis:7.0-alpine
ports:
Expand Down Expand Up @@ -76,8 +70,7 @@ jobs:
- name: Build the DBs
run: |
cp ${{ env.PARABOL_BUILD_ENV_PATH }} ./.env
yarn db:migrate
yarn pg:migrate up
yarn kysely migrate:latest
yarn pg:build
yarn pg:generate

Expand Down
9 changes: 1 addition & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ jobs:
POSTGRES_DB: "tempdb"
ports:
- 5432:5432
rethinkdb:
image: rethinkdb:2.4.2
ports:
- 8080:8080
- 28015:28015
- 29015:29015
redis:
image: redis:7.0-alpine
ports:
Expand Down Expand Up @@ -76,8 +70,7 @@ jobs:
- name: Build the DBs
run: |
cp ${{ env.PARABOL_BUILD_ENV_PATH }} ./.env
yarn db:migrate
yarn pg:migrate up
yarn kysely migrate:latest
yarn pg:build

- name: Build for testing
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ packages/server/graphql/public/resolverTypes.ts
packages/server/types/gitlabTypes.ts
packages/server/types/githubTypes.ts
queryMap.json
rethinkdb_data/
rethinkdb_dump_*
schema.graphql
scratch/
scripts/toolbox/*
Expand Down
10 changes: 3 additions & 7 deletions .husky/post-checkout
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,21 @@
yarn postcheckout

DELETED_POSTGRES_MIGRATIONS=$(git diff $1 $2 --name-only --diff-filter=D -- packages/server/postgres/migrations/)
DELETED_RETHINK_MIGRATIONS=$(git diff $1 $2 --name-only --diff-filter=D -- packages/server/database/migrations/)
if [ ! -z "$DELETED_POSTGRES_MIGRATIONS" -o ! -z "$DELETED_RETHINK_MIGRATIONS" ]; then
if [ ! -z "$DELETED_POSTGRES_MIGRATIONS" ]; then
CURRENT_BRANCH=$(git branch --show-current)
NUM_POSTGRES_MIGRATIONS=$(echo $DELETED_POSTGRES_MIGRATIONS | wc -w)
echo "WARNING: You're leaving behind the following migrations not present on the current branch:"
echo
for X in $DELETED_POSTGRES_MIGRATIONS $DELETED_RETHINK_MIGRATIONS; do
for X in $DELETED_POSTGRES_MIGRATIONS; do
echo " ${X##*/}"
done
echo
echo "Consider running:"
echo
echo " git checkout ${1} &&"
if [ ! -z "$DELETED_POSTGRES_MIGRATIONS" ]; then
echo " yarn pg:migrate down ${NUM_POSTGRES_MIGRATIONS} &&"
echo " yarn kysely migrate:down ${NUM_POSTGRES_MIGRATIONS} &&"
fi
for X in $DELETED_RETHINK_MIGRATIONS; do
echo " yarn db:migrate down &&"
done
echo " git checkout ${CURRENT_BRANCH:-$2}"
echo
fi
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ our company's [history and SaaS metrics](https://www.parabol.co/blog/tag/friday-
| ---------------------- | --------------------------------------------------------------- |
| Server | [Node](https://nodejs.org/) |
| Server Framework | [μWebSockets.js](https://github.com/uNetworking/uWebSockets.js) |
| Database (Legacy) | [RethinkDB](https://www.rethinkdb.com/) |
| Database | [PostgreSQL](https://www.postgresql.org/) |
| PubSub & Cache | [Redis](https://redis.io) |
| Data Transport | [GraphQL](https://github.com/graphql/graphql-js) |
Expand Down Expand Up @@ -65,7 +64,6 @@ $ yarn dev
- [GraphQL Executor](./packages/gql-executor/README.md)
- [Integrations (GitHub, Jira, Slack, etc.)](./docs/integrations.md)
- [PostgreSQL](./packages/server/postgres/README.md)
- [RethinkDB](./packages/server/database/README.md)
- [Shared Scripts](./packages/client/shared/README.md)
- [VS Code Tips](.vscode/tips.md)
- [Tailwind CSS migration guide](./packages/client/README.md)
Expand Down
2 changes: 1 addition & 1 deletion docker/images/parabol-ubi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ To build it locally (unsupported), use [act](https://github.com/nektos/act) to r

## Run the application using a docker image

_Assumes redis, rethinkdb, and postgres already running to have operational stack._
_Assumes redis and postgres already running to have operational stack._

The commands below will start a Parabol container on the target tag specified in \_DOCKER_TAG export. It will volume mount a .env in your current working directory to the container, so you can pass in any .env in your current working directory.

Expand Down
2 changes: 0 additions & 2 deletions docker/images/parabol-ubi/environments/basic-env
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,5 @@ POSTGRES_DB='tempdb'
POSTGRES_HOST='localhost'
POSTGRES_PORT='5432'
REDIS_URL='redis://localhost:6379'
RETHINKDB_SSL=''
RETHINKDB_URL='rethinkdb://localhost:28015/buildDB'
SERVER_ID='0'
SERVER_SECRET='FAKE_VALUE'
2 changes: 0 additions & 2 deletions docker/images/parabol-ubi/environments/pipeline
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ POSTGRES_DB='tempdb'
POSTGRES_HOST='localhost'
POSTGRES_PORT='5432'
REDIS_URL='redis://localhost:6379'
RETHINKDB_SSL=''
RETHINKDB_URL='rethinkdb://localhost:28015/actionProduction'
SENTRY_DSN=''
SERVER_ID='0'
SERVER_SECRET='FAKE_VALUE'
Expand Down
1 change: 0 additions & 1 deletion docker/stacks/development/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
## Components

- **Datadog agent:** additional configuration can be added in the folder `datadog/dd-conf.d`.
- **RethinkDB:** ports 28015 and 8080 (console) exposed to communicate with the cluster. Data mounted in a volume rethinkdb-data.
- **Postgres:** container built from a Dockerfile in [docker/images/postgres](docker/images/postgres), that incorporates some extra extensions used by the application. Exposed through port 5432 and with the data mounted in a volume postgres-data.
- **PGAdmin:** available on 5050 with credentials on the `.env` file. Connect using the values of `PGADMIN_DEFAULT_EMAIL` and `PGADMIN_DEFAULT_PASSWORD` from the `.env`. Data mounted on a volume pgadmin-data.
- **Redis:** available on 6379 with the data mounted on a volume redis-data.
Expand Down
12 changes: 0 additions & 12 deletions docker/stacks/development/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,6 @@ services:
- /var/run/docker.sock:/var/run/docker.sock
- /proc/:/host/proc/:ro
- /sys/fs/cgroup:/host/sys/fs/cgroup:ro
rethinkdb:
image: rethinkdb:2.4.2
restart: unless-stopped
ports:
- "8080:8080"
- "29015:29015"
- "28015:28015"
volumes:
- rethink-data:/data
networks:
- parabol-network
postgres:
image: pgvector/pgvector:0.7.0-pg16
restart: unless-stopped
Expand Down Expand Up @@ -84,7 +73,6 @@ networks:
parabol-network:
volumes:
redis-data: {}
rethink-data: {}
postgres-data: {}
pgadmin-data: {}
text-embeddings-inference-data: {}
23 changes: 0 additions & 23 deletions docker/stacks/single-tenant-host/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,4 @@
services:
rethinkdb:
container_name: rethinkdb
profiles: ["databases"]
image: rethinkdb:2.4.2
restart: always
ports:
- "8080:8080"
- "29015:29015"
- "28015:28015"
volumes:
- ./data/rethink:/data
networks:
- parabol-network
postgres:
container_name: postgres
profiles: ["databases"]
Expand Down Expand Up @@ -98,8 +85,6 @@ services:
volumes:
- "./.env:/parabol/.env"
depends_on:
rethinkdb:
condition: service_started
postgres:
condition: service_healthy
redis:
Expand All @@ -120,8 +105,6 @@ services:
depends_on:
pre-deploy:
condition: service_completed_successfully
rethinkdb:
condition: service_started
postgres:
condition: service_healthy
redis:
Expand All @@ -144,8 +127,6 @@ services:
depends_on:
pre-deploy:
condition: service_completed_successfully
rethinkdb:
condition: service_started
postgres:
condition: service_healthy
redis:
Expand All @@ -166,8 +147,6 @@ services:
depends_on:
pre-deploy:
condition: service_completed_successfully
rethinkdb:
condition: service_started
postgres:
condition: service_healthy
redis:
Expand All @@ -188,8 +167,6 @@ services:
depends_on:
pre-deploy:
condition: service_completed_successfully
rethinkdb:
condition: service_started
postgres:
condition: service_healthy
redis:
Expand Down
6 changes: 0 additions & 6 deletions docs/alternative-licenses/us-department-of-defense/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ For all matters, please contact: [email protected]
| ---------------------- | -------------------------------------------------------------- |
| Server | [Node](https://nodejs.org/) |
| Server Framework | [uWebSockts.js](https://github.com/uNetworking/uWebSockets.js) |
| Database (Legacy) | [RethinkDB](https://www.rethinkdb.com/) |
| Database | [PostgreSQL](https://www.postgresql.org/) |
| PubSub & Cache | [Redis](https://redis.io) |
| Data Transport | [GraphQL](https://github.com/graphql/graphql-js) |
Expand Down Expand Up @@ -70,11 +69,6 @@ Build for production and start application:
$ yarn && yarn build && yarn start
```

### RethinkDB

- Migrations are stored in `packages/server/database/migrations`
- RethinkDB Dashboard is at [http://localhost:8080](http://localhost:8080)

### PostgreSQL

- pgadmin is at [http://localhost:5050](http://localhost:5050)
Expand Down
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,10 @@
"clean": "git clean -fdx -e .env",
"codegen": "node scripts/codegenGraphQL.js",
"pg:build": "pgtyped -c ./packages/server/postgres/pgtypedConfig.js",
"pg:migrate": "node-pg-migrate -f ./packages/server/postgres/pgmConfig.js",
"pg:generate": "export $(grep ^POSTGRES_ .env | tr -d \"'\"); yarn kysely-codegen --exclude-pattern \"(PgMigrations|StripeQuantityMismatchLogging)\" --out-file ./packages/server/postgres/pg.d.ts --dialect postgres --url postgresql://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB && prettier --write ./packages/server/postgres/pg.d.ts",
"pg:restore": "node ./scripts/toolbox/pgRestore.js",
"db:start": "docker compose -f docker/stacks/development/docker-compose.yml up -d",
"db:stop": "docker compose -f docker/stacks/development/docker-compose.yml down",
"db:migrate": "node scripts/migrate.js",
"deduplicate": "yarn yarn-deduplicate yarn.lock",
"predeploy": "node dist/preDeploy.js",
"dev": "PM2_SILENT=true pm2 start pm2.dev.config.js --no-daemon",
Expand Down Expand Up @@ -71,7 +69,6 @@
"git-url-parse": "12.0.0",
"fbjs": "^3.0.0",
"parse-url": "^8.1.0",
"rethinkdb-ts": "2.6.0",
"recursive-readdir": "^2.2.3",
"json5": "^2.2.3"
},
Expand All @@ -94,6 +91,7 @@
"@types/dotenv": "^6.1.1",
"@types/jscodeshift": "^0.11.3",
"@types/lodash.toarray": "^4.4.7",
"@types/pg": "^8.11.10",
"@typescript-eslint/eslint-plugin": "^8.3.0",
"@typescript-eslint/parser": "^8.3.0",
"autoprefixer": "^10.4.13",
Expand All @@ -106,13 +104,13 @@
"html-webpack-plugin": "^5.5.0",
"husky": "^7.0.4",
"jscodeshift": "^0.14.0",
"kysely": "^0.27.3",
"kysely": "^0.27.4",
"kysely-codegen": "^0.15.0",
"kysely-ctl": "^0.9.0",
"lerna": "^6.4.1",
"mini-css-extract-plugin": "^2.7.2",
"minimist": "^1.2.5",
"node-loader": "^2.0.0",
"pg-promise": "^11.2.0",
"pm2": "^5.4.2",
"postcss": "^8.4.21",
"postcss-loader": "^7.0.2",
Expand All @@ -139,6 +137,6 @@
"dotenv": "8.0.0",
"dotenv-expand": "5.1.0",
"lodash.toarray": "^4.4.0",
"rethinkdb-ts-migrate": "^0.3.6"
"pg": "^8.13.0"
}
}
4 changes: 2 additions & 2 deletions packages/embedder/indexing/retrospectiveDiscussionTopic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export const createTextFromRetrospectiveDiscussionTopic = async (
dataLoader.get('retroReflectionsByGroupId').load(reflectionGroupId)
])
if (newMeeting.meetingType !== 'retrospective') throw new Error('Meeting is not a retro')
// It should never be undefined, but our data integrity in RethinkDB is bad
// It should never be undefined now that data is in PG. Can try removing & testing
const templateId = newMeeting?.templateId ?? ''

const promptIds = [...new Set(reflections.map((r) => r.promptId))]
Expand All @@ -92,7 +92,7 @@ export const createTextFromRetrospectiveDiscussionTopic = async (
}

for (const prompt of prompts) {
if (!prompt) continue // RethinkDB bad data integrity
if (!prompt) continue // Should never happen now that data is in PG
if (!textForReranking) {
markdown += `Participants were prompted with, "${prompt.question}`
if (prompt.description) markdown += `: ${prompt.description}`
Expand Down
1 change: 0 additions & 1 deletion packages/server/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ githubSchema.graphql
gitlabSchema.graphql
graphql/private/schema.graphql
graphql/public/schema.graphql
migrationTemplate.ts
billing/debug.ts
pg.d.ts
6 changes: 0 additions & 6 deletions packages/server/__tests__/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import base64url from 'base64url'
import crypto from 'crypto'
import faker from 'faker'
import {sql} from 'kysely'
import getRethink from '../database/rethinkDriver'
import ServerAuthToken from '../database/types/ServerAuthToken'
import getKysely from '../postgres/getKysely'
import encodeAuthToken from '../utils/encodeAuthToken'
Expand Down Expand Up @@ -33,11 +32,6 @@ export async function sendIntranet(req: {
return response.json()
}

export const drainRethink = async () => {
const r = await getRethink()
r.getPoolMaster()?.drain()
}

const persistFunction = (text: string) => {
const hasher = crypto.createHash('md5')
hasher.update(text)
Expand Down
Loading
Loading