使用Mac M1时,命令`supervisorctl restart`执行失败,退出代码为…

huangapple go评论123阅读模式
英文:

Command `supervisorctl restart` failed with exit code using mac m1

问题

我正在运行在Mac M1上,使用Docker和Gulp。

我的第一个错误是"command ld not found",但我在这里解决了它。
https://stackoverflow.com/questions/71718772/how-to-solve-running-gcc-failed-exit-status-1-in-mac-m1

然后我遇到了这个错误。

完整的错误信息如下:

  1. [17:09:04] 'restart-supervisor' 1.04 秒后出错
  2. [17:14:45] '<anonymous>' 220 毫秒后出错
  3. [17:14:45] 插件"gulp-shell"出错
  4. 错误信息:
  5. 命令 `supervisorctl restart projectname` 执行失败,退出码为 7
  6. [17:14:45] 'restart-supervisor' 838 毫秒后出错

我已经进行了很多研究:

  1. 我尝试了这个方法,但是命令找不到。
    https://github.com/Supervisor/supervisor/issues/121
  2. 还有这个方法。
    https://github.com/Supervisor/supervisor/issues/1223.
  3. 我甚至将我的镜像更改为 arm64v8/golang:1.17-alpine3.14

这是我的gulpfile.js文件:

  1. var gulp = require("gulp");
  2. var shell = require('gulp-shell');
  3. gulp.task("build-binary", shell.task(
  4. 'go build'
  5. ));
  6. gulp.task("restart-supervisor", gulp.series("build-binary", shell.task(
  7. 'supervisorctl restart projectname'
  8. )))
  9. gulp.task('watch', function() {
  10. gulp.watch([
  11. "*.go",
  12. "*.mod",
  13. "*.sum",
  14. "**/*.go",
  15. "**/*.mod",
  16. "**/*.sum"
  17. ],
  18. {interval: 1000, usePolling: true},
  19. gulp.series('build-binary', 'restart-supervisor'
  20. ));
  21. });
  22. gulp.task('default', gulp.series('watch'));

这是我的当前dockerfile:

  1. FROM arm64v8/golang:1.17-alpine3.14
  2. RUN apk update && apk add gcc make git libc-dev binutils-gold
  3. # 安装依赖
  4. RUN apk add --update tzdata \
  5. --no-cache ca-certificates git wget \
  6. nodejs npm \
  7. g++ \
  8. supervisor \
  9. && update-ca-certificates \
  10. && npm install -g gulp gulp-shell
  11. COPY ops/api/local/supervisor /etc
  12. ENV PATH $PATH:/go/bin
  13. WORKDIR /go/src/github.com/projectname/src/api

在我的docker-compose.yaml文件中,我有以下内容:

  1. entrypoint:
  2. [
  3. "sh",
  4. "-c",
  5. "npm install gulp gulp-shell && supervisord -c /etc/supervisord.conf && gulp"
  6. ]

vim /etc/supervisord.conf:

  1. #!/bin/sh
  2. [unix_http_server]
  3. file=/tmp/supervisor.sock
  4. username=admin
  5. password=revproxy
  6. [supervisord]
  7. nodaemon=false
  8. user=root
  9. logfile=/dev/null
  10. logfile_maxbytes=0
  11. logfile_backups=0
  12. loglevel=info
  13. [rpcinterface:supervisor]
  14. supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
  15. [supervisorctl]
  16. serverurl=unix:///tmp/supervisor.sock
  17. username=admin
  18. password=revproxy
  19. [program:projectname_api]
  20. directory=/go/src/github.com/projectname/src/api
  21. command=/go/src/github.com/projectname/src/api/api
  22. autostart=true
  23. autorestart=true
  24. stderr_logfile=/go/src/github.com/projectname/src/api/api_err.log
  25. stderr_logfile_maxbytes=0
  26. stdout_logfile=/go/src/github.com/projectname/src/api/api_debug.log
  27. stdout_logfile_maxbytes=0
  28. startsecs=0

但是,说真的,这个Mac M1有什么问题。
我已经尝试在Rosetta和非Rosetta上进行,版本为2。
如果我的问题标题有误,请纠正我,我也不确定我的错误是什么。

英文:

I am running on mac m1, docker, gulp.

my first error was command ld not found, but i fixed it in here.
https://stackoverflow.com/questions/71718772/how-to-solve-running-gcc-failed-exist-status-1-in-mac-m1

After that it leads me to this error.

