From 1a8de9ef3a87d1fa34265814e0987575e0846a99 Mon Sep 17 00:00:00 2001 From: Shyam Sunder Date: Sat, 7 Mar 2020 22:17:51 -0500 Subject: [PATCH] all: purge remaining elasticsearch artifacts --- doc/INSTALL.md | 56 ++++++++++++++----------------------- docker-compose.yml | 30 +++----------------- server/Dockerfile | 2 -- server/config.yaml.dist | 6 ---- server/hooks/test | 3 +- server/requirements.txt | 2 -- server/szurubooru/config.py | 14 +--------- server/szurubooru/facade.py | 1 - 8 files changed, 27 insertions(+), 87 deletions(-) diff --git a/doc/INSTALL.md b/doc/INSTALL.md index c763cc2e..3cb2699a 100644 --- a/doc/INSTALL.md +++ b/doc/INSTALL.md @@ -36,45 +36,31 @@ and Docker Compose (version 1.6.0 or greater) already installed. ### Running the Application -1. Configurations for ElasticSearch: +Download containers: +```console +user@host:szuru$ docker-compose pull +``` - You may need to raise the `vm.max_map_count` - parameter to at least `262144` in order for the - ElasticSearch container to function. Instructions - on how to do so are provided - [here](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-cli-run-prod-mode). +For first run, it is recommended to start the database separately: +```console +user@host:szuru$ docker-compose up -d sql +``` -2. Running the application +To start all containers: +```console +user@host:szuru$ docker-compose up -d +``` - Download containers: - ```console - user@host:szuru$ docker-compose pull - ``` +To view/monitor the application logs: +```console +user@host:szuru$ docker-compose logs -f +# (CTRL+C to exit) +``` - For first run, it is reccomended to start the databases seperately: - ```console - user@host:szuru$ docker-compose up -d elasticsearch - user@host:szuru$ docker-compose up -d sql - ``` - Then wait approx. 2 minutes before starting all containers. - This gives time for the databases to initalize their storage - structure. - - To start all containers: - ```console - user@host:szuru$ docker-compose up -d - ``` - - To view/monitor the application logs: - ```console - user@host:szuru$ docker-compose logs -f - # (CTRL+C to exit) - ``` - - To stop all containers: - ```console - user@host:szuru$ docker-compose down - ``` +To stop all containers: +```console +user@host:szuru$ docker-compose down +``` ### Additional Features diff --git a/docker-compose.yml b/docker-compose.yml index eebf0d01..1da23bd6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,32 +5,26 @@ version: '2' services: + server: image: szurubooru/server:latest depends_on: - sql - - elasticsearch environment: - ## These should be the names of the dependent containers listed above, + ## These should be the names of the dependent containers listed below, ## or FQDNs/IP addresses if these services are running outside of Docker POSTGRES_HOST: sql - ESEARCH_HOST: elasticsearch ## Credentials for database: POSTGRES_USER: POSTGRES_PASSWORD: ## Commented Values are Default: #POSTGRES_DB: defaults to same as POSTGRES_USER #POSTGRES_PORT: 5432 - #ESEARCH_PORT: 9200 - #ESEARCH_INDEX: szurubooru - #ESEARCH_PASSWORD: (empty by default, set if you are using an external - # source for elasticsearch and want to use HTTP basic - # authentication for security) - #ESEARCH_USER: szurubooru (only used if password is set) #LOG_SQL: 0 (1 for verbose SQL logs) volumes: - "${MOUNT_DATA}:/data" - "./server/config.yaml:/opt/app/config.yaml" + client: image: szurubooru/client:latest depends_on: @@ -42,6 +36,7 @@ services: - "${MOUNT_DATA}:/data:ro" ports: - "${PORT}:80" + sql: image: postgres:11-alpine restart: unless-stopped @@ -50,20 +45,3 @@ services: POSTGRES_PASSWORD: volumes: - "${MOUNT_SQL}:/var/lib/postgresql/data" - elasticsearch: - image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.3.1 - environment: - ## Specifies the Java heap size used - ## Read - ## https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html - ## for more info - ES_JAVA_OPTS: -Xms512m -Xmx512m - volumes: - - index:/usr/share/elasticsearch/data - ulimits: - nofile: - soft: 65536 - hard: 65536 - -volumes: - index: # Scratch space for ElasticSearch index, will be rebuilt if lost diff --git a/server/Dockerfile b/server/Dockerfile index 38c1dfce..5406a848 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -21,8 +21,6 @@ RUN \ pip3 install --no-cache-dir --disable-pip-version-check \ alembic \ "coloredlogs==5.0" \ - "elasticsearch>=5.0.0,<7.0.0" \ - "elasticsearch-dsl>=5.0.0,<7.0.0" \ && exit 0 ARG PUID=1000 diff --git a/server/config.yaml.dist b/server/config.yaml.dist index 47fd89a8..3ff3052a 100644 --- a/server/config.yaml.dist +++ b/server/config.yaml.dist @@ -144,9 +144,3 @@ privileges: ## usage: schema://user:password@host:port/database_name ## example: postgres://szuru:dog@localhost:5432/szuru_test #database: -#elasticsearch: # used for reverse image search -# host: localhost -# port: 9200 -# index: szurubooru -# user: szurubooru -# pass: diff --git a/server/hooks/test b/server/hooks/test index 5f642f1a..9cbb16b9 100755 --- a/server/hooks/test +++ b/server/hooks/test @@ -23,8 +23,7 @@ RUN apk --no-cache add \ USER app ENV POSTGRES_HOST=x \ POSTGRES_USER=x \ - POSTGRES_PASSWORD=x \ - ESEARCH_HOST=x + POSTGRES_PASSWORD=x CMD ["pytest", "szurubooru/", \ "--cov-report=term-missing", "--cov=szurubooru", "--tb=short"] EOF diff --git a/server/requirements.txt b/server/requirements.txt index 5bf22f4f..810452e0 100644 --- a/server/requirements.txt +++ b/server/requirements.txt @@ -3,8 +3,6 @@ pyyaml>=3.11 psycopg2-binary>=2.6.1 SQLAlchemy>=1.0.12 coloredlogs==5.0 -elasticsearch>=5.0.0,<7.0.0 -elasticsearch-dsl>=5.0.0,<7.0.0 certifi>=2017.11.5 numpy>=1.8.2 pillow>=4.3.0 diff --git a/server/szurubooru/config.py b/server/szurubooru/config.py index ee24d487..e9962a70 100644 --- a/server/szurubooru/config.py +++ b/server/szurubooru/config.py @@ -21,12 +21,7 @@ def _merge(left: Dict, right: Dict) -> Dict: def _docker_config() -> Dict: - for key in [ - 'POSTGRES_USER', - 'POSTGRES_PASSWORD', - 'POSTGRES_HOST', - 'ESEARCH_HOST' - ]: + for key in ['POSTGRES_USER', 'POSTGRES_PASSWORD', 'POSTGRES_HOST']: if not os.getenv(key, False): raise errors.ConfigError(f'Environment variable "{key}" not set') return { @@ -40,13 +35,6 @@ def _docker_config() -> Dict: 'host': os.getenv('POSTGRES_HOST'), 'port': int(os.getenv('POSTGRES_PORT', 5432)), 'db': os.getenv('POSTGRES_DB', os.getenv('POSTGRES_USER')) - }, - 'elasticsearch': { - 'host': os.getenv('ESEARCH_HOST'), - 'port': int(os.getenv('ESEARCH_PORT', 9200)), - 'index': os.getenv('ESEARCH_INDEX', 'szurubooru'), - 'user': os.getenv('ESEARCH_USER', os.getenv('ESEARCH_INDEX', 'szurubooru')), - 'pass': os.getenv('ESEARCH_PASSWORD', False) } } diff --git a/server/szurubooru/facade.py b/server/szurubooru/facade.py index ee069867..7cac63ca 100644 --- a/server/szurubooru/facade.py +++ b/server/szurubooru/facade.py @@ -120,7 +120,6 @@ def create_app() -> Callable[[Any, Any], Any]: ''' Create a WSGI compatible App object. ''' validate_config() coloredlogs.install(fmt='[%(asctime)-15s] %(name)s %(message)s') - logging.getLogger('elasticsearch').disabled = True if config.config['debug']: logging.getLogger('szurubooru').setLevel(logging.INFO) if config.config['show_sql']: