Boxer
Boxer
Explore posts from servers
RRailway
Created by Boxer on 8/17/2024 in #✋|help
Caddy in a monorepo?
I was following your template @Brody to deploy vite with Caddy https://github.com/brody192/vite-react-template/blob/main/Caddyfile in my monorepo but I think my nixpacks.toml is not getting picked up. f78d75b5-8972-4d61-8517-22bbccefb41e I created a file for my landing page in deployments/landing-nixpacks.toml
# https://nixpacks.com/docs/configuration/file

# set up some variables to minimize annoyance
[variables]
NPM_CONFIG_UPDATE_NOTIFIER = 'false' # the update notification is relatively useless in a production environment
NPM_CONFIG_FUND = 'false' # the fund notification is also pretty useless in a production environment

[phases.build]
cmds = ['pnpm --filter landing build']

# download caddy from nix
[phases.caddy]
dependsOn = [
'setup',
] # make sure this phase runs after the default 'setup' phase
nixpkgsArchive = 'ba913eda2df8eb72147259189d55932012df6301' # Caddy v2.8.4 - https://github.com/NixOS/nixpkgs/commit/ba913eda2df8eb72147259189d55932012df6301
nixPkgs = ['caddy'] # install caddy as a nix package

# format the Caddyfile with fmt
[phases.fmt]
dependsOn = [
'caddy',
] # make sure this phase runs after the 'caddy' phase so that we know we have caddy downloaded
cmds = [
'caddy fmt --overwrite Caddyfile',
] # format the Caddyfile to fix any formatting inconsistencies

# start the caddy web server
[start]
cmd = 'exec caddy run --config apps/landing/Caddyfile --adapter caddyfile 2>&1' # start caddy using the Caddyfile config and caddyfile adapter
# https://nixpacks.com/docs/configuration/file

# set up some variables to minimize annoyance
[variables]
NPM_CONFIG_UPDATE_NOTIFIER = 'false' # the update notification is relatively useless in a production environment
NPM_CONFIG_FUND = 'false' # the fund notification is also pretty useless in a production environment

[phases.build]
cmds = ['pnpm --filter landing build']

# download caddy from nix
[phases.caddy]
dependsOn = [
'setup',
] # make sure this phase runs after the default 'setup' phase
nixpkgsArchive = 'ba913eda2df8eb72147259189d55932012df6301' # Caddy v2.8.4 - https://github.com/NixOS/nixpkgs/commit/ba913eda2df8eb72147259189d55932012df6301
nixPkgs = ['caddy'] # install caddy as a nix package

# format the Caddyfile with fmt
[phases.fmt]
dependsOn = [
'caddy',
] # make sure this phase runs after the 'caddy' phase so that we know we have caddy downloaded
cmds = [
'caddy fmt --overwrite Caddyfile',
] # format the Caddyfile to fix any formatting inconsistencies

# start the caddy web server
[start]
cmd = 'exec caddy run --config apps/landing/Caddyfile --adapter caddyfile 2>&1' # start caddy using the Caddyfile config and caddyfile adapter
But i noticed the configs in the service settings are not getting overriden :/
34 replies
RRailway
Created by Boxer on 8/9/2024 in #✋|help
What's the best way to start services in a monorepo with a lot of services?
Looking at the docs I see commands like npm run start:backend so how does railway now which service is which? https://docs.railway.app/guides/monorepo#deploying-a-shared-monorepo I have a turborepo with golang services in the following directory structure /root --/services -- (golang services 1 folder each) --/packages --/apps So now I am not sure how to start each monorepo service in each railway service
79 replies
RRailway
Created by Boxer on 7/26/2024 in #✋|help
React vinxi app failing build
Hi there, for some reason my build is failing for my vinxi app here are the build logs:
#9 DONE 0.0s



#10 [stage-0 6/10] RUN --mount=type=cache,id=s/047d91cb-fd36-4784-9efc-af0c5dbe5158-/root/local/share/pnpm/store/v3,target=/root/.local/share/pnpm/store/v3 pnpm i --frozen-lockfile



#10 0.876  WARN  Ignoring not compatible lockfile at /app/pnpm-lock.yaml



#10 0.879  ERR_PNPM_NO_LOCKFILE  Cannot install with "frozen-lockfile" because pnpm-lock.yaml is absent

#10 0.879

#10 0.879 Note that in CI environments this setting is true by default. If you still need to run install in such cases, use "pnpm install --no-frozen-lockfile"

