all: purge remaining elasticsearch artifacts

This commit is contained in:
Shyam Sunder 2020-03-07 22:17:51 -05:00
parent 6cc2a91632
commit 1a8de9ef3a
8 changed files with 27 additions and 87 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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:

View file

@ -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

View file

@ -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

View file

@ -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)
}
}

View file

@ -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']: