systemd in nextjs

0

in EC2 my repo, I manually typed

yarn set version stable
yarn
yarn db:deploy
yarn build

I could ping EC2 public ip to view my web app

But when I use systemd cd /home/ec2-user/repo && yarn && yarn db:deploy && yarn build && yarn start It always fail

질문됨 7달 전350회 조회
1개 답변
0

Hi,

It's hard to understand what you are trying to achieve, but if you like to create a unit file for systems which will start your nextjs application you can use this https://gist.github.com/hardywu/361811f09130acae1762bfbf61a67e9c as template and this https://www.shubhamdipt.com/blog/how-to-create-a-systemd-service-in-linux/ as step by step instructions.

Hope it helps

profile picture
전문가
답변함 7달 전
  • The problem I am facing is that when I ssh to the instance, and type 'yarn', the command is found, but when used in script in systemd, or ApplicationStart in codedeploy, it always complain yarn: command not found.

  • It could be because yarn is intalled in the homedir of specific user and systemd is trying to run it from the different user.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