#10 ERROR: process "/bin/bash -ol pipefail -c pnpm i --frozen-lockfile" did not complete successfully: exit code: 1

-----

> [stage-0 6/10] RUN --mount=type=cache,id=s/047d91cb-fd36-4784-9efc-af0c5dbe5158-/root/local/share/pnpm/store/v3,target=/root/.local/share/pnpm/store/v3 pnpm i --frozen-lockfile:

0.876  WARN  Ignoring not compatible lockfile at /app/pnpm-lock.yaml

0.879  ERR_PNPM_NO_LOCKFILE  Cannot install with "frozen-lockfile" because pnpm-lock.yaml is absent

0.879

0.879 Note that in CI environments this setting is true by default. If you still need to run install in such cases, use "pnpm install --no-frozen-lockfile"

-----





2 warnings found (use --debug to expand):

- UndefinedVar: Usage of undefined variable '$NIXPACKS_PATH' (line 18)

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 18)



Dockerfile:20

-------------------

18 | ENV NIXPACKS_PATH /app/node_modules/.bin:$NIXPACKS_PATH

19 | COPY . /app/.

20 | >>> RUN --mount=type=cache,id=s/047d91cb-fd36-4784-9efc-af0c5dbe5158-/root/local/share/pnpm/store/v3,target=/root/.local/share/pnpm/store/v3 pnpm i --frozen-lockfile

21 |

22 | # build phase

-------------------

ERROR: failed to solve: process "/bin/bash -ol pipefail -c pnpm i --frozen-lockfile" did not complete successfully: exit code: 1



Error: Docker build failed
#9 DONE 0.0s



#10 [stage-0 6/10] RUN --mount=type=cache,id=s/047d91cb-fd36-4784-9efc-af0c5dbe5158-/root/local/share/pnpm/store/v3,target=/root/.local/share/pnpm/store/v3 pnpm i --frozen-lockfile



#10 0.876  WARN  Ignoring not compatible lockfile at /app/pnpm-lock.yaml



#10 0.879  ERR_PNPM_NO_LOCKFILE  Cannot install with "frozen-lockfile" because pnpm-lock.yaml is absent

#10 0.879

#10 0.879 Note that in CI environments this setting is true by default. If you still need to run install in such cases, use "pnpm install --no-frozen-lockfile"

#10 ERROR: process "/bin/bash -ol pipefail -c pnpm i --frozen-lockfile" did not complete successfully: exit code: 1

-----

> [stage-0 6/10] RUN --mount=type=cache,id=s/047d91cb-fd36-4784-9efc-af0c5dbe5158-/root/local/share/pnpm/store/v3,target=/root/.local/share/pnpm/store/v3 pnpm i --frozen-lockfile:

0.876  WARN  Ignoring not compatible lockfile at /app/pnpm-lock.yaml

0.879  ERR_PNPM_NO_LOCKFILE  Cannot install with "frozen-lockfile" because pnpm-lock.yaml is absent

0.879

0.879 Note that in CI environments this setting is true by default. If you still need to run install in such cases, use "pnpm install --no-frozen-lockfile"

-----





2 warnings found (use --debug to expand):

- UndefinedVar: Usage of undefined variable '$NIXPACKS_PATH' (line 18)

LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 18)



Dockerfile:20

-------------------

18 | ENV NIXPACKS_PATH /app/node_modules/.bin:$NIXPACKS_PATH

19 | COPY . /app/.

20 | >>> RUN --mount=type=cache,id=s/047d91cb-fd36-4784-9efc-af0c5dbe5158-/root/local/share/pnpm/store/v3,target=/root/.local/share/pnpm/store/v3 pnpm i --frozen-lockfile

21 |

22 | # build phase

-------------------

ERROR: failed to solve: process "/bin/bash -ol pipefail -c pnpm i --frozen-lockfile" did not complete successfully: exit code: 1



