mirror of
https://github.com/frappe/frappe_docker.git
synced 2024-11-14 09:04:06 +00:00
7498d5439a
With this PR, password can be read from docker secrets in both compose as well as swarm environment. ```YAML secrets: mariadb-root-password: file: mariadb-root-password.txt erpnext-admin-password: file: erpnext-admin-password.txt services: erpnext: image: frappe/erpnext-worker:${ERPNEXT_VERSION:-v12.5.2} environment: - SITE_NAME=example.com - DB_ROOT_USER=root - MARIADB_HOST=mariadb - INSTALL_APPS=erpnext - FORCE=1 - REDIS_CACHE=redis-cache:6379 - REDIS_QUEUE=redis-queue:6379 - REDIS_SOCKETIO=redis-socketio:6379 - SOCKETIO_PORT=9000 - AUTO_MIGRATE=1 - ADMIN_PASSWORD_FILE=/run/secrets/erpnext-admin-password - MYSQL_ROOT_PASSWORD_FILE=/run/secrets/mariadb-root-password secrets: - erpnext-admin-password - mariadb-root-password restart: on-failure volumes: - erpnext-data:/home/frappe/frappe-bench/sites - assets-data:/home/frappe/frappe-bench/sites/assets links: - redis-cache - redis-queue - redis-socketio - mariadb depends_on: - mariadb - redis-cache - redis-queue - redis-socketio networks: - erpnext-net ``` Reference: [Addind docker secrets in to your images](https://docs.docker.com/engine/swarm/secrets/#build-support-for-docker-secrets-into-your-images) Changes to be committed: modified: ../../README.md modified: ../common/commands/new.py modified: ../common/commands/restore_backup.py modified: ../erpnext-nginx/docker-entrypoint.sh
48 lines
1.3 KiB
Bash
Executable File
48 lines
1.3 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
## Thanks
|
|
# https://serverfault.com/a/919212
|
|
##
|
|
|
|
set -e
|
|
|
|
rsync -a --delete /var/www/html/assets/js /assets
|
|
rsync -a --delete /var/www/html/assets/css /assets
|
|
rsync -a --delete /var/www/html/assets/frappe /assets
|
|
. /rsync
|
|
|
|
chmod -R 755 /assets
|
|
|
|
if [[ -z "$FRAPPE_PY" ]]; then
|
|
export FRAPPE_PY=0.0.0.0
|
|
fi
|
|
|
|
if [[ -z "$FRAPPE_PY_PORT" ]]; then
|
|
export FRAPPE_PY_PORT=8000
|
|
fi
|
|
|
|
if [[ -z "$FRAPPE_SOCKETIO" ]]; then
|
|
export FRAPPE_SOCKETIO=0.0.0.0
|
|
fi
|
|
|
|
if [[ -z "$SOCKETIO_PORT" ]]; then
|
|
export SOCKETIO_PORT=9000
|
|
fi
|
|
|
|
envsubst '${API_HOST}
|
|
${API_PORT}
|
|
${FRAPPE_PY}
|
|
${FRAPPE_PY_PORT}
|
|
${FRAPPE_SOCKETIO}
|
|
${SOCKETIO_PORT}' \
|
|
< /etc/nginx/conf.d/default.conf.template > /etc/nginx/conf.d/default.conf
|
|
|
|
echo "Waiting for frappe-python to be available on $FRAPPE_PY port $FRAPPE_PY_PORT"
|
|
timeout 10 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/$0/$1; do sleep 1; done' $FRAPPE_PY $FRAPPE_PY_PORT
|
|
echo "Frappe-python available on $FRAPPE_PY port $FRAPPE_PY_PORT"
|
|
echo "Waiting for frappe-socketio to be available on $FRAPPE_SOCKETIO port $SOCKETIO_PORT"
|
|
timeout 10 bash -c 'until printf "" 2>>/dev/null >>/dev/tcp/$0/$1; do sleep 1; done' $FRAPPE_SOCKETIO $SOCKETIO_PORT
|
|
echo "Frappe-socketio available on $FRAPPE_SOCKETIO port $SOCKETIO_PORT"
|
|
|
|
exec "$@"
|