this is the full error:

  1. [17:09:04] &#39;restart-supervisor&#39; errored after 1.04 s
  2. [17:14:45] &#39;&lt;anonymous&gt;&#39; errored after 220 ms
  3. [17:14:45] Error in plugin &quot;gulp-shell&quot;
  4. Message:
  5. Command `supervisorctl restart projectname` failed with exit code 7
  6. [17:14:45] &#39;restart-supervisor&#39; errored after 838 ms

Ive done a lot of research:

  1. Ive tried doing this, but the command isn't found.
    https://github.com/Supervisor/supervisor/issues/121
  2. This as well.
    https://github.com/Supervisor/supervisor/issues/1223.
  3. I even change my image to arm64v8/golang:1.17-alpine3.14

this is my gulpfile.js:

  1. var gulp = require(&quot;gulp&quot;);
  2. var shell = require(&#39;gulp-shell&#39;);
  3. gulp.task(&quot;build-binary&quot;, shell.task(
  4. &#39;go build&#39;
  5. ));
  6. gulp.task(&quot;restart-supervisor&quot;, gulp.series(&quot;build-binary&quot;, shell.task(
  7. &#39;supervisorctl restart projectname&#39;
  8. )))
  9. gulp.task(&#39;watch&#39;, function() {
  10. gulp.watch([
  11. &quot;*.go&quot;,
  12. &quot;*.mod&quot;,
  13. &quot;*.sum&quot;,
  14. &quot;**/*.go&quot;,
  15. &quot;**/*.mod&quot;,
  16. &quot;**/*.sum&quot;
  17. ],
  18. {interval: 1000, usePolling: true},
  19. gulp.series(&#39;build-binary&#39;, &#39;restart-supervisor&#39;
  20. ));
  21. });
  22. gulp.task(&#39;default&#39;, gulp.series(&#39;watch&#39;));

This is my current dockerfile:

  1. FROM arm64v8/golang:1.17-alpine3.14
  2. RUN apk update &amp;&amp; apk add gcc make git libc-dev binutils-gold
  3. # Install dependencies
  4. RUN apk add --update tzdata \
  5. --no-cache ca-certificates git wget \
  6. nodejs npm \
  7. g++ \
  8. supervisor \
  9. &amp;&amp; update-ca-certificates \
  10. &amp;&amp; npm install -g gulp gulp-shell
  11. COPY ops/api/local/supervisor /etc
  12. ENV PATH $PATH:/go/bin
  13. WORKDIR /go/src/github.com/projectname/src/api

in my docker-compose.yaml i have this:

  1. entrypoint:
  2. [
  3. &quot;sh&quot;,
  4. &quot;-c&quot;,
  5. &quot;npm install gulp gulp-shell &amp;&amp; supervisord -c /etc/supervisord.conf &amp;&amp; gulp&quot;
  6. ]

vim /etc/supervisord.conf:

  1. #!/bin/sh
  2. [unix_http_server]
  3. file=/tmp/supervisor.sock
  4. username=admin
  5. password=revproxy
  6. [supervisord]
  7. nodaemon=false
  8. user=root
  9. logfile=/dev/null
  10. logfile_maxbytes=0
  11. logfile_backups=0
  12. loglevel=info
  13. [rpcinterface:supervisor]
  14. supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
  15. [supervisorctl]
  16. serverurl=unix:///tmp/supervisor.sock
  17. username=admin
  18. password=revproxy
  19. [program:projectname_api]
  20. directory=/go/src/github.com/projectname/src/api
  21. command=/go/src/github.com/projectname/src/api/api
  22. autostart=true
  23. autorestart=true
  24. stderr_logfile=/go/src/github.com/projectname/src/api/api_err.log
  25. stderr_logfile_maxbytes=0
  26. stdout_logfile=/go/src/github.com/projectname/src/api/api_debug.log
  27. stdout_logfile_maxbytes=0
  28. startsecs=0

But seriously, what is wrong with this mac m1.
I have tried doing it in rosetta and non-rosetta, version 2.
If the title of my question is wrong please correct me, I also not sure of my error.

答案1

得分: 0

我通过添加 #!/bin/shstartsecs=0 来解决了问题,没有显示任何错误,但下一个问题是 API 没有在运行。

英文:

I fixed the problem by adding #!/bin/sh and startsecs=0, no errors to be showing but the next problem is the API is not running.

huangapple
  • 本文由 发表于 2022年4月7日 01:29:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/71771233.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定