Search code examples
dockergodocker-composeapple-m1arm64

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


I am running on mac m1, docker, gulp.

my first error was command ld not found, but i fixed it in here.
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:

  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:

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.


Solution

  • 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.