mirror of
https://github.com/ArchiveBox/ArchiveBox
synced 2025-03-05 15:47:24 +00:00
fix a few small nits
This commit is contained in:
parent
3fb5b6eb94
commit
611a2b7c1b
4 changed files with 19 additions and 18 deletions
|
@ -319,7 +319,7 @@ def worker_detail_view(request: HttpRequest, key: str, **kwargs) -> ItemContext:
|
|||
assert request.user.is_superuser, "Must be a superuser to view configuration settings."
|
||||
|
||||
from queues.supervisor_util import get_existing_supervisord_process, get_worker
|
||||
from queues.settings import CONFIG_FILE
|
||||
from queues.settings import SUPERVISORD_CONFIG_FILE
|
||||
|
||||
supervisor = get_existing_supervisord_process()
|
||||
if supervisor is None:
|
||||
|
@ -332,7 +332,7 @@ def worker_detail_view(request: HttpRequest, key: str, **kwargs) -> ItemContext:
|
|||
all_config = cast(List[Dict[str, Any]], supervisor.getAllConfigInfo() or [])
|
||||
|
||||
if key == 'supervisord':
|
||||
relevant_config = CONFIG_FILE.read_text()
|
||||
relevant_config = SUPERVISORD_CONFIG_FILE.read_text()
|
||||
relevant_logs = cast(str, supervisor.readLog(0, 10_000_000))
|
||||
start_ts = [line for line in relevant_logs.split("\n") if "RPC interface 'supervisor' initialized" in line][-1].split(",", 1)[0]
|
||||
uptime = str(timezone.now() - parse_date(start_ts)).split(".")[0]
|
||||
|
|
|
@ -280,7 +280,7 @@ def version(quiet: bool=False,
|
|||
data_dir_uid, data_dir_gid = data_dir_stat.st_uid, data_dir_stat.st_gid
|
||||
data_owned_by_root = data_dir_uid == 0
|
||||
|
||||
data_owned_by_default_user = data_dir_uid == DEFAULT_PUID or data_dir_gid == DEFAULT_PGID
|
||||
# data_owned_by_default_user = data_dir_uid == DEFAULT_PUID or data_dir_gid == DEFAULT_PGID
|
||||
data_owner_doesnt_match = (data_dir_uid != ARCHIVEBOX_USER and data_dir_gid != ARCHIVEBOX_GROUP) and not IS_ROOT
|
||||
data_not_writable = not (os.access(DATA_DIR, os.W_OK) and os.access(CONSTANTS.LIB_DIR, os.W_OK) and os.access(CONSTANTS.TMP_DIR, os.W_OK))
|
||||
if data_owned_by_root:
|
||||
|
@ -290,7 +290,7 @@ def version(quiet: bool=False,
|
|||
else:
|
||||
prnt(f':information: [blue]DATA_DIR[/blue] is currently owned by [blue]{data_dir_uid}:{data_dir_gid}[/blue] (PUID:PGID)')
|
||||
|
||||
if data_owned_by_root or data_owner_doesnt_match or data_owned_by_default_user or data_not_writable:
|
||||
if data_owned_by_root or data_owner_doesnt_match or data_not_writable:
|
||||
prnt(f'[violet]Hint:[/violet] If you encounter permissions errors, change [red]{data_dir_uid}[/red]:{data_dir_gid} (PUID:PGID) to match the user that will run ArchiveBox, e.g.:')
|
||||
prnt(f' [grey53]sudo[/grey53] chown -R [blue]{DEFAULT_PUID}:{DEFAULT_PGID}[/blue] {DATA_DIR.resolve()}')
|
||||
prnt(f' [grey53]sudo[/grey53] chown -R [blue]{DEFAULT_PUID}:{DEFAULT_PGID}[/blue] {CONSTANTS.LIB_DIR.resolve()}')
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
__package__ = 'archivebox.misc'
|
||||
|
||||
import sys
|
||||
|
||||
from rich import print
|
||||
|
||||
# DO NOT ADD ANY TOP-LEVEL IMPORTS HERE
|
||||
|
@ -59,6 +60,18 @@ def check_io_encoding():
|
|||
print(' Confirm that it\'s fixed by opening a new shell and running:', file=sys.stderr)
|
||||
print(' python3 -c "import sys; print(sys.stdout.encoding)" # should output UTF-8', file=sys.stderr)
|
||||
raise SystemExit(2)
|
||||
|
||||
# # hard errors: check python version
|
||||
# if sys.version_info[:3] < (3, 10, 0):
|
||||
# print('[red][X] Python version is not new enough: {sys.version} (>3.10 is required)[/red]', file=sys.stderr)
|
||||
# print(' See https://github.com/ArchiveBox/ArchiveBox/wiki/Troubleshooting#python for help upgrading your Python installation.', file=sys.stderr)
|
||||
# raise SystemExit(2)
|
||||
|
||||
# # hard errors: check django version
|
||||
# if int(django.VERSION[0]) < 5:
|
||||
# print('[red][X] Django version is not new enough: {django.VERSION[:3]} (>=5.0 is required)[/red]', file=sys.stderr)
|
||||
# print(' Upgrade django using pip or your system package manager: pip3 install --upgrade django', file=sys.stderr)
|
||||
# raise SystemExit(2)
|
||||
|
||||
|
||||
def check_not_root():
|
||||
|
|
|
@ -226,26 +226,14 @@ class CheckPipEnvironment(BaseCheck):
|
|||
|
||||
@staticmethod
|
||||
def check(settings, logger) -> List[Warning]:
|
||||
# hard errors: check python version
|
||||
if sys.version_info[:3] < (3, 10, 0):
|
||||
print('[red][X] Python version is not new enough: {sys.version} (>3.10 is required)[/red]', file=sys.stderr)
|
||||
print(' See https://github.com/ArchiveBox/ArchiveBox/wiki/Troubleshooting#python for help upgrading your Python installation.', file=sys.stderr)
|
||||
raise SystemExit(2)
|
||||
|
||||
# hard errors: check django version
|
||||
if int(django.VERSION[0]) < 5:
|
||||
print('[red][X] Django version is not new enough: {django.VERSION[:3]} (>=5.0 is required)[/red]', file=sys.stderr)
|
||||
print(' Upgrade django using pip or your system package manager: pip3 install --upgrade django', file=sys.stderr)
|
||||
raise SystemExit(2)
|
||||
|
||||
# soft errors: check that lib/pip virtualenv is setup properly
|
||||
errors = []
|
||||
|
||||
LIB_PIP_BINPROVIDER.setup()
|
||||
if not LIB_PIP_BINPROVIDER.INSTALLER_BIN_ABSPATH:
|
||||
if not LIB_PIP_BINPROVIDER.is_valid:
|
||||
errors.append(
|
||||
Error(
|
||||
"Failed to setup data/lib/pip virtualenv for runtime dependencies!",
|
||||
f"Failed to setup {LIB_PIP_BINPROVIDER.pip_venv} virtualenv for runtime dependencies!",
|
||||
id="pip.P001",
|
||||
hint="Make sure the data dir is writable and make sure python3-pip and python3-venv are installed & available on the host.",
|
||||
)
|
||||
|
|
Loading…
Add table
Reference in a new issue