Skip to content

Commit

Permalink
refining prod logs
Browse files Browse the repository at this point in the history
  • Loading branch information
mischaikow committed Nov 16, 2024
1 parent 01c660c commit 474bb6e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion build_run_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ echo 'Building and deploying server'
cd /home/ec2-user/website
docker buildx build --no-cache -t site/server -f Dockerfile .
docker stop mischaikow-server
docker run --rm -d -p 3000:3000 \
docker run --rm -d -p 3000:3000 -e NODE_ENV=production \
-v /home/ec2-user/logs:/app/logs \
--network=mischaikow-home --name mischaikow-server --init site/server

Expand Down
5 changes: 5 additions & 0 deletions src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ const gitLogFileName = () => {
if (!fs.existsSync('/app/logs')) {
fs.mkdirSync('/app/logs');
}

if (!fs.existsSync(`/app/${logFileName}`)) {
fs.writeFileSync(`/app/${logFileName}`, '');
}

return `/app/${logFileName}`;
}
return logFileName;
Expand Down

0 comments on commit 474bb6e

Please sign in to comment.