whitetown
whitetown
RRailway
Created by whitetown on 9/11/2024 in #✋|help
overwrite files during deploy
I would agree with you but in this case we both will be wrong 😦 my deploy command is in the middle of dosen events and since it works locally or on vercel - I assume that it works correctly. something in this chain changes files after the build
20 replies
RRailway
Created by whitetown on 9/11/2024 in #✋|help
overwrite files during deploy
I could make a workaroud, like a special branch for deploy. but it would be nice if you fix this... well, it's not so urgent. but there is definitely something copied after deploy for some reason
20 replies
RRailway
Created by whitetown on 9/11/2024 in #✋|help
overwrite files during deploy
unfortunately I am not a real backend developer and have never used Docker (only run docker desktop for some reason I do not remember). I like railway that it allows even such dumb as me to deploy everything easily.
20 replies
RRailway
Created by whitetown on 9/11/2024 in #✋|help
overwrite files during deploy
I think the issue in in this command. it's something harmful #14 [stage-0 10/10] COPY . /app I have set the Custom Start Command
ls -la public/*.png && next start
ls -la public/*.png && next start
and what I see - these files that were copied at build time and became equal are different Starting Container -rw-r--r-- 1 root root 1459 Sep 12 17:48 public/blue.png -rw-r--r-- 1 root root 534 Sep 12 17:48 public/green.png -rw-r--r-- 1 root root 5344 Sep 12 17:48 public/red.png -rw-r--r-- 1 root root 3595 Sep 12 17:48 public/yellow.png ▲ Next.js 14.2.10 - Local: http://localhost:8080 ✓ Starting... ✓ Ready in 477ms
20 replies
RRailway
Created by whitetown on 9/11/2024 in #✋|help
overwrite files during deploy
I added it as env variable - deployed. it did not help.
20 replies
RRailway
Created by whitetown on 9/11/2024 in #✋|help
overwrite files during deploy
I do not see what exactly happening on railway, but in your logs before build #11 [stage-0 7/10] COPY . /app/. //raylway command #12 [stage-0 8/10] RUN --mount=type=cache,id=s/b5ec3316-27dc-4e02-8b03-6218db5405fe-next/cache,target=/app/.next/cache --mount=type=cache,id=s/b5ec3316-27dc-4e02-8b03-6218db5405fe-node_modules/cache,target=/app/node_modules/.cache ./theme.sh && yarn build then copiing and build is going.. after build #14 [stage-0 10/10] COPY . /app ^^^^ what is this command? maybe it restores all orifinal files?
20 replies
RRailway
Created by whitetown on 9/11/2024 in #✋|help
overwrite files during deploy
huh. on vercel they are black https://all-in-black.vercel.app/
20 replies
RRailway
Created by whitetown on 9/11/2024 in #✋|help
overwrite files during deploy
Okay I created another project, just for testing. feel free to change there anything. e7bf8c87-4233-41c5-bb0c-1eeccb2be302 story: 1. public/ folder contains 4 colorful png file 2. theme/ folder contains black png file 3. we use cutom build command:
./theme.sh && yarn build
./theme.sh && yarn build
or
./theme.sh && next build
./theme.sh && next build
4. locally all squares are black. on railway they remain colourful. 5. theme.sh:
#/bin/sh

echo "copy black files to colorful files"
cp -f theme/black.png public/red.png
cp -f theme/black.png public/green.png
cp -f theme/black.png public/blue.png
cp -f theme/black.png public/yellow.png

echo "all files below have to be equal"
ls -la theme/*.png
ls -la public/*.png
#/bin/sh

echo "copy black files to colorful files"
cp -f theme/black.png public/red.png
cp -f theme/black.png public/green.png
cp -f theme/black.png public/blue.png
cp -f theme/black.png public/yellow.png

echo "all files below have to be equal"
ls -la theme/*.png
ls -la public/*.png
in logs I see that files are copied and are equal
#12 0.103 -rw-r--r-- 1 root root 9639 Sep 12 17:19 theme/black.png
#12 0.105 -rw-r--r-- 1 root root 9639 Sep 12 17:19 public/blue.png
#12 0.105 -rw-r--r-- 1 root root 9639 Sep 12 17:19 public/green.png
#12 0.105 -rw-r--r-- 1 root root 9639 Sep 12 17:19 public/red.png
#12 0.105 -rw-r--r-- 1 root root 9639 Sep 12 17:19 public/yellow.png
#12 0.103 -rw-r--r-- 1 root root 9639 Sep 12 17:19 theme/black.png
#12 0.105 -rw-r--r-- 1 root root 9639 Sep 12 17:19 public/blue.png
#12 0.105 -rw-r--r-- 1 root root 9639 Sep 12 17:19 public/green.png
#12 0.105 -rw-r--r-- 1 root root 9639 Sep 12 17:19 public/red.png
#12 0.105 -rw-r--r-- 1 root root 9639 Sep 12 17:19 public/yellow.png
on the web they are not https://all-in-black.up.railway.app/ 😉
20 replies
RRailway
Created by whitetown on 9/11/2024 in #✋|help
overwrite files during deploy
Hi.... I gave up.. it seems something happens behind the scene with files cp -f images/favicon.ico public/favicon.ico (public/favicon.ico exists and overwritten)
cp -f images/favicon.ico public/favicon2.ico (public/favicon2.ico did not exist and copied) next build after the deploy on the web favicon.ico file is still old 😦
20 replies
RRailway
Created by whitetown on 9/11/2024 in #✋|help
overwrite files during deploy
ok, files are copied but after deploy they are still old. I have no idea why... in the build script I added a command to check the content of destination file
cat public/manifest.json
cat public/manifest.json
it prints the new content. but after deploy mysite.com/manifest.json - it is still old one more file I create dynamically (adding .env variables for firebase auth) the file is created and auth works somehow. but when I access it via web mysite.com/process-env.js - there is still original content. is anybody there?
20 replies
RRailway
Created by whitetown on 9/11/2024 in #✋|help
overwrite files during deploy
it seems it did not work with shell command either :/ cp -r images/$NEXT_PUBLIC_THEME/ public/images
20 replies
RRailway
Created by whitetown on 9/11/2024 in #✋|help
overwrite files during deploy
2af97fce-ba10-44a9-aedb-a643afb83aec
20 replies
RRailway
Created by whitetown on 6/10/2024 in #✋|help
previous deployment crash
@Brody I owe you a beer. Resolved. Thanks a lot!
39 replies
RRailway
Created by whitetown on 6/10/2024 in #✋|help
previous deployment crash
ok
39 replies
RRailway
Created by whitetown on 6/10/2024 in #✋|help
previous deployment crash
"scripts": { "dev": "node --env-file=.env.local index.js", "start": "node index.js" },
39 replies
RRailway
Created by whitetown on 6/10/2024 in #✋|help
previous deployment crash
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS",
"watchPatterns": ["/apps/ai-api"]
},
"deploy": {
"numReplicas": 1,
"startCommand": "yarn --cwd apps/ai-api start",
"healthcheckPath": "/",
"sleepApplication": false,
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
}
}
{
"$schema": "https://railway.app/railway.schema.json",
"build": {
"builder": "NIXPACKS",
"watchPatterns": ["/apps/ai-api"]
},
"deploy": {
"numReplicas": 1,
"startCommand": "yarn --cwd apps/ai-api start",
"healthcheckPath": "/",
"sleepApplication": false,
"restartPolicyType": "ON_FAILURE",
"restartPolicyMaxRetries": 10
}
}
39 replies
RRailway
Created by whitetown on 6/10/2024 in #✋|help
previous deployment crash
just yarn start
39 replies
RRailway
Created by whitetown on 6/10/2024 in #✋|help
previous deployment crash
okay, locally it catches sigterm and sigint. if I run the api locally and kill it somehow, I get in the console
yarn start
yarn run v1.22.21
$ node index.js
Connection has been established successfully.
server started at 3040
Shutting down gracefully...
yarn start
yarn run v1.22.21
$ node index.js
Connection has been established successfully.
server started at 3040
Shutting down gracefully...
on Railway this message does not appear. https://expressjs.com/en/advanced/healthcheck-graceful-shutdown.html
39 replies
RRailway
Created by whitetown on 6/10/2024 in #✋|help
previous deployment crash
no 😦
39 replies
RRailway
Created by whitetown on 6/10/2024 in #✋|help
previous deployment crash
process.on('SIGTERM', shutDown);
process.on('SIGINT', shutDown);

function shutDown() {
console.log('Received kill signal, shutting down gracefully');
server.close(() => {
console.log('Closed out remaining connections');
process.exit(0);
});

setTimeout(() => {
console.error('Could not close connections in time, forcefully shutting down');
process.exit(1);
}, 10000);
}
process.on('SIGTERM', shutDown);
process.on('SIGINT', shutDown);

function shutDown() {
console.log('Received kill signal, shutting down gracefully');
server.close(() => {
console.log('Closed out remaining connections');
process.exit(0);
});

setTimeout(() => {
console.error('Could not close connections in time, forcefully shutting down');
process.exit(1);
}, 10000);
}
neither that code, nor v2 did not help. okay, I will try to make some experiments and come back later
39 replies