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
RRailway
Created by Boxer on 11/28/2023 in #✋|help
Discord bot unresponsive
No description
6 replies
RRailway
Created by Boxer on 10/16/2023 in #✋|help
Issue adding my custom domain from IONOS
No description
15 replies