Alec
Alec
RRailway
Created by Alec on 5/24/2024 in #✋|help
Container Takes Hours To Start or Sometimes Just Doesn't
I'm trying to deploy a docker container to railway and it builds with no errors from the dockerfile, but the deploy produces no logs for hours and the service is unavailable. Sometimes after waiting a few hours it'll eventually start but most of the time it just sits with no logs or info coming out of the deploy. Here's the dockerfile I'm using:
FROM haskell:9.4.7-buster

WORKDIR /opt/<service-name>

RUN apt install --no-install-recommends curl

RUN cabal update

# Add just the .cabal file to capture dependencies
COPY ./<service-name>.cabal /opt/selene/<service-name>.cabal

# Docker will cache this command as a layer, freeing us up to
# modify source code without re-installing dependencies
# (unless the .cabal file changes!)
RUN cabal new-build --only-dependencies -j4

# Add and Install Application Code
COPY . /opt/<service-name>
RUN cabal new-install exe:<service-name> -j4

CMD ["<service-name>"]
FROM haskell:9.4.7-buster

WORKDIR /opt/<service-name>

RUN apt install --no-install-recommends curl

RUN cabal update

# Add just the .cabal file to capture dependencies
COPY ./<service-name>.cabal /opt/selene/<service-name>.cabal

# Docker will cache this command as a layer, freeing us up to
# modify source code without re-installing dependencies
# (unless the .cabal file changes!)
RUN cabal new-build --only-dependencies -j4

# Add and Install Application Code
COPY . /opt/<service-name>
RUN cabal new-install exe:<service-name> -j4

CMD ["<service-name>"]
21 replies
RRailway
Created by Alec on 1/21/2024 in #✋|help
Railway Public Domain not working for Next.js app running via nx
Project ID: c50bf9da-0e9b-4d41-b229-8bd6503385a7 I have a Next.js app running from within a nx monorepo. It runs fine locally and the server logs look fine (see below). I've tried passing an explicit host to it of 0.0.0.0, I've tried forcing the port with a PORT env var. For some reason no matter what when I try to access the generated domain I get Application failed to respond. Any ideas what to try? Logs:
yarn run v1.22.21

$ /app/node_modules/.bin/nx run-many --target serve --projects=client --parallel --port 7623 --nx-bail=true --maxParallel=100 --configuration=production

> NX Running target serve for project client:

- client



With additional flags:

--port=7623



> nx run client:serve:production --port 7623

[ ready ] on http://localhost:7623
yarn run v1.22.21

$ /app/node_modules/.bin/nx run-many --target serve --projects=client --parallel --port 7623 --nx-bail=true --maxParallel=100 --configuration=production

> NX Running target serve for project client:

- client



With additional flags:

--port=7623



> nx run client:serve:production --port 7623

[ ready ] on http://localhost:7623
Config:
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS",
"buildCommand": "yarn run nx run-many --target build --projects=client --parallel --configuration=production"
},
"deploy": {
"numReplicas": 1,
"startCommand": "yarn run nx run-many --target serve --projects=client --parallel --port $PORT --nx-bail=true --maxParallel=100 --configuration=production",
"sleepApplication": false,
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
}
}
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS",
"buildCommand": "yarn run nx run-many --target build --projects=client --parallel --configuration=production"
},
"deploy": {
"numReplicas": 1,
"startCommand": "yarn run nx run-many --target serve --projects=client --parallel --port $PORT --nx-bail=true --maxParallel=100 --configuration=production",
"sleepApplication": false,
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
}
}
5 replies