update docker and entrypoints

This commit is contained in:
Jack Robison 2022-05-18 13:09:42 -04:00
parent 30e295ec28
commit 37fc334c46
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2
9 changed files with 16 additions and 23 deletions

View file

@ -28,19 +28,19 @@ RUN groupadd -g 999 $user && useradd -m -u 999 -g $user $user
RUN mkdir -p $db_dir RUN mkdir -p $db_dir
RUN chown -R $user:$user $db_dir RUN chown -R $user:$user $db_dir
COPY . $projects_dir COPY docker $projects_dir
RUN chown -R $user:$user $projects_dir RUN chown -R $user:$user $projects_dir
USER $user USER $user
WORKDIR $projects_dir WORKDIR $projects_dir
RUN python3.9 -m pip install pip RUN python3.9 -m pip install pip
RUN python3.9 -m pip install -e . RUN python3.9 -m pip install -e .
RUN python3.9 docker/set_build.py RUN python3.9 scripts/set_build.py
RUN rm ~/.cache -rf RUN rm ~/.cache -rf
# entry point # entry point
VOLUME $db_dir VOLUME $db_dir
ENV DB_DIRECTORY=$db_dir ENV DB_DIRECTORY=$db_dir
COPY ./docker/scribe_entrypoint.sh /entrypoint.sh COPY ./scripts/entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]

View file

@ -55,8 +55,8 @@ services:
volumes: volumes:
- "lbry_rocksdb:/database" - "lbry_rocksdb:/database"
environment: environment:
- HUB_COMMAND=scribe-hub - HUB_COMMAND=herald
command: # for full options, see `scribe-hub --help` command: # for full options, see `herald --help`
- "--daemon_url=http://lbry:lbry@127.0.0.1:9245" - "--daemon_url=http://lbry:lbry@127.0.0.1:9245"
- "--max_query_workers=4" - "--max_query_workers=4"
- "--host=0.0.0.0" - "--host=0.0.0.0"

View file

@ -1,7 +0,0 @@
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
cd "$DIR/../.." ## make sure we're in the right place. Docker Hub screws this up sometimes
echo "docker build dir: $(pwd)"
docker build --build-arg DOCKER_TAG=$DOCKER_TAG --build-arg DOCKER_COMMIT=$SOURCE_COMMIT -f $DOCKERFILE_PATH -t $IMAGE_NAME .

View file

@ -34,7 +34,7 @@ services:
- "--max_query_workers=2" - "--max_query_workers=2"
- "--filtering_channel_ids=770bd7ecba84fd2f7607fb15aedd2b172c2e153f 95e5db68a3101df19763f3a5182e4b12ba393ee8" - "--filtering_channel_ids=770bd7ecba84fd2f7607fb15aedd2b172c2e153f 95e5db68a3101df19763f3a5182e4b12ba393ee8"
- "--blocking_channel_ids=dd687b357950f6f271999971f43c785e8067c3a9 06871aa438032244202840ec59a469b303257cad b4a2528f436eca1bf3bf3e10ff3f98c57bd6c4c6" - "--blocking_channel_ids=dd687b357950f6f271999971f43c785e8067c3a9 06871aa438032244202840ec59a469b303257cad b4a2528f436eca1bf3bf3e10ff3f98c57bd6c4c6"
scribe_hub: herald:
depends_on: depends_on:
- scribe_elastic_sync - scribe_elastic_sync
- scribe - scribe
@ -47,7 +47,7 @@ services:
volumes: volumes:
- "lbry_rocksdb:/database" - "lbry_rocksdb:/database"
environment: environment:
- HUB_COMMAND=scribe-hub - HUB_COMMAND=herald
command: command:
- "--daemon_url=http://lbry:lbry@127.0.0.1:9245" - "--daemon_url=http://lbry:lbry@127.0.0.1:9245"
- "--elastic_host=127.0.0.1" - "--elastic_host=127.0.0.1"

View file

@ -9,13 +9,13 @@ from hub.herald.service import HubServerService
def main(): def main():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
prog='scribe-hub' prog='herald'
) )
ServerEnv.contribute_to_arg_parser(parser) ServerEnv.contribute_to_arg_parser(parser)
args = parser.parse_args() args = parser.parse_args()
try: try:
env = ServerEnv.from_arg_parser(args) env = ServerEnv.from_arg_parser(args)
setup_logging(os.path.join(env.db_dir, 'scribe-hub.log')) setup_logging(os.path.join(env.db_dir, 'herald.log'))
server = HubServerService(env) server = HubServerService(env)
server.run() server.run()
except Exception: except Exception:

View file

@ -7,7 +7,7 @@ SCRIPTS_DIR=`dirname $0`
SCRIBE_DIR=`dirname $SCRIPTS_DIR` SCRIBE_DIR=`dirname $SCRIPTS_DIR`
# build the image # build the image
docker build -f $SCRIBE_DIR/docker/Dockerfile -t lbry/scribe:development $SCRIBE_DIR docker build -f $SCRIBE_DIR/Dockerfile -t lbry/scribe:development $SCRIBE_DIR
IMAGE=`docker image inspect lbry/scribe:development | sed -n "s/^.*Id\":\s*\"sha256:\s*\(\S*\)\".*$/\1/p"` IMAGE=`docker image inspect lbry/scribe:development | sed -n "s/^.*Id\":\s*\"sha256:\s*\(\S*\)\".*$/\1/p"`
# push the image to the server # push the image to the server

View file

@ -5,13 +5,13 @@
set -euo pipefail set -euo pipefail
if [ -z "$HUB_COMMAND" ]; then if [ -z "$HUB_COMMAND" ]; then
echo "HUB_COMMAND env variable must be scribe, scribe-hub, or scribe-elastic-sync" echo "HUB_COMMAND env variable must be scribe, herald, or scribe-elastic-sync"
exit 1 exit 1
fi fi
case "$HUB_COMMAND" in case "$HUB_COMMAND" in
scribe ) exec /home/lbry/.local/bin/scribe "$@" ;; scribe ) exec /home/lbry/.local/bin/scribe "$@" ;;
scribe-hub ) exec /home/lbry/.local/bin/scribe-hub "$@" ;; scribe-hub ) exec /home/lbry/.local/bin/herald "$@" ;;
scribe-elastic-sync ) exec /home/lbry/.local/bin/scribe-elastic-sync "$@" ;; scribe-elastic-sync ) exec /home/lbry/.local/bin/scribe-elastic-sync "$@" ;;
* ) "HUB_COMMAND env variable must be scribe, scribe-hub, or scribe-elastic-sync" && exit 1 ;; * ) "HUB_COMMAND env variable must be scribe, herald, or scribe-elastic-sync" && exit 1 ;;
esac esac

View file

@ -23,9 +23,9 @@ setup(
zip_safe=False, zip_safe=False,
entry_points={ entry_points={
'console_scripts': [ 'console_scripts': [
'scribe=scribe.blockchain.__main__:main', 'scribe=hub.scribe.__main__:main',
'scribe-hub=scribe.hub.__main__:main', 'herald=hub.herald.__main__:main',
'scribe-elastic-sync=scribe.elasticsearch.__main__:main', 'scribe-elastic-sync=hub.elastic_sync.__main__:main',
], ],
}, },
install_requires=[ install_requires=[