From ea905d68bb2b2266731f0571399aef85594cb58e Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Wed, 16 Jan 2019 09:20:15 -0500 Subject: [PATCH] fix etc nginx and Docker config --- .dockerignore | 1 + Dockerfile | 8 +++--- docker-compose.yml | 25 ++++++++++++++++++ etc/nginx/conf.d/archivebox.conf | 10 ------- etc/nginx/nginx.conf | 45 ++++++++++++++++++++++++++++++++ 5 files changed, 74 insertions(+), 15 deletions(-) create mode 100644 docker-compose.yml delete mode 100644 etc/nginx/conf.d/archivebox.conf create mode 100644 etc/nginx/nginx.conf diff --git a/.dockerignore b/.dockerignore index 5973eb17..9979d3ca 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,3 +3,4 @@ __pycache__ .DS_Store venv .venv +data diff --git a/Dockerfile b/Dockerfile index aca5ff19..abf0229d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,7 +21,8 @@ RUN apt-get update && apt-get install -y curl --no-install-recommends \ # RUN chmod +x /usr/local/bin/dumb-init RUN git clone https://github.com/pirate/ArchiveBox /home/chromeuser/app \ - && pip3 install -r /home/chromeuser/app/archivebox/requirements.txt + && pip3 install -r /home/chromeuser/app/archivebox/requirements.txt \ + && ln -s /home/chromeuser/app/bin/archivebox /usr/bin/archive # Add user so we area strong, independent chrome that don't need --no-sandbox. RUN groupadd -r chromeuser && useradd -r -g chromeuser -G audio,video chromeuser \ @@ -43,7 +44,4 @@ ENV LANG=en_US.UTF-8 \ USER chromeuser WORKDIR /home/chromeuser/app -# ENTRYPOINT ["dumb-init", "--"] -# CMD ["/home/chromeuser/app/archive"] - -ENTRYPOINT ["python3", "-u", "/home/chromeuser/app/archivebox/archive.py"] +CMD ["/usr/bin/archive"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..25cdceac --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,25 @@ +version: '3' + +services: + archivebox: + build: . + stdin_open: true + tty: true + environment: + - FETCH_SCREENSHOT=False + - FETCH_PDF=False + - FETCH_DOM=False + - FETCH_MEDIA=False + - USE_COLOR=False + - SHOW_PROGRESS=False + volumes: + - ./data:/data + command: bash -c 'echo "https://example.com" | /usr/bin/archive; tail -f /dev/null' + + nginx: + image: 'nginx' + ports: + - '8098:80' + volumes: + - ./etc/nginx/nginx.conf:/etc/nginx/nginx.conf + - ./data:/var/www diff --git a/etc/nginx/conf.d/archivebox.conf b/etc/nginx/conf.d/archivebox.conf deleted file mode 100644 index 94c51f37..00000000 --- a/etc/nginx/conf.d/archivebox.conf +++ /dev/null @@ -1,10 +0,0 @@ -server { - listen 80 default_server; - server_name _; - - root /opt/ArchiveBox/output/; - index index.html; - autoindex on; - - try_files $uri $uri/ $uri.html =404; -} diff --git a/etc/nginx/nginx.conf b/etc/nginx/nginx.conf new file mode 100644 index 00000000..2fc55a29 --- /dev/null +++ b/etc/nginx/nginx.conf @@ -0,0 +1,45 @@ +user www-data; +pid /var/run/nginx.pid; + +worker_processes auto; +timer_resolution 100ms; + +worker_rlimit_nofile 40000; +events { + worker_connections 40000; + use epoll; + multi_accept on; +} + +http { + sendfile on; + tcp_nopush on; + tcp_nodelay on; + server_tokens off; + send_timeout 20; + keepalive_timeout 65; + types_hash_max_size 2048; + client_max_body_size 25m; + + include mime.types; + default_type application/octet-stream; + + access_log /dev/stdout; + error_log stderr; + + reset_timedout_connection on; + + server_names_hash_bucket_size 64; + + server { + listen 80 default_server; + server_name _; + + root /var/www; + index index.html; + autoindex on; + + try_files $uri $uri/ $uri.html =404; + } +} +