docker-compose environment for the entire v.st system
https://v.st/
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.
62 lines
1.5 KiB
62 lines
1.5 KiB
#!/bin/bash
|
|
die() { echo >&2 "mobilizon: $@" ; exit 1 ; }
|
|
|
|
DIRNAME="$(dirname $0)"
|
|
cd "$DIRNAME"
|
|
source ../env.production || die "no top level env?"
|
|
source env.production || die "no local env?"
|
|
source ../env.smtp 2>/dev/null
|
|
|
|
DATA="../data/mobilizon"
|
|
SECRETS="$DATA/env.secrets"
|
|
|
|
if [ -r "$SECRETS" ]; then
|
|
docker-compose up -d || die "unable to start"
|
|
exit 0
|
|
fi
|
|
|
|
docker-compose down 2>/dev/null
|
|
|
|
CLIENT_SECRET="$(openssl rand -hex 20)"
|
|
|
|
mkdir -p "$DATA/uploads"
|
|
chmod 777 "$DATA/uploads"
|
|
|
|
mkdir -p "$(dirname "$SECRETS")"
|
|
cat <<EOF > "$SECRETS"
|
|
# DO NOT CHECK IN
|
|
MOBILIZON_INSTANCE_NAME=${DOMAIN_NAME}
|
|
MOBILIZON_INSTANCE_HOST=${MOBILIZON_HOSTNAME}
|
|
MOBILIZON_INSTANCE_SECRET_KEY_BASE=$(openssl rand -hex 20)
|
|
MOBILIZON_INSTANCE_SECRET_KEY=$(openssl rand -hex 20)
|
|
MOBILIZON_CLIENT_SECRET=${CLIENT_SECRET}
|
|
EOF
|
|
|
|
if [ -n "$SMTP_SERVER" ]; then
|
|
cat <<EOF >> "$SECRETS"
|
|
MOBILIZON_INSTANCE_EMAIL=events@${DOMAIN_NAME}
|
|
MOBILIZON_REPLY_EMAIL=noreply@${DOMAIN_NAME}
|
|
MOBILIZON_SMTP_SERVER=${SMTP_SERVER}
|
|
MOBILIZON_SMTP_PORT=${SMTP_PORT}
|
|
MOBILIZON_SMTP_USERNAME=${SMTP_USER}
|
|
MOBILIZON_SMTP_PASSWORD=${SMTP_PASSWORD}
|
|
EOF
|
|
fi
|
|
|
|
../keycloak/client-delete mobilizon
|
|
|
|
../keycloak/client-create <<EOF || die "unable to create client"
|
|
{
|
|
"clientId": "mobilizon",
|
|
"rootUrl": "https://$MOBILIZON_HOSTNAME",
|
|
"adminUrl": "https://$MOBILIZON_HOSTNAME",
|
|
"redirectUris": [ "https://$MOBILIZON_HOSTNAME/*" ],
|
|
"webOrigins": [ "https://$MOBILIZON_HOSTNAME" ],
|
|
"clientAuthenticatorType": "client-secret",
|
|
"secret": "$CLIENT_SECRET"
|
|
}
|
|
EOF
|
|
|
|
docker-compose up -d || die "unable to start container"
|
|
|
|
|
|
|