openspug / spug

开源运维平台:面向中小型企业设计的轻量级无Agent的自动化运维平台,整合了主机管理、主机批量执行、主机在线终端、文件在线上传下载、应用发布部署、在线任务计划、配置中心、监控、报警等一系列功能。
https://spug.cc
GNU Affero General Public License v3.0
10.23k stars 2.07k forks source link

Bug: [windows]系统初始化错误,无法建立admin账户 #695

Open DZG-MELODY opened 1 day ago

DZG-MELODY commented 1 day ago

Spug 版本:V3.3.3 操作系统:windows 11

问题重现步骤

启动镜像服务后,运行如下脚本:

docker exec spug init_spug admin spug.cc

报错/问题截图

No changes detected in apps 'repository', 'setting', 'schedule', 'monitor', 'alarm', 'app', 'notify', 'deploy', 'host', 'config', 'account', 'exec', 'home' Operations to perform: Apply all migrations: account, alarm, app, config, deploy, exec, home, host, monitor, notify, repository, schedule, setting Running migrations: Applying alarm.0001_initial... OK Applying config.0001_initial...Traceback (most recent call last): File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/usr/local/lib/python3.10/dist-packages/django/db/backends/mysql/base.py", line 71, in execute return self.cursor.execute(query, args)
File "/usr/lib/python3/dist-packages/MySQLdb/cursors.py", line 209, in execute res = self._query(query) File "/usr/lib/python3/dist-packages/MySQLdb/cursors.py", line 315, in _query db.query(q) File "/usr/lib/python3/dist-packages/MySQLdb/connections.py", line 239, in query _mysql.connection.query(self, query) MySQLdb._exceptions.OperationalError: (2013, 'Lost connection to MySQL server during query')

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/data/spug/spug_api/manage.py", line 24, in main() File "/data/spug/spug_api/manage.py", line 20, in main execute_from_command_line(sys.argv) File "/usr/local/lib/python3.10/dist-packages/django/core/management/init.py", line 381, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.10/dist-packages/django/core/management/init.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.10/dist-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(*args, cmd_options) File "/usr/local/lib/python3.10/dist-packages/django/core/management/base.py", line 364, in execute output = self.handle(*args, *options) File "/data/spug/spug_api/apps/account/management/commands/updatedb.py", line 16, in handle execute_from_command_line(['manage.py', 'migrate']) File "/usr/local/lib/python3.10/dist-packages/django/core/management/init.py", line 381, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.10/dist-packages/django/core/management/init.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.10/dist-packages/django/core/management/base.py", line 323, in run_from_argv self.execute(args, cmd_options) File "/usr/local/lib/python3.10/dist-packages/django/core/management/base.py", line 364, in execute output = self.handle(*args, *options) File "/usr/local/lib/python3.10/dist-packages/django/core/management/base.py", line 83, in wrapped
res = handle_func(
args, **kwargs) File "/usr/local/lib/python3.10/dist-packages/django/core/management/commands/migrate.py", line 232, in handle post_migrate_state = executor.migrate( File "/usr/local/lib/python3.10/dist-packages/django/db/migrations/executor.py", line 117, in migrate state = self._migrate_all_forwards(state, plan, full_plan, fake=fake, fake_initial=fake_initial)
File "/usr/local/lib/python3.10/dist-packages/django/db/migrations/executor.py", line 147, in _migrate_all_forwards state = self.apply_migration(state, migration, fake=fake, fake_initial=fake_initial) File "/usr/local/lib/python3.10/dist-packages/django/db/migrations/executor.py", line 244, in apply_migration with self.connection.schema_editor(atomic=migration.atomic) as schema_editor: File "/usr/local/lib/python3.10/dist-packages/django/db/backends/base/schema.py", line 110, in exit self.execute(sql) File "/usr/local/lib/python3.10/dist-packages/django/db/backends/base/schema.py", line 137, in execute cursor.execute(sql, params) File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 76, in _execute_with_w File "/usr/local/li File "/usr/local/lib/python3.10/dist-packages/django/db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "/usr/local/lib/python3.10/dist-packages/django/db/backends/mysql/base.py", line 71, in execute return self.cursor.execute(query, args) File "/usr/lib/python3/dist-packages/MySQLdb/cursors.py", line 209, in execute res = self._query(query) File "/usr/lib/python3/dist-packages/MySQLdb/cursors.py", line 315, in _query db.query(q) File "/usr/lib/python3/dist-packages/MySQLdb/connections.py", line 239, in query _mysql.connection.query(self, query) django.db.utils.OperationalError: (2013, 'Lost connection to MySQL server during query')

期望的结果