Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
887 views
in Technique[技术] by (71.8m points)

pm2 deploy production, 'post-deploy' doesn't work

When cloning, 3 folders are created: source, current, shared. Thus, I expect cloning in the /var/www/funprograms.ru/html/ folder, but I get it in /var/www/funprograms.ru/html/source. Read a lot on google. I came to the conclusion that such behavior in npm2 cannot be fixed.

Now I copy the repository after cloning from var / www / funprograms.ru / html / source to /var/www/funprograms.ru/html/. I also try to change the directory cd /var/www/funprograms.ru/html/ to 'post-deploy' (I also tried in post-setup, but to no avail).

commands in 'post-deploy': 'cd /var/www/funprograms.ru/html/ && npm install && pm2 reload ecosystem.config.js --env production' are not executed.

I run: "pm2 deploy production setup" and " pm2 deploy ecosystem.config.js production setup", The result is the same.

I have ecosystem.config.js:

autorestart: true,
      watch: false,
      max_memory_restart: "250M",
      env: {
        NODE_ENV: "development",
      },
      env_production: {
        NODE_ENV: "production",
...},
  deploy: {
    production: {
      user: '',
      host: '',
      key: 'id_rsa.pub',
      ref: 'origin/main', 
      repo: '[email protected]:illusionoff/homemoneycalc.git',
      fetch: 'all',
      path: '/var/www/funprograms.ru/html/', //'/var/www/funprograms.ru/html'
      "post-setup": 'cp -rp /var/www/funprograms.ru/html/source/* /var/www/funprograms.ru/html/ ', //&& cd /var/www/funprograms.ru/html/
      'pre-deploy-local': '',
      'post-deploy': 'cd /var/www/funprograms.ru/html/ && npm install && pm2 reload ecosystem.config.js --env production', //'npm install && pm2 reload ecosystem.config.js --env production'
      'pre-setup': ''
    }
  }

Has anyone come across such questions?

question from:https://stackoverflow.com/questions/65643367/pm2-deploy-production-post-deploy-doesnt-work

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share

2.1m questions

2.1m answers

62 comments

56.6k users

...