英文:
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
然后我遇到了这个错误。
完整的错误信息如下:
[17:09:04] 'restart-supervisor' 在 1.04 秒后出错
[17:14:45] '<anonymous>' 在 220 毫秒后出错
[17:14:45] 插件"gulp-shell"出错
错误信息:
    命令 `supervisorctl restart projectname` 执行失败,退出码为 7
[17:14:45] 'restart-supervisor' 在 838 毫秒后出错
我已经进行了很多研究:
- 我尝试了这个方法,但是命令找不到。
https://github.com/Supervisor/supervisor/issues/121 - 还有这个方法。
https://github.com/Supervisor/supervisor/issues/1223. - 我甚至将我的镜像更改为 
arm64v8/golang:1.17-alpine3.14 
这是我的gulpfile.js文件:
var gulp = require("gulp");
var shell = require('gulp-shell');
gulp.task("build-binary", shell.task(
'go build'
));
gulp.task("restart-supervisor", gulp.series("build-binary", shell.task(
'supervisorctl restart projectname'
)))
gulp.task('watch', function() {
    gulp.watch([
                "*.go", 
                "*.mod", 
                "*.sum", 
                "**/*.go", 
                "**/*.mod",
                "**/*.sum"
                ], 
                {interval: 1000, usePolling: true},
                gulp.series('build-binary', 'restart-supervisor'
    ));
});
gulp.task('default', gulp.series('watch'));
这是我的当前dockerfile:
FROM arm64v8/golang:1.17-alpine3.14
RUN apk update && apk add gcc make git libc-dev binutils-gold
# 安装依赖
RUN apk add --update tzdata \
    --no-cache ca-certificates git wget \
    nodejs npm \
    g++ \
    supervisor \
    && update-ca-certificates \
    && npm install -g gulp gulp-shell
COPY ops/api/local/supervisor /etc
ENV PATH $PATH:/go/bin
WORKDIR /go/src/github.com/projectname/src/api
在我的docker-compose.yaml文件中,我有以下内容:
entrypoint:
  [
    "sh",
    "-c",
    "npm install gulp gulp-shell && supervisord -c /etc/supervisord.conf && gulp"
  ]
vim /etc/supervisord.conf:
    #!/bin/sh
[unix_http_server]
    file=/tmp/supervisor.sock
    username=admin
    password=revproxy
    
    [supervisord]
    nodaemon=false
    user=root
    logfile=/dev/null
    logfile_maxbytes=0
    logfile_backups=0
    loglevel=info   
    [rpcinterface:supervisor]
    supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
    
    [supervisorctl]
    serverurl=unix:///tmp/supervisor.sock
    username=admin
    password=revproxy
    
    [program:projectname_api]
    directory=/go/src/github.com/projectname/src/api
    command=/go/src/github.com/projectname/src/api/api
    autostart=true
    autorestart=true
    stderr_logfile=/go/src/github.com/projectname/src/api/api_err.log
    stderr_logfile_maxbytes=0
  stdout_logfile=/go/src/github.com/projectname/src/api/api_debug.log
    stdout_logfile_maxbytes=0
    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:
[17:09:04] 'restart-supervisor' errored after 1.04 s
[17:14:45] '<anonymous>' errored after 220 ms
[17:14:45] Error in plugin "gulp-shell"
Message:
    Command `supervisorctl restart projectname` failed with exit code 7
[17:14:45] 'restart-supervisor' errored after 838 ms
Ive done a lot of research:
- Ive tried doing this, but the command isn't found.
https://github.com/Supervisor/supervisor/issues/121 - This as well.
https://github.com/Supervisor/supervisor/issues/1223. - I even change my image to 
arm64v8/golang:1.17-alpine3.14 
this is my gulpfile.js:
var gulp = require("gulp");
var shell = require('gulp-shell');
gulp.task("build-binary", shell.task(
'go build'
));
gulp.task("restart-supervisor", gulp.series("build-binary", shell.task(
'supervisorctl restart projectname'
)))
gulp.task('watch', function() {
    gulp.watch([
                "*.go", 
                "*.mod", 
                "*.sum", 
                "**/*.go", 
                "**/*.mod",
                "**/*.sum"
                ], 
                {interval: 1000, usePolling: true},
                gulp.series('build-binary', 'restart-supervisor'
    ));
});
gulp.task('default', gulp.series('watch'));
This is my current dockerfile:
FROM arm64v8/golang:1.17-alpine3.14
RUN apk update && apk add gcc make git libc-dev binutils-gold
# Install dependencies
RUN apk add --update tzdata \
    --no-cache ca-certificates git wget \
    nodejs npm \
    g++ \
    supervisor \
    && update-ca-certificates \
    && npm install -g gulp gulp-shell
COPY ops/api/local/supervisor /etc
ENV PATH $PATH:/go/bin
WORKDIR /go/src/github.com/projectname/src/api
in my docker-compose.yaml i have this:
entrypoint:
  [
    "sh",
    "-c",
    "npm install gulp gulp-shell && supervisord -c /etc/supervisord.conf && gulp"
  ]
vim /etc/supervisord.conf:
    #!/bin/sh
[unix_http_server]
    file=/tmp/supervisor.sock
    username=admin
    password=revproxy
    
    [supervisord]
    nodaemon=false
    user=root
    logfile=/dev/null
    logfile_maxbytes=0
    logfile_backups=0
    loglevel=info   
    [rpcinterface:supervisor]
    supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
    
    [supervisorctl]
    serverurl=unix:///tmp/supervisor.sock
    username=admin
    password=revproxy
    
    [program:projectname_api]
    directory=/go/src/github.com/projectname/src/api
    command=/go/src/github.com/projectname/src/api/api
    autostart=true
    autorestart=true
    stderr_logfile=/go/src/github.com/projectname/src/api/api_err.log
    stderr_logfile_maxbytes=0
  stdout_logfile=/go/src/github.com/projectname/src/api/api_debug.log
    stdout_logfile_maxbytes=0
    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/sh 和 startsecs=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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论