1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- #!/bin/sh
- git_dir=$PWD
- while [ ! -d .git ]; do
- git_dir=$(dirname "${git_dir}")
- done
- cd "${git_dir}" || exit
- if [ -e ./docker/bootstrap/bootstrap.env ]; then
- . ./docker/bootstrap/bootstrap.env
- fi
- # TODO Add configuration
- cp docker-compose.yaml.in docker-compose.yaml
- while :; do
- printf "DBMS (postgres|mariadb): " && read -r dbms
- echo "${dbms}" | grep -Eq 'postgres|mariadb' && break
- done
- while :; do
- printf "Social database name: " && read -r db
- echo "${db}" | grep -vEq 'postgres' && break
- done
- [ "${dbms}" = 'mariadb' ] && printf "Database user: " && read -r user
- printf "Database password: " && read -r password
- printf "Sitename: " && read -r sitename
- printf "Admin nickname: " && read -r admin_nick
- printf "Admin password: " && read -r admin_password
- while :; do
- printf "Site profile (public|private|community|single_user): " && read -r profile
- echo "${profile}" | grep -Eq 'public|private|community|single_user' && break
- done
- mkdir -p ./docker/db
- if [ "${dbms}" = 'mariadb' ]; then
- printf "DB root password: " && read -r db_root_password
- cat > ./docker/db/db.env <<EOF
- DBMS=${dbms}
- MYSQL_ROOT_PASSWORD=${db_root_password}
- EOF
- database_url="DATABASE_URL=mysql://${user}:${password}@db:3306/${db}"
- else
- cat > ./docker/db/db.env <<EOF
- DBMS=${dbms}
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=${password}
- EOF
- user='postgres'
- database_url="DATABASE_URL=postgresql://${user}:${password}@db:5432/${db}"
- fi
- echo "${database_url}" > .env.local
- mkdir -p ./docker/social
- cat > ./docker/social/social.env <<EOF
- SOCIAL_DBMS=${dbms}
- SOCIAL_DB=${db}
- SOCIAL_USER=${user}
- SOCIAL_PASSWORD=${password}
- SOCIAL_DOMAIN=${domain}
- SOCIAL_SITENAME=${sitename}
- SOCIAL_ADMIN_NICK=${admin_nick}
- SOCIAL_ADMIN_PASSWORD=${admin_password}
- SOCIAL_ADMIN_EMAIL=${email}
- SOCIAL_SITE_PROFILE=${profile}
- EOF
|