agrattan
agrattan
Explore posts from servers
RRailway
Created by agrattan on 10/3/2023 in #✋|help
Unable to connect to Redis server at random points with `ioredis`
No description
31 replies
RRailway
Created by agrattan on 10/3/2023 in #✋|help
Unable to connect to Redis server at random points with `ioredis`
sorry about that
31 replies
RRailway
Created by agrattan on 10/3/2023 in #✋|help
Unable to connect to Redis server at random points with `ioredis`
Gotcha, thanks
31 replies
RRailway
Created by agrattan on 10/3/2023 in #✋|help
Unable to connect to Redis server at random points with `ioredis`
@Brody So I removed the TCP proxy, and using the private URL in combination with this ioredis setting: https://github.com/redis/ioredis/issues/1203#issuecomment-976127676 I should be good
31 replies
RRailway
Created by agrattan on 10/3/2023 in #✋|help
Unable to connect to Redis server at random points with `ioredis`
Right, I saw that! That'll be perfect for me, exactly what I needed
31 replies
RRailway
Created by agrattan on 10/3/2023 in #✋|help
Unable to connect to Redis server at random points with `ioredis`
Ahhhhhh, they talk about the templates in the launch week https://blog.railway.app/p/launch-01-next-gen-databases, I gotta read the rest of this today then
31 replies
RRailway
Created by agrattan on 10/3/2023 in #✋|help
Unable to connect to Redis server at random points with `ioredis`
Awesome, thanks!
31 replies
RRailway
Created by agrattan on 10/3/2023 in #✋|help
Unable to connect to Redis server at random points with `ioredis`
@Brody Hmmmm, following "New Service -> Database -> Add Redis" isn't it. I assume it's "New Service -> Template -> Redis," correct?
31 replies
RRailway
Created by agrattan on 10/3/2023 in #✋|help
Unable to connect to Redis server at random points with `ioredis`
Yeah, I'll try that. I'll make your answer as the solution and then make a new help thread if I still run into any issues, thanks! It seems to be a TLS issue and I think by upgrading to the new template I could solve the problems I have, ex: https://upstash.com/docs/redis/troubleshooting/econn_reset
31 replies
RRailway
Created by agrattan on 10/3/2023 in #✋|help
Unable to connect to Redis server at random points with `ioredis`
Are the docs referring to something new then?
31 replies
RRailway
Created by agrattan on 10/3/2023 in #✋|help
Unable to connect to Redis server at random points with `ioredis`
Oh oops
31 replies
RRailway
Created by agrattan on 10/3/2023 in #✋|help
Unable to connect to Redis server at random points with `ioredis`
No description
31 replies
RRailway
Created by agrattan on 10/3/2023 in #✋|help
Unable to connect to Redis server at random points with `ioredis`
4206f054-da69-4f99-a874-b5ad02cc2550
31 replies
DTDrizzle Team
Created by benjiman86 on 6/6/2023 in #help
Share migrations in monorepo
If anyone comes here looking for an example solution, this is what I got: migrate.ts in my database package
import { drizzle } from "drizzle-orm/postgres-js";
import { migrate } from "drizzle-orm/postgres-js/migrator";
import dotenv from "dotenv";
import postgres from "postgres";

// Load .env file before importing db
dotenv.config();

const client = postgres(
process.env.DATABASE_URL ?? ""
);

const migrationDB = drizzle(client);

async function runDatabaseMigrations() {
try {
await migrate(migrationDB, { migrationsFolder: "./drizzle" });
console.log("Migration completed! ✅");
process.exit();
} catch (error) {
console.error("Migration failed! ❌");
console.error(error);
}
}

runDatabaseMigrations();
import { drizzle } from "drizzle-orm/postgres-js";
import { migrate } from "drizzle-orm/postgres-js/migrator";
import dotenv from "dotenv";
import postgres from "postgres";

// Load .env file before importing db
dotenv.config();

const client = postgres(
process.env.DATABASE_URL ?? ""
);

const migrationDB = drizzle(client);

async function runDatabaseMigrations() {
try {
await migrate(migrationDB, { migrationsFolder: "./drizzle" });
console.log("Migration completed! ✅");
process.exit();
} catch (error) {
console.error("Migration failed! ❌");
console.error(error);
}
}

runDatabaseMigrations();
Got this script command in my package.json
"db:migrate:run": "ts-node migrate.ts"
"db:migrate:run": "ts-node migrate.ts"
Then here's an example .yml for a GitHub Action
name: Run Development Database Migrations

on:
push:
branches: ["dev"]

jobs:
build:
name: Build and Run Migrations
timeout-minutes: 15
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} # I use Turborepo
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
DATABASE_URL: ${{ secrets.DEV_DATABASE_URL }}

steps:
- name: :construction_site: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 2

- uses: pnpm/[email protected]
with:
version: 6.32.2

- name: :construction_site: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 18
cache: "pnpm"

- name: :construction_worker: Install dependencies
run: pnpm install

- name: :hiking_boot: Run db migrations
working-directory: "./packages/database"
run: pnpm db:migrate:run
name: Run Development Database Migrations

on:
push:
branches: ["dev"]

jobs:
build:
name: Build and Run Migrations
timeout-minutes: 15
runs-on: ubuntu-latest
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} # I use Turborepo
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
DATABASE_URL: ${{ secrets.DEV_DATABASE_URL }}

steps:
- name: :construction_site: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 2

- uses: pnpm/[email protected]
with:
version: 6.32.2

- name: :construction_site: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 18
cache: "pnpm"

- name: :construction_worker: Install dependencies
run: pnpm install

- name: :hiking_boot: Run db migrations
working-directory: "./packages/database"
run: pnpm db:migrate:run
Thanks for the great discussion everyone!
13 replies
RRailway
Created by agrattan on 9/10/2023 in #✋|help
Connection Pooling or PgBouncer for Postgres Instances?
Gotcha, yeah I saw the same thing too and wanted to confirm. Thanks!
8 replies
RRailway
Created by agrattan on 9/10/2023 in #✋|help
Connection Pooling or PgBouncer for Postgres Instances?
4206f054-da69-4f99-a874-b5ad02cc2550
8 replies