diff --git a/.env b/.env index af66ef92b9..943d005343 100644 --- a/.env +++ b/.env @@ -44,8 +44,9 @@ # - "gateway-traefik" : nginx is launched behind a traefik service, the traefik is include in this stack (todo) # or Traefik include in Phrasea Stack. # - "workers" : launch one worker container by kind of Jobs, you can also -# choose to launch only some workers, see worker list below. +# choose to launch only some workers, see worker profile list below. # - "worker" : launch one container worker with all jobs run on it. +# - "cmd" : launch a container based on worker image, useful for run cmd manualy. # - "db" : launch a mariadb container, because this is the primary # datastore for production usage, use your own service. # - "elastisearch" : launch a elasticsearch container. @@ -89,11 +90,11 @@ # # For development: # - COMPOSE_FILE=docker-compose.yml:docker-compose.datastores.yml:docker-compose.tools.yml:docker-compose.override.yml -# - COMPOSE_PROFILES=app,setup,db,pma,elasticsearch,redis,redis-session,rabbitmq,workers,mailhog,builder,gateway-classic +# - COMPOSE_PROFILES=app,setup,db,pma,elasticsearch,redis,redis-session,rabbitmq,workers,mailhog,builder,gateway-classic,cmd # # For testing with tools: # - COMPOSE_FILE=docker-compose.yml:docker-compose.datastores.yml:docker-compose.tools.yml -# - COMPOSE_PROFILES=app,setup,db,pma,elasticsearch,rabbitmq,redis,redis-session,worker,workers,mailhog,gateway-classic +# - COMPOSE_PROFILES=app,setup,db,pma,elasticsearch,rabbitmq,redis,redis-session,workers,cmd,mailhog,gateway-classic # # For testing with debug and SSL (the traekik is provide by Phrasea stack): # - COMPOSE_FILE=docker-compose.yml:docker-compose.datastores.yml:docker-compose.tools.yml:docker-compose.under-phrasea.yml @@ -107,7 +108,7 @@ # - COMPOSE_FILE=docker-compose.yml:docker-compose.datastores.yml:docker-compose.tools.yml # - COMPOSE_PROFILES=app,setup,gateway-classic,db,elasticsearch,redis,redis-session,rabbitmq,pma,mailhog,assetsInjest,createRecord,deleteRecord,editRecord, # exportMail,downloadAsync,exposeUpload,exportFtp,mainQueue,populateIndex,pullAssets,recordsActions,subdefCreation, -# validationReminder,webhook,writeMetadatas,shareBasket,scheduler,elk,db-backup,phraseanet-saml-sp +# validationReminder,webhook,writeMetadatas,shareBasket,scheduler,cmd,elk,db-backup,phraseanet-saml-sp # @@ -772,7 +773,9 @@ PHRASEANET_WORKER_writeMetadatas=1 # @run PHRASEANET_WORKER_shareBasket=1 - +# PHRASEANET_CMD_MODE=1, set a worker container for run bin/console... or bin/maintenance... manualy +# @run +PHRASEANET_CMD_MODE # --- Phraseanet Locales settings -------------------------------------------------------------------------------------- diff --git a/docker-compose.override.yml b/docker-compose.override.yml index 3c7cbe351a..8ee6014401 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -189,6 +189,13 @@ services: - internal scheduler: + volumes: + - ../:/var/alchemy + - .:/var/alchemy/Phraseanet + networks: + - internal + + cmd: volumes: - ../:/var/alchemy - .:/var/alchemy/Phraseanet diff --git a/docker-compose.yml b/docker-compose.yml index b6f511b46a..ef11c4c3a8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -302,7 +302,6 @@ services: - LC_NAME=C.UTF-8 - PHRASEANET_EXPLODE_WORKER - PHRASEANET_WORKERS_LAUNCH_METHOD - - PHRASEANET_WORKER_CUSTOM - PHRASEANET_WORKER_assetsIngest - PHRASEANET_WORKER_createRecord - PHRASEANET_WORKER_deleteRecord @@ -1314,6 +1313,49 @@ services: - ${PHRASEANET_TMP_DIR}:/var/alchemy/Phraseanet/tmp:rw networks: - internal + + cmd: + build: + context: . + target: phraseanet-worker + args: + - SSH_PRIVATE_KEY=${PHRASEANET_SSH_PRIVATE_KEY} + - PHRASEANET_PLUGINS=${PHRASEANET_PLUGINS} + image: $PHRASEANET_DOCKER_REGISTRY/phraseanet-worker:$PHRASEANET_DOCKER_TAG + profiles: ["cmd"] + restart: on-failure + depends_on: + - phraseanet + environment: + - STACK_NAME + - OPCACHE_ENABLED + - SESSION_CACHE_LIMITER + - PHP_LOG_LEVEL + - PHP_CLI_MEMORY_LIMIT + - LC_MESSAGES=C.UTF-8 + - LC_COLLATE=C.UTF-8 + - LC_IDENTIFICATION=C.UTF-8 + - LANG=C.UTF-8 + - LC_MEASUREMENT=C.UTF-8 + - LC_CTYPE=C.UTF-8 + - LC_TIME=C.UTF-8 + - LC_NAME=C.UTF-8 + - PHRASEANET_CMD_MODE + - PHRASEANET_EXPLODE_WORKER + - PHRASEANET_WORKERS_LAUNCH_METHOD + - NEWRELIC_ENABLED + - NEWRELIC_LICENSE_KEY + - NEWRELIC_APP_NAME + volumes: + - ${PHRASEANET_CONFIG_DIR}:/var/alchemy/Phraseanet/config:rw + - ${PHRASEANET_LOGS_DIR}:/var/alchemy/Phraseanet/logs:rw + - ${PHRASEANET_DATA_DIR}:/var/alchemy/Phraseanet/datas:rw + - ${PHRASEANET_THUMBNAILS_DIR}:/var/alchemy/Phraseanet/www/thumbnails:rw + - ${PHRASEANET_CUSTOM_DIR}:/var/alchemy/Phraseanet/www/custom:rw + - ${PHRASEANET_CACHE_DIR}:/var/alchemy/Phraseanet/cache:rw + - ${PHRASEANET_TMP_DIR}:/var/alchemy/Phraseanet/tmp:rw + networks: + - internal volumes: diff --git a/docker/phraseanet/fpm/entrypoint.sh b/docker/phraseanet/fpm/entrypoint.sh index 6a5ab9b767..b14b8f917f 100755 --- a/docker/phraseanet/fpm/entrypoint.sh +++ b/docker/phraseanet/fpm/entrypoint.sh @@ -30,17 +30,6 @@ else rm -f /usr/local/etc/php/conf.d/newrelic.ini fi -if [[ $BLACKFIRE_ENABLED = "true" ]]; then - echo `date +"%Y-%m-%d %H:%M:%S"` " - BlackFire setup." - blackfire-agent --register --server-id=$BLACKFIRE_SERVER_ID --server-token=$BLACKFIRE_SERVER_TOKEN - service blackfire-agent start - echo "Blackfire setup done" -else - echo `date +"%Y-%m-%d %H:%M:%S"` " - blackfire extension deactivation." - rm -f /usr/local/etc/php/conf.d/zz-blackfire.ini -fi - - ./docker/phraseanet/plugins/console init chown -R app:app cache diff --git a/docker/phraseanet/worker/entrypoint.sh b/docker/phraseanet/worker/entrypoint.sh index af441aabb5..5722e3a817 100755 --- a/docker/phraseanet/worker/entrypoint.sh +++ b/docker/phraseanet/worker/entrypoint.sh @@ -113,6 +113,11 @@ else fi done + if [ ! -z "$PHRASEANET_CMD_MODE" ] && [ ${PHRASEANET_CMD_MODE} == "1" ] ; then + apt update + apt install screen + echo "Worker are in custom process mode" + fi echo $NBR_WORKERS " workers defined" echo $NBR_WORKERS > bin/workers_count.txt