Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ElasticSearch enabled in light image #17

Open
almereyda opened this issue Sep 24, 2022 · 0 comments
Open

ElasticSearch enabled in light image #17

almereyda opened this issue Sep 24, 2022 · 0 comments

Comments

@almereyda
Copy link

almereyda commented Sep 24, 2022

Archivy watches for ElasticSearch, if no environmental variable is given to disable.

mkdir -p archivy_data archivy_config
wget https://github.com/archivy/archivy-docker/raw/main/config-lite.yml -O archivy_config/config.yml

Then, depending on Docker or Podman being used, we issue:

chown -R 1000:1000 archivy_*
podman unshare chown 1000:1000 -R archivy_*

When running the following docker-compose.yml (with fused configurations of light and custom-config), Archivy attempts to wait for ElasticSearch, because it is enabled:

version: '3'

services:

  archivy:
    image: uzayg/archivy:latest-lite
    ports:
      - "5000"
    environment:
      - ELASTICSEARCH_ENABLED=0
      - FLASK_DEBUG=0
    volumes:
      - ./archivy_data:/archivy/data:z
      - ./archivy_config:/archivy/.local/share/archivy:z
$ docker-compose up
Creating network "archivy_default" with the default driver
Creating archivy_archivy_1 ... done
Attaching to archivy_archivy_1
archivy_1  | Setting environment variables.
archivy_1  | The following environment variables were set:
archivy_1  |            FLASK_DEBUG=0
archivy_1  |            ELASTICSEARCH_ENABLED=1
archivy_1  |            ELASTICSEARCH_URL=http://elasticsearch:9200/
archivy_1  |            ARCHIVY_PORT=5000
archivy_1  | Checking if Elasticsearch is up and running
archivy_1  | Waiting for Elasticsearch @ http://elasticsearch:9200/ to start.
archivy_1  | Waiting for Elasticsearch @ http://elasticsearch:9200/ to start.
archivy_1  | Waiting for Elasticsearch @ http://elasticsearch:9200/ to start.
^CGracefully stopping... (press Ctrl+C again to force)
Stopping archivy_archivy_1 ... done

This is circumvented with inserting the environmental variable ELASTICSEARCH_ENABLED set to 0.

      - ELASTICSEARCH_ENABLED=0
$ docker-compose up
Creating network "archivy_default" with the default driver
Creating archivy_archivy_1 ... done
Attaching to archivy_archivy_1
archivy_1  | Setting environment variables.
archivy_1  | The following environment variables were set:
archivy_1  |            FLASK_DEBUG=0
archivy_1  |            ELASTICSEARCH_ENABLED=0
archivy_1  |            ELASTICSEARCH_URL=http://elasticsearch:9200/
archivy_1  |            ARCHIVY_PORT=5000
archivy_1  | Elasticsearch not used. Search function will not work.
archivy_1  | Starting Archivy
archivy_1  | Running archivy...
archivy_1  | [2022-09-24 18:39:42,440] INFO in __init__: OUTPUT_FOLDER: /tmp/click-web
archivy_1  |  * Serving Flask app 'archivy' (lazy loading)
archivy_1  |  * Environment: production
archivy_1  |    WARNING: This is a development server. Do not use it in a production deployment.
archivy_1  |    Use a production WSGI server instead.
archivy_1  |  * Debug mode: off
archivy_1  |  * Running on all addresses.
archivy_1  |    WARNING: This is a development server. Do not use it in a production deployment.
archivy_1  |  * Running on http://10.89.5.2:5000/ (Press CTRL+C to quit)
archivy_1  | 10.89.5.2 - - [24/Sep/2022 18:42:45] "GET / HTTP/1.1" 302 -
archivy_1  | 10.89.5.2 - - [24/Sep/2022 18:42:45] "GET /login?next=%2F HTTP/1.1" 200 -
archivy_1  | 10.89.5.2 - - [24/Sep/2022 18:42:45] "GET /static/main.css HTTP/1.1" 200 -
archivy_1  | 10.89.5.2 - - [24/Sep/2022 18:42:45] "GET /static/logo.png HTTP/1.1" 200 -
archivy_1  | 10.89.5.2 - - [24/Sep/2022 18:42:45] "GET /static/archivy.svg HTTP/1.1" 200 -

We can then create the admin user, and get the port of the application from the container API:

$ docker-compose exec archivy archivy create-admin username
$ docker-compose port archivy 5000

Note: This is using Podman > 4 together with systemctl enable --user podman.socket podman.service and export DOCKER_HOST=unix:///run/user/1000/podman/podman.sock and docker-compose 1.29.2, why we add the :z annotation to the volume mounts. More about why this is neccessary in:

This adds an additional unshare step to the initialisation of the directories to be mounted, if they were not autogenerated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant