You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

116 lines
3.5 KiB

# -*- mode: shell-script -*-
GOGOCARTO_DIR="/opt/apps/gogocarto"
GOGOCARTO_CODE="$SERVICE_CONFIGSTORE$GOGOCARTO_DIR"
GOGOCARTO_RELEASE=3.1.3-56-g6b8ba361
GOGOCARTO_URL=https://docker.0k.io/downloads/gogocarto-"${GOGOCARTO_RELEASE}".tar.bz2
gogocarto:init() {
current_version=""
if [ -d "${GOGOCARTO_CODE}" ]; then
current_version=$(cat "${GOGOCARTO_CODE}"/.version) || {
err "Couldn't find ${GOGOCARTO_CODE}/.version file."
echo " Your config dir is in a broken state." >&2
return 1
}
else
mkdir -p "${GOGOCARTO_CODE}" &&
cd "${GOGOCARTO_CODE}" &&
git init . &&
git config user.email "root@localhost" &&
git config user.name "Root" || {
err "Couldn't create directory ${GOGOCARTO_CODE}, or init it with git."
return 1
}
fi
if [ "$current_version" != "$GOGOCARTO_RELEASE" ]; then
cd "${GOGOCARTO_CODE}" || return 1
if [ -d "$PWD"/.git ]; then
rm -rf "$PWD"/* "$PWD"/{.version,.inited-*,.env} || return 1
else
err "Can't find the '.git' directory in ${GOGOCARTO_CODE}."
return 1
fi
curl -L "$GOGOCARTO_URL" | tar xj || {
err "Couldn't download $GOGOCARTO_URL."
return 1
}
echo "$GOGOCARTO_RELEASE" > .version
git add -A . &&
git commit -m "Release $GOGOCARTO_RELEASE"
fi
}
gogocarto:config() {
APP_ENV=$(options-get app-env 2>/dev/null) || true
APP_ENV=${APP_ENV:-prod}
cat <<EOF > "${GOGOCARTO_CODE}"/.env
###> symfony/framework-bundle ###
APP_ENV=${APP_ENV}
APP_SECRET=82ec369b81caab5446ddfc3b5edb4d00
CSRF_PROTECTION=$(
[ "$APP_ENV" == "prod" ] &&
echo "true" ||
echo "false") ## active csrf protection on production servers
#TRUSTED_PROXIES=127.0.0.0/8,10.0.0.0/8,172.16.0.0/12,192.168.0.0/16
#TRUSTED_HOSTS='^localhost|example\.com$'
###< symfony/framework-bundle ###
###> vich upload ###
IMAGES_MAX_FILESIZE=8M # for public images upload
IMAGE_RESIZE_WIDTH=1000 # in pixel
FILES_MAX_FILESIZE=1M # for other public file upload
###> vich upload ###
USE_AS_SAAS=false
CONTACT_EMAIL=contact@localhost.fr
INSTANCE_NAME=GoGoCarto
###> symfony/swiftmailer-bundle ###
# For Gmail as a transport, use: "gmail://username:password@localhost"
# For a generic SMTP server, use: "smtp://localhost:25?encryption=&auth_mode="
# Delivery is disabled by default via "null://localhost"
MAILER_URL=gmail://test.gogocarto:creerdescartesagogo@localhost
FROM_EMAIL=test.gogocarto@gmail.com
###< symfony/swiftmailer-bundle ###
###> hwi/oauth-bundle ###
OAUTH_COMMUNS_ID=disabled
OAUTH_COMMUNS_SECRET=disabled
OAUTH_GOOGLE_ID=disabled
OAUTH_GOOGLE_SECRET=disabled
OAUTH_FACEBOOK_ID=disabled
OAUTH_FACEBOOK_SECRET=disabled
###< hwi/oauth-bundle ###
###> sentry/sentry-symfony ###
# Log errors nicely with sentry. Create your account on sentry.io and provide the DSN here
# exple: SENTRY_DSN=https://6145d1aac36c429781fc1b0f79b0da48@sentry.io/1402018
SENTRY_DSN=
###< sentry/sentry-symfony ###
EOF
}
symphony() {
export COMPOSE_IGNORE_ORPHANS=true
## We don't want post deploy that is doing the final http initialization.
compose --debug -q --no-init --no-post-deploy \
--without-relation="$SERVICE_NAME":web-proxy \
run \
"${symphony_docker_run_opts[@]}" \
-T --rm -w /opt/apps/gogocarto \
--entrypoint php \
-u www-data "$SERVICE_NAME" bin/console "$@" | cat
return "${PIPESTATUS[0]}"
}