PHRAS-3980 cmd container (#4440)

PHRAS-3980 cmd container for docker compose ready
This commit is contained in:
Nicolas Maillat
2023-12-13 12:27:32 +01:00
committed by GitHub
parent b4536308df
commit 0b9a3e01d6
5 changed files with 63 additions and 17 deletions

13
.env
View File

@@ -44,8 +44,9 @@
# - "gateway-traefik" : nginx is launched behind a traefik service, the traefik is include in this stack (todo) # - "gateway-traefik" : nginx is launched behind a traefik service, the traefik is include in this stack (todo)
# or Traefik include in Phrasea Stack. # or Traefik include in Phrasea Stack.
# - "workers" : launch one worker container by kind of Jobs, you can also # - "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. # - "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 # - "db" : launch a mariadb container, because this is the primary
# datastore for production usage, use your own service. # datastore for production usage, use your own service.
# - "elastisearch" : launch a elasticsearch container. # - "elastisearch" : launch a elasticsearch container.
@@ -89,11 +90,11 @@
# #
# For development: # For development:
# - COMPOSE_FILE=docker-compose.yml:docker-compose.datastores.yml:docker-compose.tools.yml:docker-compose.override.yml # - 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: # For testing with tools:
# - COMPOSE_FILE=docker-compose.yml:docker-compose.datastores.yml:docker-compose.tools.yml # - 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): # 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 # - 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_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, # - 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, # 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 # @run
PHRASEANET_WORKER_shareBasket=1 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 -------------------------------------------------------------------------------------- # --- Phraseanet Locales settings --------------------------------------------------------------------------------------

View File

@@ -189,6 +189,13 @@ services:
- internal - internal
scheduler: scheduler:
volumes:
- ../:/var/alchemy
- .:/var/alchemy/Phraseanet
networks:
- internal
cmd:
volumes: volumes:
- ../:/var/alchemy - ../:/var/alchemy
- .:/var/alchemy/Phraseanet - .:/var/alchemy/Phraseanet

View File

@@ -302,7 +302,6 @@ services:
- LC_NAME=C.UTF-8 - LC_NAME=C.UTF-8
- PHRASEANET_EXPLODE_WORKER - PHRASEANET_EXPLODE_WORKER
- PHRASEANET_WORKERS_LAUNCH_METHOD - PHRASEANET_WORKERS_LAUNCH_METHOD
- PHRASEANET_WORKER_CUSTOM
- PHRASEANET_WORKER_assetsIngest - PHRASEANET_WORKER_assetsIngest
- PHRASEANET_WORKER_createRecord - PHRASEANET_WORKER_createRecord
- PHRASEANET_WORKER_deleteRecord - PHRASEANET_WORKER_deleteRecord
@@ -1314,6 +1313,49 @@ services:
- ${PHRASEANET_TMP_DIR}:/var/alchemy/Phraseanet/tmp:rw - ${PHRASEANET_TMP_DIR}:/var/alchemy/Phraseanet/tmp:rw
networks: networks:
- internal - 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: volumes:

View File

@@ -30,17 +30,6 @@ else
rm -f /usr/local/etc/php/conf.d/newrelic.ini rm -f /usr/local/etc/php/conf.d/newrelic.ini
fi 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 ./docker/phraseanet/plugins/console init
chown -R app:app cache chown -R app:app cache

View File

@@ -113,6 +113,11 @@ else
fi fi
done 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 " workers defined"
echo $NBR_WORKERS > bin/workers_count.txt echo $NBR_WORKERS > bin/workers_count.txt