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 ### 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` For first run, it is recommended to start the database separately:
parameter to at least `262144` in order for the ```console
ElasticSearch container to function. Instructions user@host:szuru$ docker-compose up -d sql
on how to do so are provided ```
[here](https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-cli-run-prod-mode).
2. Running the application To start all containers:
```console
user@host:szuru$ docker-compose up -d
```
Download containers: To view/monitor the application logs:
```console ```console
user@host:szuru$ docker-compose pull user@host:szuru$ docker-compose logs -f
``` # (CTRL+C to exit)
```
For first run, it is reccomended to start the databases seperately: To stop all containers:
```console ```console
user@host:szuru$ docker-compose up -d elasticsearch user@host:szuru$ docker-compose down
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
```
### Additional Features ### Additional Features

View file

@ -5,32 +5,26 @@
version: '2' version: '2'
services: services:
server: server:
image: szurubooru/server:latest image: szurubooru/server:latest
depends_on: depends_on:
- sql - sql
- elasticsearch
environment: 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 ## or FQDNs/IP addresses if these services are running outside of Docker
POSTGRES_HOST: sql POSTGRES_HOST: sql
ESEARCH_HOST: elasticsearch
## Credentials for database: ## Credentials for database:
POSTGRES_USER: POSTGRES_USER:
POSTGRES_PASSWORD: POSTGRES_PASSWORD:
## Commented Values are Default: ## Commented Values are Default:
#POSTGRES_DB: defaults to same as POSTGRES_USER #POSTGRES_DB: defaults to same as POSTGRES_USER
#POSTGRES_PORT: 5432 #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) #LOG_SQL: 0 (1 for verbose SQL logs)
volumes: volumes:
- "${MOUNT_DATA}:/data" - "${MOUNT_DATA}:/data"
- "./server/config.yaml:/opt/app/config.yaml" - "./server/config.yaml:/opt/app/config.yaml"
client: client:
image: szurubooru/client:latest image: szurubooru/client:latest
depends_on: depends_on:
@ -42,6 +36,7 @@ services:
- "${MOUNT_DATA}:/data:ro" - "${MOUNT_DATA}:/data:ro"
ports: ports:
- "${PORT}:80" - "${PORT}:80"
sql: sql:
image: postgres:11-alpine image: postgres:11-alpine
restart: unless-stopped restart: unless-stopped
@ -50,20 +45,3 @@ services:
POSTGRES_PASSWORD: POSTGRES_PASSWORD:
volumes: volumes:
- "${MOUNT_SQL}:/var/lib/postgresql/data" - "${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 \ pip3 install --no-cache-dir --disable-pip-version-check \
alembic \ alembic \
"coloredlogs==5.0" \ "coloredlogs==5.0" \
"elasticsearch>=5.0.0,<7.0.0" \
"elasticsearch-dsl>=5.0.0,<7.0.0" \
&& exit 0 && exit 0
ARG PUID=1000 ARG PUID=1000

View file

@ -144,9 +144,3 @@ privileges:
## usage: schema://user:password@host:port/database_name ## usage: schema://user:password@host:port/database_name
## example: postgres://szuru:dog@localhost:5432/szuru_test ## example: postgres://szuru:dog@localhost:5432/szuru_test
#database: #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 USER app
ENV POSTGRES_HOST=x \ ENV POSTGRES_HOST=x \
POSTGRES_USER=x \ POSTGRES_USER=x \
POSTGRES_PASSWORD=x \ POSTGRES_PASSWORD=x
ESEARCH_HOST=x
CMD ["pytest", "szurubooru/", \ CMD ["pytest", "szurubooru/", \
"--cov-report=term-missing", "--cov=szurubooru", "--tb=short"] "--cov-report=term-missing", "--cov=szurubooru", "--tb=short"]
EOF EOF

View file

@ -3,8 +3,6 @@ pyyaml>=3.11
psycopg2-binary>=2.6.1 psycopg2-binary>=2.6.1
SQLAlchemy>=1.0.12 SQLAlchemy>=1.0.12
coloredlogs==5.0 coloredlogs==5.0
elasticsearch>=5.0.0,<7.0.0
elasticsearch-dsl>=5.0.0,<7.0.0
certifi>=2017.11.5 certifi>=2017.11.5
numpy>=1.8.2 numpy>=1.8.2
pillow>=4.3.0 pillow>=4.3.0

View file

@ -21,12 +21,7 @@ def _merge(left: Dict, right: Dict) -> Dict:
def _docker_config() -> Dict: def _docker_config() -> Dict:
for key in [ for key in ['POSTGRES_USER', 'POSTGRES_PASSWORD', 'POSTGRES_HOST']:
'POSTGRES_USER',
'POSTGRES_PASSWORD',
'POSTGRES_HOST',
'ESEARCH_HOST'
]:
if not os.getenv(key, False): if not os.getenv(key, False):
raise errors.ConfigError(f'Environment variable "{key}" not set') raise errors.ConfigError(f'Environment variable "{key}" not set')
return { return {
@ -40,13 +35,6 @@ def _docker_config() -> Dict:
'host': os.getenv('POSTGRES_HOST'), 'host': os.getenv('POSTGRES_HOST'),
'port': int(os.getenv('POSTGRES_PORT', 5432)), 'port': int(os.getenv('POSTGRES_PORT', 5432)),
'db': os.getenv('POSTGRES_DB', os.getenv('POSTGRES_USER')) '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. ''' ''' Create a WSGI compatible App object. '''
validate_config() validate_config()
coloredlogs.install(fmt='[%(asctime)-15s] %(name)s %(message)s') coloredlogs.install(fmt='[%(asctime)-15s] %(name)s %(message)s')
logging.getLogger('elasticsearch').disabled = True
if config.config['debug']: if config.config['debug']:
logging.getLogger('szurubooru').setLevel(logging.INFO) logging.getLogger('szurubooru').setLevel(logging.INFO)
if config.config['show_sql']: if config.config['show_sql']: