forked from GNUsocial/gnu-social
[TOOLS] Update install scripts
This commit is contained in:
parent
988be9dbf1
commit
5a61098d28
2
.php_cs
2
.php_cs
@ -271,6 +271,8 @@ return PhpCsFixer\Config::create()
|
||||
->setFinder(PhpCsFixer\Finder::create()
|
||||
->exclude('vendor')
|
||||
->exclude('var')
|
||||
->exclude('docker')
|
||||
->exclude('src/Entity')
|
||||
->notPath('src/Core/DefaultSettings.php')
|
||||
->in(__DIR__)
|
||||
);
|
||||
|
@ -4,14 +4,17 @@ printf "Domain root: "
|
||||
read -r domain_root
|
||||
printf "Subdomain (can be empty): "
|
||||
read -r sub_domain
|
||||
printf "Email: "
|
||||
read -r email
|
||||
printf "Use certificate signed by Let's Encrypt (Y/n): "
|
||||
read -r signed
|
||||
printf "Use certificate signed by Let's Encrypt (Y/n): "
|
||||
|
||||
[ "${signed}" = "${signed#[Yy]}" ]
|
||||
signed=$?
|
||||
|
||||
if [ $signed ]; then
|
||||
printf "Email: "
|
||||
read -r email
|
||||
fi
|
||||
|
||||
if [ -z "$sub_domain" ]
|
||||
then
|
||||
domain="${domain_root}"
|
||||
|
43
bin/configure
vendored
43
bin/configure
vendored
@ -1,22 +1,36 @@
|
||||
#!/bin/sh
|
||||
|
||||
git_dir=$PWD
|
||||
while [ ! -d .git ]; do
|
||||
git_dir=$(dirname "${git_dir}")
|
||||
done
|
||||
|
||||
cd "${git_dir}" || exit
|
||||
|
||||
. ./docker/bootstrap/bootstrap.env
|
||||
|
||||
read -p "DBMS (postgres|mariadb): " dbms
|
||||
read -p "DB root password: " db_root_password
|
||||
read -p "Social database name: " db
|
||||
read -p "Database user: " user
|
||||
read -p "Database password: " password
|
||||
read -p "Sitename: " sitename
|
||||
read -p "Admin nickname: " admin_nick
|
||||
read -p "Admin password: " admin_password
|
||||
read -p "Site profile (public|private|community|singleuser): " profile
|
||||
|
||||
while :; do
|
||||
printf "DBMS (postgres|mariadb): " && read -r dbms
|
||||
[ $(echo "${dbms}" | grep -E 'postgres|mariadb') ] && break
|
||||
done
|
||||
|
||||
printf "Social database name: " && read -r db
|
||||
[ "${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|singleuser): " && read -r profile
|
||||
[ $(echo "${profile}" | grep -E 'public|private|community|singleuser') ] && break
|
||||
done
|
||||
|
||||
mkdir -p ./docker/db
|
||||
|
||||
|
||||
if [ ${dbms} = 'mariadb' ]; then
|
||||
read -p "DB root password: " db_root_password
|
||||
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}
|
||||
@ -28,14 +42,15 @@ else
|
||||
cat > ./docker/db/db.env <<EOF
|
||||
DBMS=${dbms}
|
||||
POSTGRES_USER=postgres
|
||||
POSTGRES_PASSWORD=${db_root_password}
|
||||
POSTGRES_PASSWORD=${password}
|
||||
EOF
|
||||
|
||||
user='postgres'
|
||||
database_url="DATABASE_URL=postgresql://${user}:${password}@db:5432/${db}"
|
||||
|
||||
fi
|
||||
|
||||
echo $database_url > .env.local
|
||||
echo "${database_url}" > .env.local
|
||||
|
||||
mkdir -p ./docker/social
|
||||
|
||||
|
@ -28,7 +28,6 @@ then
|
||||
-keyout "${lets_path}/live/${domain_root}/privkey.pem" \
|
||||
-out "${lets_path}/live/${domain_root}/fullchain.pem" -subj "/CN=${domain_root}"
|
||||
|
||||
nginx -s reload
|
||||
else
|
||||
echo "### Creating dummy certificate for ${domain_root} ..."
|
||||
openssl req -x509 -nodes -newkey rsa:1024 -days 1 \
|
||||
|
@ -3,11 +3,11 @@
|
||||
case "${DBMS}" in
|
||||
'postgres')
|
||||
PGPASSWORD="${POSTGRES_PASSWORD}" psql -ltq -Upostgres -hdb | \
|
||||
cut -d '|' -f1 | grep -wq "${SOCIAL_DB}"
|
||||
cut -d '|' -f1 | grep -Fwq "${SOCIAL_DB}"
|
||||
DB_EXISTS=$?
|
||||
;;
|
||||
'mariadb')
|
||||
mysqlcheck -cqs -uroot -p${MYSQL_ROOT_PASSWORD} -hdb social 2> /dev/null
|
||||
mysqlcheck -cqs -uroot -p"${MYSQL_ROOT_PASSWORD}" -hdb social 2> /dev/null
|
||||
DB_EXISTS=$?
|
||||
exit 1
|
||||
;;
|
||||
@ -16,11 +16,12 @@ case "${DBMS}" in
|
||||
exit 1
|
||||
esac
|
||||
|
||||
if [ ! ${DB_EXISTS} ]; then
|
||||
if [ ${DB_EXISTS} -ne 0 ]; then
|
||||
|
||||
echo -e "Installing GNU social\nInstalling composer dependencies"
|
||||
echo "Installing GNU social"
|
||||
echo "Installing composer dependencies"
|
||||
|
||||
cd /var/www/social
|
||||
cd /var/www/social || exit 1
|
||||
|
||||
composer install
|
||||
|
||||
@ -28,6 +29,9 @@ if [ ! ${DB_EXISTS} ]; then
|
||||
chown -R :www-data .
|
||||
|
||||
php bin/console doctrine:database:create || exit 1
|
||||
php bin/console doctrine:schema:create || exit 1
|
||||
|
||||
echo "GNU social is installed"
|
||||
else
|
||||
echo "GNU social is already installed"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user