diff --git a/Dockerfile b/Dockerfile index b11d3382..81e5f196 100644 --- a/Dockerfile +++ b/Dockerfile @@ -73,10 +73,11 @@ ENV PATH="${PATH}:$VENV_PATH/bin" RUN python -m venv --clear --symlinks "$VENV_PATH" \ && pip install --upgrade --quiet pip setuptools ADD "./setup.py" "$CODE_DIR/" -ADD "./README.md" "./package.json" "$CODE_DIR/archivebox/" +ADD "./package.json" "$CODE_DIR/archivebox/" RUN apt-get update -qq \ && apt-get install -qq -y --no-install-recommends \ build-essential python-dev python3-dev \ + && echo 'empty placeholder for setup.py to use' > "$CODE_DIR/archivebox/README.md" \ && python3 -c 'from distutils.core import run_setup; result = run_setup("./setup.py", stop_after="init"); print("\n".join(result.install_requires + result.extras_require["sonic"]))' > /tmp/requirements.txt \ && pip install --quiet -r /tmp/requirements.txt \ && apt-get purge -y build-essential python-dev python3-dev \ diff --git a/README.md b/README.md index c61cb8bc..161bb600 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,7 @@ curl -O 'https://raw.githubusercontent.com/ArchiveBox/ArchiveBox/master/docker-c Start the server.

-docker-compose run --rm archivebox init --setup
+docker-compose run archivebox init --setup
 docker-compose up
 
@@ -651,11 +651,13 @@ archivebox --version # if you edit e.g. ./archivebox/core/models.py on the docker host, runserver # inside the container will reload and pick up your changes docker build . -t archivebox -docker run -it --rm archivebox version -docker run -it --rm -p 8000:8000 \ +docker run -it archivebox init --setup +docker run -it -p 8000:8000 \ -v $PWD/data:/data \ -v $PWD/archivebox:/app/archivebox \ archivebox server 0.0.0.0:8000 --debug --reload + +# (remove the --reload flag and add the --nothreading flag when profiling with the django debug toolbar) ``` ### Common development tasks diff --git a/archivebox/main.py b/archivebox/main.py index 6e5dc5e5..fb7c1d39 100644 --- a/archivebox/main.py +++ b/archivebox/main.py @@ -437,17 +437,6 @@ def init(force: bool=False, quick: bool=False, setup: bool=False, out_dir: Path= print('{green}[√] Done. Verified and updated the existing ArchiveBox collection.{reset}'.format(**ANSI)) else: print('{green}[√] Done. A new ArchiveBox collection was initialized ({} links).{reset}'.format(len(all_links) + len(pending_links), **ANSI)) - - if Snapshot.objects.count() < 25: # hide the hints for experienced users - print() - print(' {lightred}Hint:{reset} To view your archive index, run:'.format(**ANSI)) - print(' archivebox server # then visit http://127.0.0.1:8000') - print() - print(' To add new links, you can run:') - print(" archivebox add ~/some/path/or/url/to/list_of_links.txt") - print() - print(' For more usage and examples, run:') - print(' archivebox help') json_index = out_dir / JSON_INDEX_FILENAME html_index = out_dir / HTML_INDEX_FILENAME @@ -459,6 +448,17 @@ def init(force: bool=False, quick: bool=False, setup: bool=False, out_dir: Path= if setup: run_subcommand('setup', pwd=out_dir) + + if Snapshot.objects.count() < 25: # hide the hints for experienced users + print() + print(' {lightred}Hint:{reset} To view your archive index, run:'.format(**ANSI)) + print(' archivebox server # then visit http://127.0.0.1:8000') + print() + print(' To add new links, you can run:') + print(" archivebox add ~/some/path/or/url/to/list_of_links.txt") + print() + print(' For more usage and examples, run:') + print(' archivebox help') @enforce_types def status(out_dir: Path=OUTPUT_DIR) -> None: diff --git a/docker-compose.yml b/docker-compose.yml index 4ed65ed0..6c374867 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,6 +1,6 @@ # Usage: -# docker-compose up -d -# docker-compose run archivebox init +# docker-compose run archivebox init --setup +# docker-compose up # echo "https://example.com" | docker-compose run archivebox archivebox add # docker-compose run archivebox add --depth=1 https://example.com/some/feed.rss # docker-compose run archivebox config --set PUBLIC_INDEX=True @@ -12,23 +12,20 @@ version: '3.7' services: archivebox: # build: . # for developers working on archivebox - image: ${DOCKER_IMAGE:-archivebox/archivebox:latest} + image: ${DOCKER_IMAGE:-archivebox/archivebox:latest} command: server --quick-init 0.0.0.0:8000 - stdin_open: true - tty: true ports: - 8000:8000 environment: - ALLOWED_HOSTS=* # add any config options you want as env vars - MEDIA_MAX_SIZE=750m - # - SHOW_PROGRESS=False # - SEARCH_BACKEND_ENGINE=sonic # uncomment these if you enable sonic below # - SEARCH_BACKEND_HOST_NAME=sonic # - SEARCH_BACKEND_PASSWORD=SecretPassword volumes: - ./data:/data # - ./archivebox:/app/archivebox # for developers working on archivebox - + # To run the Sonic full-text search backend, first download the config file to sonic.cfg # curl https://raw.githubusercontent.com/ArchiveBox/ArchiveBox/master/etc/sonic/config.cfg > sonic.cfg # sonic: @@ -54,7 +51,7 @@ services: # - SHOW_PROGRESS=False # volumes: # - ./data:/data - + # Example: Put Nginx in front of the ArchiveBox server for SSL termination # nginx: # image: nginx:alpine @@ -78,7 +75,7 @@ services: # volumes: # - /lib/modules:/lib/modules # - ./wireguard.conf:/config/wg0.conf:ro - + # Example: Run PYWB in parallel and auto-import WARCs from ArchiveBox # pywb: # image: webrecorder/pywb:latest