Error: Docker build failed
110 replies
RRailway
Created by Boxer on 12/25/2023 in #✋|help
{"name":"TypeError","code":"ERR_INVALID_ARG_VALUE"} Calling API from another service in project
Hi, I'm trying to make a internal fetch API call to one of my services and it looks like it's erroring out with {"name":"TypeError","code":"ERR_INVALID_ARG_VALUE"} which is something I have not seen before. Code:
class SellerAmpClient {
private readonly baseURL: string = Bun.env.NOX_URL;

private async post<T, K>(url: string, data: K): Promise<T> {
try {
logger.info('here--url: ', `${this.baseURL}${url}`);
const response = await fetch(`${this.baseURL}${url}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
});
logger.info('here2', response);
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}

return (await response.json()) as T;
} catch (error) {
logger.error(error);
throw error;
}
}
class SellerAmpClient {
private readonly baseURL: string = Bun.env.NOX_URL;

private async post<T, K>(url: string, data: K): Promise<T> {
try {
logger.info('here--url: ', `${this.baseURL}${url}`);
const response = await fetch(`${this.baseURL}${url}`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(data),
});
logger.info('here2', response);
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}

return (await response.json()) as T;
} catch (error) {
logger.error(error);
throw error;
}
}
This is only happening in PROD since my local env does work, I'm sure it has something to do with the BaseURL which is basically: nox.railway.internal When checking the logs I see the first log I tested: [02:17:26.904] [info] here--url: nox.railway.internal/api/sellers/fba and then it fails. Am I missing something here?
10 replies
RRailway
Created by Boxer on 12/1/2023 in #✋|help
Connecting to redis service with private url?
anyone using ioredis, is this the correct way to connect to the internal redis service?
import Redis from 'ioredis';

const redis = new Redis(Bun.env.REDIS_PRIVATE_URL);

export default redis;
import Redis from 'ioredis';

const redis = new Redis(Bun.env.REDIS_PRIVATE_URL);

export default redis;
I don't seem to get any errors on my code, but it's not looking at redis at all. my code just stops?
import redis from '@cache/redis';
import { logger } from '@common/logger';

export async function isSuccessChannel(message: Message) {
try {
const { channel_id, guild_id } = selectChannelSchema.parse({
channel_id: BigInt(message.channelId),
guild_id: BigInt(message.guildId as string),
});

const cacheKey = `guild:${guild_id}:channel:${channel_id}:isSuccess`;

// First, check if the result is in the cache
logger.info(`Checking cache for channel (${channel_id})`);
const cachedResult = await redis.get(cacheKey); // CODE STOPS WORKING FROM HERE AND NO LOGS
if (cachedResult !== null) {
logger.info(`Cached channel (${channel_id}) is success: ${cachedResult}`);
return cachedResult === 'true';
}

logger.info(`Channel (${channel_id}) is not cached, checking database`);

....
import redis from '@cache/redis';
import { logger } from '@common/logger';

export async function isSuccessChannel(message: Message) {
try {
const { channel_id, guild_id } = selectChannelSchema.parse({
channel_id: BigInt(message.channelId),
guild_id: BigInt(message.guildId as string),
});

const cacheKey = `guild:${guild_id}:channel:${channel_id}:isSuccess`;

// First, check if the result is in the cache
logger.info(`Checking cache for channel (${channel_id})`);
const cachedResult = await redis.get(cacheKey); // CODE STOPS WORKING FROM HERE AND NO LOGS
if (cachedResult !== null) {
logger.info(`Cached channel (${channel_id}) is success: ${cachedResult}`);
return cachedResult === 'true';
}

logger.info(`Channel (${channel_id}) is not cached, checking database`);

....
8 replies
DTDrizzle Team
Created by Boxer on 11/29/2023 in #help
Supabase/postgres get query is stuck on prod app
No description
25 replies
RRailway
Created by Boxer on 11/28/2023 in #✋|help
Discord bot unresponsive
No description
6 replies
DIAdiscord.js - Imagine an app
Created by Boxer on 11/28/2023 in #djs-questions
Member Permissions for subcommand groups?
Are we able to add member permissions to subcommand groups? I have a SlashCommandBuilder command group for channel related actions. Some commands should only be available for admins and some for mods... But I only see that we are able to add DefaultMemberPermissions to the SlashCommandBuilder as a whole:
xport const channelSlashCommand: SlashCommandBuilder =
new SlashCommandBuilder()
.setName('channel')
.setDescription('Set of admin commands for channel management')
.addSubcommandGroup((group) =>
group
.setName('admin')
.setDescription('Add, remove, list channels from db')
.addSubcommand((subcommand) =>
subcommand
.setName('add')
.setDescription('Add chanel to DB')
.addChannelOption((option) =>
option
.setName('channel')
.setDescription('Select the channel you want to set')
.addChannelTypes(ChannelType.GuildText)
.setRequired(true),
)
.addStringOption((option) =>
option
.setName('type')
.setDescription("The channel's type")
.addChoices(
{ name: 'Announcement', value: 'announcement' },
{ name: 'General', value: 'general' },
{ name: 'Success', value: 'success' },
)
.setRequired(true),
)
.addRoleOption((option) =>
option
.setName('role')
.setDescription(
'Select the role you want to alert when sending messages to this channel',
),
),
)
.addSubcommand((subcommand) =>
subcommand
.setName('delete')
.setDescription('delete a channel from db')
.addStringOption((option) =>
option
.setName('channel_id')
.setDescription('Enter the channel ID')
.setRequired(true),
),
)
.addSubcommand((subcommand) =>
subcommand.setName('list').setDescription('List current channels'),
),
)
.addSubcommandGroup((group) =>
group
.setName('mod')
.setDescription('Channel management commands for mods')
.addSubcommand((subcommand) =>
subcommand
.setName('lock')
.setDescription('Lock a channel')
.addChannelOption((option) =>
option
.setName('channel')
.setDescription('Channel to lock')
.setRequired(true),
),
),
)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator);
xport const channelSlashCommand: SlashCommandBuilder =
new SlashCommandBuilder()
.setName('channel')
.setDescription('Set of admin commands for channel management')
.addSubcommandGroup((group) =>
group
.setName('admin')
.setDescription('Add, remove, list channels from db')
.addSubcommand((subcommand) =>
subcommand
.setName('add')
.setDescription('Add chanel to DB')
.addChannelOption((option) =>
option
.setName('channel')
.setDescription('Select the channel you want to set')
.addChannelTypes(ChannelType.GuildText)
.setRequired(true),
)
.addStringOption((option) =>
option
.setName('type')
.setDescription("The channel's type")
.addChoices(
{ name: 'Announcement', value: 'announcement' },
{ name: 'General', value: 'general' },
{ name: 'Success', value: 'success' },
)
.setRequired(true),
)
.addRoleOption((option) =>
option
.setName('role')
.setDescription(
'Select the role you want to alert when sending messages to this channel',
),
),
)
.addSubcommand((subcommand) =>
subcommand
.setName('delete')
.setDescription('delete a channel from db')
.addStringOption((option) =>
option
.setName('channel_id')
.setDescription('Enter the channel ID')
.setRequired(true),
),
)
.addSubcommand((subcommand) =>
subcommand.setName('list').setDescription('List current channels'),
),
)
.addSubcommandGroup((group) =>
group
.setName('mod')
.setDescription('Channel management commands for mods')
.addSubcommand((subcommand) =>
subcommand
.setName('lock')
.setDescription('Lock a channel')
.addChannelOption((option) =>
option
.setName('channel')
.setDescription('Channel to lock')
.setRequired(true),
),
),
)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator);
5 replies
RRailway
Created by Boxer on 10/16/2023 in #✋|help
Issue adding my custom domain from IONOS
No description
15 replies
DTDrizzle Team
Created by Boxer on 8/14/2023 in #help
Default value for Array creates an incorrect SQL migration
I'm currently adding a new field roles to my PG table, users, such as:
export const users = pgTable(
'users',
{
user_id: text('user_id').primaryKey(),
balance: integer('balance').notNull().default(0),
roles: text('roles').array().default(['user']),
},
(table) => {
return {
user_idIdx: uniqueIndex('user_id_idx').on(table.user_id),
};
},
);
export const users = pgTable(
'users',
{
user_id: text('user_id').primaryKey(),
balance: integer('balance').notNull().default(0),
roles: text('roles').array().default(['user']),
},
(table) => {
return {
user_idIdx: uniqueIndex('user_id_idx').on(table.user_id),
};
},
);
The problem is that when I generate the SQL schema it returns this:
ALTER TABLE "users" ADD COLUMN "roles" text[] DEFAULT user;
ALTER TABLE "users" ADD COLUMN "roles" text[] DEFAULT user;
which is wrong since it thinks it's referencing to a user table but not just a default string value called user
1 replies
DTDrizzle Team
Created by Boxer on 7/16/2023 in #help
Module '"drizzle-orm/mysql-core"' has no exported member 'unique'.ts(2305)
Getting this error when trying to import unique
import {
text,
unique, // erroring out
mysqlTable,
serial,
mysqlEnum,
} from 'drizzle-orm/mysql-core';
import {
text,
unique, // erroring out
mysqlTable,
serial,
mysqlEnum,
} from 'drizzle-orm/mysql-core';
13 replies
DTDrizzle Team
Created by Boxer on 7/11/2023 in #help
mysql-core fails on TS build on 0.27.1
Getting this error when I try to build my ts node app
3 replies