Browse Source

dont check db if init is pending

Nick Sweeting 4 years ago
parent
commit
6aef1dd98d
2 changed files with 6 additions and 2 deletions
  1. 1 1
      Dockerfile
  2. 5 1
      archivebox/cli/__init__.py

+ 1 - 1
Dockerfile

@@ -121,4 +121,4 @@ HEALTHCHECK --interval=30s --timeout=20s --retries=15 \
     CMD curl --silent 'http://localhost:8000/admin/login/' || exit 1
     CMD curl --silent 'http://localhost:8000/admin/login/' || exit 1
 
 
 ENTRYPOINT ["dumb-init", "--", "/app/bin/docker_entrypoint.sh"]
 ENTRYPOINT ["dumb-init", "--", "/app/bin/docker_entrypoint.sh"]
-CMD ["archivebox", "server", "0.0.0.0:8000"]
+CMD ["archivebox", "server", "--quick-init", "0.0.0.0:8000"]

+ 5 - 1
archivebox/cli/__init__.py

@@ -63,7 +63,11 @@ def run_subcommand(subcommand: str,
 
 
     if subcommand not in meta_cmds:
     if subcommand not in meta_cmds:
         from ..config import setup_django
         from ..config import setup_django
-        setup_django(in_memory_db=subcommand in fake_db, check_db=subcommand in archive_cmds)
+
+        cmd_requires_db = subcommand in archive_cmds
+        init_pending = '--init' in subcommand_args or '--quick-init' in subcommand_args
+
+        setup_django(in_memory_db=subcommand in fake_db, check_db=cmd_requires_db and not init_pending)
 
 
     module = import_module('.archivebox_{}'.format(subcommand), __package__)
     module = import_module('.archivebox_{}'.format(subcommand), __package__)
     module.main(args=subcommand_args, stdin=stdin, pwd=pwd)    # type: ignore
     module.main(args=subcommand_args, stdin=stdin, pwd=pwd)    # type: ignore