Compare commits
5 Commits
85f19e6832
...
f9954e3b52
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f9954e3b52 | ||
|
|
187986d1a3 | ||
|
|
0312ffdf98 | ||
|
|
8e6a189e42 | ||
|
|
000bf3f594 |
@@ -37,7 +37,7 @@ opensem:
|
||||
paybox-system:
|
||||
paybox:
|
||||
test: true
|
||||
rank: 1 ## no need for zeroes before !
|
||||
rank: "001" ## keep the double-quotes !
|
||||
site: 2XXXX9
|
||||
id: 2XXXXX4
|
||||
hmac-key: "FFAXXXXX...XXXXX"
|
||||
|
||||
@@ -22,8 +22,6 @@ hmac_key=$(relation-get hmac-key) || {
|
||||
exit 1
|
||||
}
|
||||
|
||||
rank=$(printf "%03d" "$rank")
|
||||
|
||||
[ -n "$test" ] && opensem:config-set PAYBOX_TEST "$test"
|
||||
opensem:config-set PAYBOX_SITE "$site"
|
||||
opensem:config-set PAYBOX_RANK "$rank"
|
||||
@@ -42,7 +40,7 @@ if ! [ -f "$paybox_pubkey_path" ]; then
|
||||
fi
|
||||
|
||||
## and create the mount point also:
|
||||
paybox_mount_dir="$SERVICE_CONFIGSTORE/opt/apps/opensem/storage/paybox"
|
||||
paybox_mount_dir="$SERVICE_CONFIGSTORE/opt/apps/$SERVICE_NAME/storage/paybox"
|
||||
if ! [ -d "$paybox_mount_dir" ]; then
|
||||
mkdir -p "$paybox_mount_dir" || {
|
||||
err "Could not create directory $paybox_mount_dir"
|
||||
|
||||
@@ -1,66 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
. lib/common
|
||||
|
||||
set -e
|
||||
|
||||
uid_gid=$(get_service_base_image_dir_uid_gid "$MASTER_TARGET_SERVICE_NAME" /var/www/html) || {
|
||||
err "Could not determine uid:gid for $MASTER_TARGET_SERVICE_NAME of dir /var/www/html"
|
||||
exit 1
|
||||
}
|
||||
gid="${uid_gid#* }"
|
||||
|
||||
dirs=(
|
||||
/var/cache/opensem/bootstrap
|
||||
/var/cache/opensem/framework
|
||||
/var/cache/opensem/views
|
||||
/var/lib/opensem/sessions
|
||||
/var/lib/opensem/app
|
||||
/var/lib/opensem/app/public
|
||||
/var/log/opensem
|
||||
)
|
||||
|
||||
|
||||
to_create=()
|
||||
volumes=""
|
||||
for d in "${dirs[@]}"; do
|
||||
fdir="${SERVICE_DATASTORE}$d"
|
||||
if [ -d "$fdir" ]; then
|
||||
find "$fdir" \! -gid "$gid" -print0 | while read-0 f; do
|
||||
chgrp -v "$gid" "$f" || return 1
|
||||
done
|
||||
find "$fdir" \! -perm -g+rwx -print0 | while read-0 f; do
|
||||
chmod -v g+rwx "$f" || return 1
|
||||
done
|
||||
else
|
||||
to_create+=("$fdir")
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "${#to_create[@]}" -gt 0 ]; then
|
||||
mkdir -p "${to_create[@]}" || return 1
|
||||
chgrp -v "${gid}" "${to_create[@]}" || return 1
|
||||
chmod g+rwx "${to_create[@]}" || return 1
|
||||
fi
|
||||
|
||||
dev=$(options-get dev 2>/dev/null) || true
|
||||
if [ -n "$dev" ]; then
|
||||
# if ! [ -d "$dev" ]; then
|
||||
# err "The 'dev' option is set to '$dev' but this is not a directory."
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
OPENSEM_CODE="$dev"
|
||||
fi
|
||||
|
||||
service:docker-compose:directive-merge "$MASTER_TARGET_SERVICE_NAME" <<EOF
|
||||
volumes:
|
||||
- $OPENSEM_CODE:/opt/apps/$SERVICE_NAME:ro
|
||||
- $SERVICE_DATASTORE/var/cache/opensem/bootstrap:/opt/apps/$SERVICE_NAME/bootstrap/cache:rw
|
||||
- $SERVICE_DATASTORE/var/cache/opensem/framework:/opt/apps/$SERVICE_NAME/storage/framework/cache:rw
|
||||
- $SERVICE_DATASTORE/var/cache/opensem/views:/opt/apps/$SERVICE_NAME/storage/framework/views:rw
|
||||
- $SERVICE_DATASTORE/var/lib/opensem/sessions:/opt/apps/$SERVICE_NAME/storage/framework/sessions:rw
|
||||
## Required to give PHP write access to this dir
|
||||
- $SERVICE_DATASTORE/var/lib/opensem/app:/opt/apps/$SERVICE_NAME/storage/app:rw
|
||||
- $SERVICE_DATASTORE/var/lib/opensem/app/public:/opt/apps/$SERVICE_NAME/storage/app/public:rw
|
||||
EOF
|
||||
@@ -9,9 +9,80 @@ url=$(relation-get url) || exit 1
|
||||
|
||||
location=$CONFIGSTORE/$BASE_SERVICE_NAME/var/www/$domain
|
||||
|
||||
php_fpm_service=$(service:traverse "$SERVICE_NAME":php-fpm) || {
|
||||
err "Could not find php-fpm service for $SERVICE_NAME"
|
||||
exit 1
|
||||
}
|
||||
|
||||
uid_gid=$(get_service_base_image_dir_uid_gid "$php_fpm_service" /var/www/html) || {
|
||||
err "Could not determine uid:gid for $php_fpm_service of dir /var/www/html"
|
||||
exit 1
|
||||
}
|
||||
gid="${uid_gid#* }"
|
||||
|
||||
dirs=(
|
||||
/var/cache/opensem/bootstrap
|
||||
/var/cache/opensem/framework
|
||||
/var/cache/opensem/views
|
||||
/var/lib/opensem/sessions
|
||||
/var/lib/opensem/app
|
||||
/var/lib/opensem/app/public
|
||||
/var/log/opensem
|
||||
)
|
||||
|
||||
|
||||
to_create=()
|
||||
volumes=""
|
||||
for d in "${dirs[@]}"; do
|
||||
fdir="${SERVICE_DATASTORE}$d"
|
||||
if [ -d "$fdir" ]; then
|
||||
find "$fdir" \! -gid "$gid" -print0 | while read-0 f; do
|
||||
chgrp -v "$gid" "$f" || return 1
|
||||
done
|
||||
find "$fdir" \! -perm -g+rwx -print0 | while read-0 f; do
|
||||
chmod -v g+rwx "$f" || return 1
|
||||
done
|
||||
else
|
||||
to_create+=("$fdir")
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "${#to_create[@]}" -gt 0 ]; then
|
||||
mkdir -p "${to_create[@]}" || return 1
|
||||
chgrp -v "${gid}" "${to_create[@]}" || return 1
|
||||
chmod g+rwx "${to_create[@]}" || return 1
|
||||
fi
|
||||
|
||||
opensem:config-set APP_URL "$url"
|
||||
|
||||
dev=$(options-get dev 2>/dev/null) || true
|
||||
if [ -n "$dev" ]; then
|
||||
# if ! [ -d "$dev" ]; then
|
||||
# err "The 'dev' option is set to '$dev' but this is not a directory."
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
OPENSEM_CODE="$dev"
|
||||
fi
|
||||
|
||||
|
||||
service:docker-compose:directive-merge "$MASTER_TARGET_SERVICE_NAME" <<EOF
|
||||
volumes:
|
||||
- $SERVICE_DATASTORE/var/lib/opensem/app/public:/var/www/$domain/storage:ro
|
||||
EOF
|
||||
|
||||
config-add "
|
||||
services:
|
||||
$php_fpm_service:
|
||||
volumes:
|
||||
# - $OPENSEM_CODE/public:/var/www/$domain:ro
|
||||
- $OPENSEM_CODE:/opt/apps/$SERVICE_NAME:ro
|
||||
- $SERVICE_DATASTORE/var/cache/opensem/bootstrap:/opt/apps/$SERVICE_NAME/bootstrap/cache:rw
|
||||
- $SERVICE_DATASTORE/var/cache/opensem/framework:/opt/apps/$SERVICE_NAME/storage/framework/cache:rw
|
||||
- $SERVICE_DATASTORE/var/cache/opensem/views:/opt/apps/$SERVICE_NAME/storage/framework/views:rw
|
||||
- $SERVICE_DATASTORE/var/lib/opensem/sessions:/opt/apps/$SERVICE_NAME/storage/framework/sessions:rw
|
||||
## Required to give PHP write access to this dir
|
||||
- $SERVICE_DATASTORE/var/lib/opensem/app:/opt/apps/$SERVICE_NAME/storage/app:rw
|
||||
- $SERVICE_DATASTORE/var/lib/opensem/app/public:/opt/apps/$SERVICE_NAME/storage/app/public:rw
|
||||
|
||||
"
|
||||
|
||||
@@ -111,12 +111,16 @@ artisan() {
|
||||
export COMPOSE_IGNORE_ORPHANS=true
|
||||
|
||||
php_fpm_service=$(service:traverse "$SERVICE_NAME":php-fpm) || return 1
|
||||
launch_docker_compose run \
|
||||
## We don't want post deploy that is doing the final http initialization.
|
||||
compose --debug -q --no-init --no-post-deploy --no-pre-deploy \
|
||||
--without-relation="$SERVICE_NAME":publish-dir \
|
||||
run \
|
||||
"${artisan_docker_run_opts[@]}" \
|
||||
-T --rm -w /opt/apps/"$SERVICE_NAME" \
|
||||
--entrypoint php \
|
||||
-u www-data "$php_fpm_service" artisan "$@"
|
||||
-u www-data "$php_fpm_service" artisan "$@" | cat
|
||||
|
||||
return "$?"
|
||||
return "${PIPESTATUS[0]}"
|
||||
}
|
||||
|
||||
dotenv:quote() {
|
||||
|
||||
Reference in New Issue
Block a user