修复mac环境下启动服务失败

qrnn
fxC 3 years ago
parent 2ec7fb05eb
commit 29328d293b
  1. 4
      fir_ser/api/management/commands/services/command.py
  2. 7
      fir_ser/api/management/commands/services/services/beat.py
  3. 6
      fir_ser/api/management/commands/services/services/celery_base.py
  4. 6
      fir_ser/api/management/commands/services/services/flower.py
  5. 7
      fir_ser/api/management/commands/services/services/uwsgi.py

@ -105,8 +105,8 @@ class BaseActionCommand(BaseCommand):
parser.add_argument('-usm', '--uwsgi_socket_mode', nargs="?", const=True,
help='run to bind socket mode, default http mode, only uwsgi service')
parser.add_argument('-f', '--force', nargs="?", const=True)
parser.add_argument('-u', '--uid', nargs="?", default='root', type=str)
parser.add_argument('-g', '--gid', nargs="?", default='root', type=str)
parser.add_argument('-u', '--uid', nargs="?", default='', type=str)
parser.add_argument('-g', '--gid', nargs="?", default='', type=str)
def initial_util(self, *args, **options):
service_names = options.get('services')

@ -20,11 +20,14 @@ class BeatService(BaseService):
'celery', '-A',
'fir_ser', 'beat',
'-l', 'INFO',
'--uid', self.uid,
'--gid', self.gid,
'--scheduler', scheduler,
'--max-interval', '60'
]
if self.uid:
cmd.extend(['--uid', self.uid])
if self.gid:
cmd.extend(['--gid', self.gid])
return cmd
@property

@ -26,12 +26,14 @@ class CeleryBaseService(BaseService):
'celery', '-A',
'fir_ser', 'worker',
'-l', 'INFO',
'--uid', self.uid,
'--gid', self.gid,
'-c', str(self.num),
'-Q', self.queue,
'-n', f'{self.queue}@{server_hostname}'
]
if self.uid:
cmd.extend(['--uid', self.uid])
if self.gid:
cmd.extend(['--gid', self.gid])
return cmd
@property

@ -19,8 +19,6 @@ class FlowerService(BaseService):
'celery', '-A',
'fir_ser', 'flower',
'-l', 'INFO',
'--uid', self.uid,
'--gid', self.gid,
'--url_prefix=/flower',
'--auto_refresh=False',
'--max_tasks=1000',
@ -29,6 +27,10 @@ class FlowerService(BaseService):
# '--basic_auth=flower:ninevenxxx'
# '--tasks_columns=uuid,name,args,state,received,started,runtime,worker'
]
if self.uid:
cmd.extend(['--uid', self.uid])
if self.gid:
cmd.extend(['--gid', self.gid])
return cmd
@property

@ -20,8 +20,6 @@ class UwsgiService(BaseService):
bind = f'{SOCKET_HOST}:{SOCKET_PORT}'
cmd = [
'uwsgi',
'--uid', self.uid,
'--gid', self.gid,
'--processes', f'{self.processes}',
'--threads', f'{self.threads}',
'--wsgi-file', f"{BASE_DIR}/fir_ser/wsgi.py",
@ -32,7 +30,10 @@ class UwsgiService(BaseService):
'--enable-threads',
'--master',
]
if self.uid:
cmd.extend(['--uid', self.uid])
if self.gid:
cmd.extend(['--gid', self.gid])
if self.uwsgi_socket_mode:
cmd.extend(['--socket', bind])
else:

Loading…
Cancel
Save